Defined the common response components for the OpenAPI specification document in the library target and applied them to its endpoints paths.

This commit is contained in:
2025-10-07 17:32:41 +02:00
parent f7fe7a1a9d
commit c2d6708b88
+79 -58
View File
@@ -56,17 +56,24 @@ externalDocs:
paths: paths:
/amiibo: /amiibo:
get: get:
summary: Get a list of Amiibo items.
description: Get a list of all the Amiibo items available in the database. description: Get a list of all the Amiibo items available in the database.
operationId: getAmiibos operationId: getAmiibos
tags:
- Amiibo
responses: responses:
'200': '200':
description: Successful response returning the object that contains a list of Amiibo items. description: Response that retuns a decodable JSON object containing a list of Amiibo items.
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/AmiiboWrapper' $ref: '#/components/schemas/AmiiboWrapper'
'400': '400':
description: Bad Amiibo request. $ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/Unavailable'
parameters: parameters:
- name: amiiboSeries - name: amiiboSeries
in: query in: query
@@ -124,24 +131,21 @@ paths:
schema: schema:
type: string type: string
style: form style: form
/amiiboseries: /amiiboseries:
get: get:
description: Get a list of all the Amiibo series available in the database. description: Get a list of all the Amiibo series available in the database.
operationId: getAmiiboSeries operationId: getAmiiboSeries
tags:
- Amiibo
responses: responses:
'200': '200':
description: Successful response returning the object that contains a list of Amiibo series. $ref: '#/components/responses/SuccessTuple'
content:
application/json:
schema:
$ref: '#/components/schemas/TupleWrapper'
'400': '400':
description: Bad Amiibo series request. $ref: '#/components/responses/BadRequest'
'404': '404':
description: Amiibo series not found. $ref: '#/components/responses/NotFound'
'500': '500':
description: Service currently not available. $ref: '#/components/responses/Unavailable'
parameters: parameters:
- name: key - name: key
in: query in: query
@@ -157,24 +161,21 @@ paths:
schema: schema:
type: string type: string
style: form style: form
/character: /character:
get: get:
description: Get a list of all the game characters available in the database. description: Get a list of all the game characters available in the database.
operationId: getGameCharacters operationId: getGameCharacters
tags:
- Game
responses: responses:
'200': '200':
description: Successful response returning the object that contains a list of game characters. $ref: '#/components/responses/SuccessTuple'
content:
application/json:
schema:
$ref: '#/components/schemas/TupleWrapper'
'400': '400':
description: Bad game character request. $ref: '#/components/responses/BadRequest'
'404': '404':
description: Game character not found. $ref: '#/components/responses/NotFound'
'500': '500':
description: Service currently not available. $ref: '#/components/responses/Unavailable'
parameters: parameters:
- name: key - name: key
in: query in: query
@@ -190,24 +191,21 @@ paths:
schema: schema:
type: string type: string
style: form style: form
/gameseries: /gameseries:
get: get:
description: Gets a list of all the game series available in the database. description: Gets a list of all the game series available in the database.
operationId: getGameSeries operationId: getGameSeries
tags:
- Game
responses: responses:
'200': '200':
description: Successful response returning the object that contains a list of game series. $ref: '#/components/responses/SuccessTuple'
content:
application/json:
schema:
$ref: '#/components/schemas/TupleWrapper'
'400': '400':
description: Bad game series request. $ref: '#/components/responses/BadRequest'
'404': '404':
description: Game series not found. $ref: '#/components/responses/NotFound'
'500': '500':
description: Service currently not available. $ref: '#/components/responses/Unavailable'
parameters: parameters:
- name: key - name: key
in: query in: query
@@ -223,24 +221,21 @@ paths:
schema: schema:
type: string type: string
style: form style: form
/type: /type:
get: get:
description: Gets a list of all the Amiibo types available in the database. description: Gets a list of all the Amiibo types available in the database.
operationId: getAmiiboTypes operationId: getAmiiboTypes
tags:
- Amiibo
responses: responses:
'200': '200':
description: Successful response returning the object that contains a list of Amiibo types. $ref: '#/components/responses/SuccessTuple'
content:
application/json:
schema:
$ref: '#/components/schemas/TupleWrapper'
'400': '400':
description: Bad Amiibo type request. $ref: '#/components/responses/BadRequest'
'404': '404':
description: Amiibo type not found. $ref: '#/components/responses/NotFound'
'500': '500':
description: Service currently not available. $ref: '#/components/responses/Unavailable'
parameters: parameters:
- name: key - name: key
in: query in: query
@@ -256,11 +251,12 @@ paths:
schema: schema:
type: string type: string
style: form style: form
/lastupdated: /lastupdated:
get: get:
description: Gets a timestamp when the Amiibo data was last updated. description: Gets a timestamp when the Amiibo data was last updated.
operationId: getLastUpdated operationId: getLastUpdated
tags:
- Service
responses: responses:
'200': '200':
description: Successful response returning the object that contains the date and time when the database was last updated. description: Successful response returning the object that contains the date and time when the database was last updated.
@@ -268,9 +264,43 @@ paths:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/LastUpdated' $ref: '#/components/schemas/LastUpdated'
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/Unavailable'
components: components:
responses:
BadRequest:
description: Response that indicates the service received a bad request.
content:
text/plain:
schema:
type: string
example: "Bad request"
NotFound:
description: Response that indicates the service cannot find a requested resource.
content:
text/plain:
schema:
type: string
example: "Not found"
SuccessTuple:
description: Response that returns a JSON object containing requested `Tuple` data from a resource.
content:
application/json:
schema:
$ref: '#/components/schemas/TupleWrapper'
Unavailable:
description: Response that indicates the service is unavailable to respond to requests.
content:
text/plain:
schema:
type: string
example: "Service unavailable"
schemas: schemas:
# Core Entities
Amiibo: Amiibo:
type: object type: object
properties: properties:
@@ -299,7 +329,6 @@ components:
name: name:
type: string type: string
release: release:
type: object
$ref: '#/components/schemas/AmiiboRelease' $ref: '#/components/schemas/AmiiboRelease'
tail: tail:
type: string type: string
@@ -315,7 +344,6 @@ components:
- release - release
- tail - tail
- type - type
AmiiboGame: AmiiboGame:
type: object type: object
properties: properties:
@@ -332,12 +360,10 @@ components:
required: required:
- gameID - gameID
- gameName - gameName
AmiiboList: AmiiboList:
type: array type: array
items: items:
$ref: '#/components/schemas/Amiibo' $ref: '#/components/schemas/Amiibo'
AmiiboRelease: AmiiboRelease:
type: object type: object
properties: properties:
@@ -353,7 +379,6 @@ components:
na: na:
type: string type: string
format: date-time format: date-time
AmiiboUsage: AmiiboUsage:
type: object type: object
properties: properties:
@@ -364,7 +389,15 @@ components:
required: required:
- Usage - Usage
- write - write
LastUpdated:
type: object
properties:
lastUpdated:
type: string
format: date-time
required:
- lastUpdated
# Wrapper Entities
AmiiboWrapper: AmiiboWrapper:
type: object type: object
properties: properties:
@@ -374,16 +407,6 @@ components:
- $ref: '#/components/schemas/AmiiboList' - $ref: '#/components/schemas/AmiiboList'
required: required:
- amiibo - amiibo
LastUpdated:
type: object
properties:
lastUpdated:
type: string
format: date-time
required:
- lastUpdated
Tuple: Tuple:
type: object type: object
properties: properties:
@@ -394,12 +417,10 @@ components:
required: required:
- key - key
- name - name
TupleList: TupleList:
type: array type: array
items: items:
$ref: '#/components/schemas/Tuple' $ref: '#/components/schemas/Tuple'
TupleWrapper: TupleWrapper:
type: object type: object
properties: properties: