feat: add new YAML schemas for media search results and related properties

This commit is contained in:
JasonLandbridge
2025-06-08 16:56:39 +02:00
parent 5b9a57a61b
commit 926db1fd1a
19 changed files with 367 additions and 32 deletions

View File

@@ -0,0 +1,6 @@
type: object
properties:
count:
description: "The number of items associated with this search result."
type: integer
example: 10

View File

@@ -0,0 +1,6 @@
type: object
properties:
filter:
description: "The filter string used to query this specific item in the library."
type: string
example: "actor=197429"

View File

@@ -0,0 +1,5 @@
type: object
properties:
id:
type: integer
example: 197429

View File

@@ -0,0 +1,6 @@
type: object
properties:
key:
description: "The unique identifier path for the search result item."
type: string
example: "/library/sections/3/all?actor=197429"

View File

@@ -0,0 +1,6 @@
type: object
properties:
librarySectionID:
description: "The unique identifier of the library section containing this item."
type: integer
example: 3

View File

@@ -0,0 +1,6 @@
type: object
properties:
librarySectionKey:
description: "The path to access the library section containing this item."
type: string
example: "/library/sections/3"

View File

@@ -0,0 +1,5 @@
type: object
properties:
librarySectionTitle:
type: string
example: "Movies"

View File

@@ -0,0 +1,9 @@
type: object
properties:
librarySectionType:
type: integer
oneOf:
- const: 1
title: Movie
- const: 2
title: TV Show

View File

@@ -0,0 +1,6 @@
type: object
properties:
tagKey:
description: "The unique identifier for the tag associated with this search result."
type: string
example: "5d776826999c64001ec2c606"

View File

@@ -0,0 +1,10 @@
type: object
properties:
tagType:
description: "The type of tag associated with this search result (e.g., Director, Actor)."
type: integer
oneOf:
- const: 4
title: Director
- const: 6
title: Actor

View File

@@ -0,0 +1,5 @@
type: object
properties:
tag:
type: string
example: "Ben Stiller"

View File

@@ -0,0 +1,7 @@
type: object
properties:
thumb:
description: "The URL to the thumbnail image associated with this search result."
type: string
format: uri
example: "https://metadata-static.plex.tv/5/people/57bd7c7d6c5c9e2881251b30e5603d3d.jpg"

View File

@@ -0,0 +1,6 @@
type: object
properties:
type:
description: "The type of the directory."
type: string
example: tag

View File

@@ -0,0 +1,7 @@
type: object
properties:
score:
description: "The score of the search result, typically a float value between 0 and 1."
type: number
format: float
example: 0.92

View File

@@ -1,6 +1,4 @@
type: object type: object
required:
- videoFrameRate
properties: properties:
videoFrameRate: videoFrameRate:
type: string type: string

View File

@@ -1,6 +1,4 @@
type: object type: object
required:
- videoProfile
properties: properties:
videoProfile: videoProfile:
type: string type: string

View File

