Improved the definition of the GET /type endpoint for the OpenAPI specification document in the library target.

This commit is contained in:
2025-10-14 23:31:10 +02:00
parent 1e8a9faa39
commit 9140707712
+68 -18
View File
@@ -209,10 +209,14 @@ paths:
description: Service is not available. description: Service is not available.
/type: /type:
get: get:
description: Gets a list of all the Amiibo types available in the database.
operationId: getAmiiboTypes
tags: tags:
- Amiibo - Amiibo
summary: Get the amiibo types.
description: |
Gets a list of all the Amiibo types available in the database.
Please refer to [the documentation of the endpoint](https://www.amiiboapi.com/docs/#type) for further information.
operationId: getAmiiboTypes
parameters: parameters:
- $ref: '#/components/parameters/Key' - $ref: '#/components/parameters/Key'
description: A key of an amiibo type to include in the response. description: A key of an amiibo type to include in the response.
@@ -220,11 +224,15 @@ paths:
description: A name of an amiibo type to include in the response. description: A name of an amiibo type to include in the response.
responses: responses:
'200': '200':
$ref: '#/components/responses/SuccessTuple' description: Successful response returning an object that contains one or more Amiibo types.
content:
application/json:
schema:
$ref: '#/components/schemas/AmiiboTypeWrapper'
'400': '400':
description: An amiibo type bad request. $ref: '#/components/responses/BadRequest'
'404': '404':
description: An amiibo type not found. $ref: '#/components/responses/NotFound'
'500': '500':
description: Service is not available. description: Service is not available.
/lastupdated: /lastupdated:
@@ -263,12 +271,18 @@ components:
schema: schema:
type: string type: string
responses: responses:
SuccessTuple: BadRequest:
description: Response that returns a JSON object containing requested `Tuple` data from a resource. description: One or more incorrect parameters have been sent.
content: content:
application/json: application/json:
schema: schema:
$ref: '#/components/schemas/TupleWrapper' $ref: '#/components/schemas/ServiceError'
NotFound:
description: No resource has been found.
content:
application/json:
schema:
$ref: '#/components/schemas/ServiceError'
schemas: schemas:
# Core Entities # Core Entities
Amiibo: Amiibo:
@@ -382,6 +396,16 @@ components:
description: A release date for North America, if any. description: A release date for North America, if any.
type: string type: string
format: date-time format: date-time
AmiiboType:
description: A type that represents an Amiibo type.
allOf:
- $ref: '#/components/schemas/Tuple'
- type: object
properties:
key:
description: A key of an Amiibo type.
name:
description: A name of an Amiibo type.
AmiiboUsage: AmiiboUsage:
description: A type that represents a use of an Amiibo in a game. description: A type that represents a use of an Amiibo in a game.
type: object type: object
@@ -433,20 +457,46 @@ components:
required: required:
- key - key
- name - name
TupleList:
description: A type that represents a list of key/value tuples.
type: array type: array
items: items:
description: A property that can contains multiple `Tuple` instances. description: A list if `Amiibo` instance.
$ref: '#/components/schemas/Tuple' $ref: '#/components/schemas/Amiibo'
TupleWrapper: AmiiboTypeList:
description: A type that contains either one or multiple `Tuple` instances. description: A type that represents a list of Amiibo types.
type: array
items:
$ref: '#/components/schemas/AmiiboType'
type: object type: object
properties: properties:
amiibo: amiibo:
description: A property that contains one or multiple `Tuple` instances. description: A property that contains one or multiple `Amiibo` instances.
oneOf: oneOf:
- $ref: '#/components/schemas/Tuple' - $ref: '#/components/schemas/Amiibo'
- $ref: '#/components/schemas/TupleList' - $ref: '#/components/schemas/AmiiboList'
required: required:
- amiibo - amiibo
AmiiboTypeWrapper:
description: A type that wraps either one or a list of Amiibo types.
type: object
properties:
amiibo:
description: A container that have one or more Amiibo types.
oneOf:
- $ref: '#/components/schemas/AmiiboType'
- $ref: '#/components/schemas/AmiiboTypeList'
required:
- amiibo
# Error Entities
ServiceError:
description: A type that represents an error provided by the service.
type: object
properties:
code:
description: A number of an error code.
type: integer
error:
description: An explanation of an error.
type: string
required:
- code
- error