Simplify author schema with items

This commit is contained in:
Nicholas Wallace 2024-05-14 04:01:44 +00:00
parent 8c2073c10a
commit bda3e625f6
2 changed files with 13 additions and 29 deletions

View file

@ -158,10 +158,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
oneOf: $ref: '../objects/entities/Author.yaml#/components/schemas/author'
- $ref: '../objects/entities/Author.yaml#/components/schemas/author'
- $ref: '../objects/entities/Author.yaml#/components/schemas/authorWithItems'
- $ref: '../objects/entities/Author.yaml#/components/schemas/authorWithSeries'
'404': '404':
$ref: '#/components/responses/author404' $ref: '#/components/responses/author404'
patch: patch:

View file

@ -28,7 +28,8 @@ components:
items: items:
ref: '../LibraryItem.yaml#/components/schemas/libraryItemMinified' ref: '../LibraryItem.yaml#/components/schemas/libraryItemMinified'
author: author:
description: An author object which includes a description and image path. summary: An author object which includes a description and image path.
description: An author object which includes a description and image path. The library items and series associated with the author are optionally included.
type: object type: object
properties: properties:
id: id:
@ -58,30 +59,16 @@ components:
$ref: '../../schemas.yaml#/components/schemas/addedAt' $ref: '../../schemas.yaml#/components/schemas/addedAt'
updatedAt: updatedAt:
$ref: '../../schemas.yaml#/components/schemas/updatedAt' $ref: '../../schemas.yaml#/components/schemas/updatedAt'
authorWithItems: libraryItems:
type: object description: The items associated with the author
description: The author schema with an array of items they are associated with. type: array
allOf: items:
- $ref: '#/components/schemas/author' $ref: '../LibraryItem.yaml#/components/schemas/libraryItemMinified'
- type: object series:
properties: description: The series associated with the author
libraryItems: type: array
description: The items associated with the author items:
type: array $ref: '#/components/schemas/authorSeries'
items:
$ref: '../LibraryItem.yaml#/components/schemas/libraryItemMinified'
authorWithSeries:
type: object
description: The author schema with an array of items and series they are associated with.
allOf:
- $ref: '#/components/schemas/authorWithItems'
- type: object
properties:
series:
description: The series associated with the author
type: array
items:
$ref: '#/components/schemas/authorSeries'
authorMinified: authorMinified:
type: object type: object
description: Minified author object which only contains the author name and ID. description: Minified author object which only contains the author name and ID.