@@ -56,26 +56,209 @@ get:
- MediaContainer - MediaContainer
properties: properties:
MediaContainer: MediaContainer:
type: object allOf:
required: - $ref: "../../models/media-container/size.yaml"
- size - $ref: "../../models/media-container/allow-sync.yaml"
- SearchResult - $ref: "../../models/media-container/identifier.yaml"
properties: - $ref: "../../models/media-container/library-section-id.yaml"
size: - $ref: "../../models/media-container/library-section-title.yaml"
type: number - $ref: "../../models/media-container/library-section-uuid.yaml"
SearchResult: - $ref: "../../models/media-container/media-tag-prefix.yaml"
type: array - $ref: "../../models/media-container/media-tag-version.yaml"
items: - type: object
type: object required:
required: - SearchResult
- score properties:
- Metadata SearchResult:
properties: type: array
score: items:
type: number allOf:
format: float # This is correct for 32-bit floating-point numbers - type: object
Metadata: required:
$ref: "../../models/MetaData.yaml" - score
- $ref: "../../models/media-container/search-result/score.yaml"
- type: object
properties:
Directory:
allOf:
- type: object
required:
- key
- librarySectionID
- librarySectionKey
- librarySectionTitle
- type
- id
- tag
- $ref: "../../models/media-container/search-result/directory/key.yaml"
- $ref: "../../models/meta-data/library-section-id.yaml"
- $ref: "../../models/meta-data/library-section-key.yaml"
- $ref: "../../models/meta-data/library-section-title.yaml"
- $ref: "../../models/media-container/search-result/directory/library-section-type.yaml"
- $ref: "../../models/media-container/search-result/directory/type.yaml"
- $ref: "../../models/media-container/search-result/directory/id.yaml"
- $ref: "../../models/media-container/search-result/directory/filter.yaml"
- $ref: "../../models/media-container/search-result/directory/tag.yaml"
- $ref: "../../models/media-container/search-result/directory/tag-type.yaml"
- $ref: "../../models/media-container/search-result/directory/tag-key.yaml"
- $ref: "../../models/media-container/search-result/directory/thumb.yaml"
- $ref: "../../models/media-container/search-result/directory/count.yaml"
Metadata:
type: object
allOf:
- $ref: "../../models/meta-data/rating-key.yaml"
- $ref: "../../models/meta-data/key.yaml"
- $ref: "../../models/meta-data/guid.yaml"
- $ref: "../../models/meta-data/slug.yaml"
- $ref: "../../models/meta-data/studio.yaml"
- $ref: "../../models/meta-data/type.yaml"
- $ref: "../../models/meta-data/title.yaml"
- $ref: "../../models/meta-data/banner.yaml"
- $ref: "../../models/meta-data/title-sort.yaml"
- $ref: "../../models/meta-data/content-rating.yaml"
- $ref: "../../models/meta-data/summary.yaml"
- $ref: "../../models/meta-data/rating.yaml"
- $ref: "../../models/meta-data/audience-rating.yaml"
- $ref: "../../models/meta-data/year.yaml"
- $ref: "../../models/meta-data/tagline.yaml"
- $ref: "../../models/meta-data/thumb.yaml"
- $ref: "../../models/meta-data/art.yaml"
- $ref: "../../models/meta-data/theme.yaml"
- $ref: "../../models/meta-data/index.yaml"
- $ref: "../../models/meta-data/leaf-count.yaml"
- $ref: "../../models/meta-data/viewed-leaf-count.yaml"
- $ref: "../../models/meta-data/child-count.yaml"
- $ref: "../../models/meta-data/season-count.yaml"
- $ref: "../../models/meta-data/duration.yaml"
- $ref: "../../models/meta-data/originally-available-at.yaml"
- $ref: "../../models/meta-data/added-at.yaml"
- $ref: "../../models/meta-data/updated-at.yaml"
- $ref: "../../models/meta-data/parent-year.yaml"
- $ref: "../../models/meta-data/audience-rating-image.yaml"
- $ref: "../../models/meta-data/chapter-source.yaml"
- $ref: "../../models/meta-data/primary-extra-key.yaml"
- $ref: "../../models/meta-data/original-title.yaml"
- $ref: "../../models/meta-data/parent-rating-key.yaml"
- $ref: "../../models/meta-data/grandparent-rating-key.yaml"
- $ref: "../../models/meta-data/parent-guid.yaml"
- $ref: "../../models/meta-data/grandparent-guid.yaml"
- $ref: "../../models/meta-data/grandparent-slug.yaml"
- $ref: "../../models/meta-data/grandparent-key.yaml"
- $ref: "../../models/meta-data/parent-key.yaml"
- $ref: "../../models/meta-data/grandparent-title.yaml"
- $ref: "../../models/meta-data/grandparent-thumb.yaml"
- $ref: "../../models/meta-data/grandparent-theme.yaml"
- $ref: "../../models/meta-data/grandparent-art.yaml"
- $ref: "../../models/meta-data/parent-title.yaml"
- $ref: "../../models/meta-data/parent-index.yaml"
- $ref: "../../models/meta-data/parent-thumb.yaml"
- $ref: "../../models/meta-data/rating-image.yaml"
- $ref: "../../models/meta-data/view-count.yaml"
- $ref: "../../models/meta-data/view-offset.yaml"
- $ref: "../../models/meta-data/skip-count.yaml"
- $ref: "../../models/meta-data/subtype.yaml"
- $ref: "../../models/meta-data/last-rated-at.yaml"
- $ref: "../../models/meta-data/created-at-accuracy.yaml"
- $ref: "../../models/meta-data/created-at-tz-offset.yaml"
- $ref: "../../models/meta-data/last-viewed-at.yaml"
- $ref: "../../models/meta-data/user-rating.yaml"
- $ref: "../../models/meta-data/objects/image.yaml"
- $ref: "../../models/meta-data/objects/ultra-blur-colors.yaml"
- $ref: "../../models/meta-data/guid/guid-array.yaml"
- $ref: "../../models/meta-data/library-section-id.yaml"
- $ref: "../../models/meta-data/library-section-title.yaml"
- $ref: "../../models/meta-data/library-section-key.yaml"
- $ref: "../../models/meta-data/show-ordering.yaml"
- $ref: "../../models/meta-data/flatten-seasons.yaml"
- $ref: "../../models/meta-data/skip-children.yaml"
- type: object
properties:
Media:
type: array
items:
allOf:
- $ref: "../../models/media/id.yaml"
- $ref: "../../models/media/duration.yaml"
- $ref: "../../models/media/bitrate.yaml"
- $ref: "../../models/media/width.yaml"
- $ref: "../../models/media/height.yaml"
- $ref: "../../models/media/aspect-ratio.yaml"
- $ref: "../../models/media/audio-channels.yaml"
- $ref: "../../models/media/display-offset.yaml"
- $ref: "../../models/media/audio-codec.yaml"
- $ref: "../../models/media/video-codec.yaml"
- $ref: "../../models/media/video-resolution.yaml"
- $ref: "../../models/media/container.yaml"
- $ref: "../../models/media/video-frame-rate.yaml"
- $ref: "../../models/media/video-profile.yaml"
- $ref: "../../models/media/has-voice-activity.yaml"
- $ref: "../../models/media/audio-profile.yaml"
- $ref: "../../models/media/optimized-for-streaming.yaml"
- $ref: "../../models/media/has-64bit-offsets.yaml"
- type: object
properties:
Part:
type: array
items:
allOf:
- $ref: "../../models/media/part/accessible.yaml"
- $ref: "../../models/media/part/exists.yaml"
- $ref: "../../models/media/part/id.yaml"
- $ref: "../../models/media/part/key.yaml"
- $ref: "../../models/media/part/indexes.yaml"
- $ref: "../../models/media/part/duration.yaml"
- $ref: "../../models/media/part/file.yaml"
- $ref: "../../models/media/part/size.yaml"
- $ref: "../../models/media/part/packet-length.yaml"
- $ref: "../../models/media/part/container.yaml"
- $ref: "../../models/media/part/video-profile.yaml"
- $ref: "../../models/media/part/audio-profile.yaml"
- $ref: "../../models/media/part/has-64bit-offsets.yaml"
- $ref: "../../models/media/part/optimized-for-streaming.yaml"
- $ref: "../../models/media/part/has-thumbnail.yaml"
Genre:
type: array
items:
allOf:
- $ref: "../../models/genre/id.yaml"
- $ref: "../../models/genre/tag.yaml"
Country:
type: array
items:
allOf:
- $ref: "../../models/country/id.yaml"
- $ref: "../../models/country/tag.yaml"
Director:
type: array
items:
allOf:
- $ref: "../../models/director/id.yaml"
- $ref: "../../models/director/tag.yaml"
- $ref: "../../models/director/thumb.yaml"
Writer:
type: array
items:
allOf:
- $ref: "../../models/writer/id.yaml"
- $ref: "../../models/writer/tag.yaml"
- $ref: "../../models/writer/thumb.yaml"
Role:
type: array
items:
allOf:
- $ref: "../../models/role/id.yaml"
- $ref: "../../models/role/tag.yaml"
- $ref: "../../models/role/role.yaml"
- $ref: "../../models/role/thumb.yaml"
Location:
type: array
items:
allOf:
- type: object
required:
- path
- $ref: "../../models/meta-data/location/path.yaml"
"400": "400":
$ref: "../../responses/400.yaml" $ref: "../../responses/400.yaml"
"401": "401":

View File

@@ -303,14 +303,11 @@ get:
Location: Location:
type: array type: array
items: items:
type: object allOf:
required: - type: object
- path required:
properties: - path
path: - $ref: "../../../../models/meta-data/location/path.yaml"
type: string
description: "The file path for the location."
example: "/TV Shows/Better Call Saul"
Chapter: Chapter:
type: array type: array
items: items:

View File

@@ -35301,4 +35301,73 @@ describe("GET /library/search", () => {
validateResponseSpec("/library/search", "get", 200, response) validateResponseSpec("/library/search", "get", 200, response)
}) })
it("SAMPLE #4 - should validate the 200 response when the API spec is valid", () => {
const response = {
MediaContainer: {
size: 3,
SearchResult: [
{
score: 0.92,
Directory: {
key: "/library/sections/3/all?actor=197429",
librarySectionID: 3,
librarySectionKey: "/library/sections/3",
librarySectionTitle: "Movies",
librarySectionType: 1,
type: "tag",
id: 197429,
filter: "actor=197429",
tag: "Ben Stiller",
tagType: 6,
tagKey: "5d776826999c64001ec2c606",
thumb:
"https://metadata-static.plex.tv/5/people/57bd7c7d6c5c9e2881251b30e5603d3d.jpg",
count: 10
}
},
{
score: 0.92,
Directory: {
key: "/library/sections/1/all?actor=197429",
librarySectionID: 1,
librarySectionKey: "/library/sections/1",
librarySectionTitle: "TV Shows",
librarySectionType: 2,
type: "tag",
id: 197429,
filter: "actor=197429",
tag: "Ben Stiller",
tagType: 6,
tagKey: "5d776826999c64001ec2c606",
thumb:
"https://metadata-static.plex.tv/5/people/57bd7c7d6c5c9e2881251b30e5603d3d.jpg",
count: 4
}
},
{
score: 0.92,
Directory: {
key: "/library/sections/3/all?director=227480",
librarySectionID: 3,
librarySectionKey: "/library/sections/3",
librarySectionTitle: "Movies",
librarySectionType: 1,
type: "tag",
id: 227480,
filter: "director=227480",
tag: "Ben Stiller",
tagType: 4,
tagKey: "5d776826999c64001ec2c606",
thumb:
"https://metadata-static.plex.tv/5/people/57bd7c7d6c5c9e2881251b30e5603d3d.jpg",
count: 1
}
}
]
}
}
validateResponseSpec("/library/search", "get", 200, response)
})
}) })