Open API and documentation improvements (#20)

This PR contains the work done to polish the `Open API` specification document as well as the `DocC` documentation even further, by removing unnecessary intermediate types and adding missing documentation.

Reviewed-on: #20
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit was merged in pull request #20.
This commit is contained in:
2025-10-28 15:41:02 +00:00
committed by Javier Cicchelli
parent 4623c13c24
commit 0d9c9e22a4
125 changed files with 181 additions and 175 deletions
@@ -0,0 +1,10 @@
# ``Amiibo``
## Topics
### Nested Models
- ``Amiibo/Game``
- ``Amiibo/Platform``
- ``Amiibo/Release``
- ``Amiibo/Usage``
@@ -61,10 +61,6 @@ $ make
### Models
- ``Amiibo``
- ``Amiibo/Game``
- ``Amiibo/Platform``
- ``Amiibo/Release``
- ``Amiibo/Usage``
- ``AmiiboSeries``
- ``AmiiboType``
- ``GameCharacter``
@@ -203,7 +203,7 @@ private extension AmiiboLiveClient {
switch output.amiibo {
case let .Amiibo(object):
return [Amiibo(object)]
case let .AmiiboList(list):
case let .case2(list):
return list
.map { Amiibo($0) }
.sorted { $0.identifier < $1.identifier }
@@ -247,7 +247,7 @@ private extension AmiiboLiveClient {
switch output.amiibo {
case let .AmiiboSeries(payload):
return [AmiiboSeries(payload.value1)]
case let .AmiiboSeriesList(list):
case let .case2(list):
return list
.map { AmiiboSeries($0.value1) }
.sorted { $0.key < $1.key }
@@ -289,7 +289,7 @@ private extension AmiiboLiveClient {
switch output.amiibo {
case let .AmiiboType(payload):
return [AmiiboType(payload.value1)]
case let .AmiiboTypeList(list):
case let .case2(list):
return list
.map { AmiiboType($0.value1) }
.sorted { $0.key < $1.key }
@@ -331,7 +331,7 @@ private extension AmiiboLiveClient {
switch output.amiibo {
case let .GameCharacter(payload):
return [GameCharacter(payload.value1)]
case let .GameCharacterList(list):
case let .case2(list):
return list
.map { GameCharacter($0.value1) }
.sorted { $0.key < $1.key }
@@ -373,7 +373,7 @@ private extension AmiiboLiveClient {
switch output.amiibo {
case let .GameSeries(payload):
return [GameSeries(payload.value1)]
case let .GameSeriesList(list):
case let .case2(list):
return list
.map { GameSeries($0.value1) }
.sorted { $0.key < $1.key }
@@ -14,19 +14,19 @@
/// A model that represents an amiibo series.
public struct AmiiboSeries: KeyNameModel {
// TODO: Remove the documentation from the properties of this type as the `--enable-inherited-docs` flag when generating DocC documentation is not working as intended (?).
// MARK: Properties
/// A key.
/// An amiibo series key.
public let key: String
/// A name.
/// An amiibo series name.
public let name: String
// MARK: Initializers
/// Initializes this model from a given payload.
/// - Parameter payload: A payload that contains the values for the model.
init(_ payload: Components.Schemas.Tuple) {
self.key = payload.key
self.name = payload.name
@@ -15,18 +15,18 @@
/// A model that represents an amiibo type.
public struct AmiiboType: KeyNameModel {
// TODO: Remove the documentation from the properties of this type as the `--enable-inherited-docs` flag when generating DocC documentation is not working as intended (?).
// MARK: Properties
/// A key.
/// An amiibo type key.
public let key: String
/// A name.
/// An amiibo type name.
public let name: String
// MARK: Initializers
/// Initializes this model from a given payload.
/// - Parameter payload: A payload that contains the values for the model.
init(_ payload: Components.Schemas.Tuple) {
self.key = payload.key
self.name = payload.name
@@ -15,18 +15,18 @@
/// A model that represents a game character.
public struct GameCharacter: KeyNameModel {
// TODO: Remove the documentation from the properties of this type as the `--enable-inherited-docs` flag when generating DocC documentation is not working as intended (?).
// MARK: Properties
/// A key.
/// A game character key.
public let key: String
/// A name.
/// A game character name.
public let name: String
// MARK: Initializers
/// Initializes this model from a given payload.
/// - Parameter payload: A payload that contains the values for the model.
init(_ payload: Components.Schemas.Tuple) {
self.key = payload.key
self.name = payload.name
@@ -15,18 +15,18 @@
/// A model that represents a game series.
public struct GameSeries: KeyNameModel {
// TODO: Remove the documentation from the properties of this type as the `--enable-inherited-docs` flag when generating DocC documentation is not working as intended (?).
// MARK: Properties
/// A key.
/// A game series key.
public let key: String
/// A name.
/// A game series name.
public let name: String
// MARK: Initializers
/// Initializes this model from a given payload.
/// - Parameter payload: A payload that contains the values for the model.
init(_ payload: Components.Schemas.Tuple) {
self.key = payload.key
self.name = payload.name
+31 -31
View File
@@ -357,6 +357,8 @@ components:
The positions 0 to 7 of the hexadecimal string.
type: string
pattern: "^[0-9a-fA-F]+$"
minLength: 8
maxLength: 8
image:
description: An image URL related to an amiibo.
@@ -374,6 +376,8 @@ components:
The positions 8 to 15 of the hexadecimal string.
type: string
pattern: "^[0-9a-fA-F]+$"
minLength: 8
maxLength: 8
type:
description: A name for the type an amiibo belongs to.
@@ -501,38 +505,14 @@ components:
key:
description: A key assigned to a tuple.
type: string
pattern: "^0x[0-9a-fA-F]+$"
minLength: 3
name:
description: A name assigned to a tuple.
type: string
required:
- key
- name
# List Entities
AmiiboList:
description: A type that contains a list of amiibos.
type: array
items:
$ref: '#/components/schemas/Amiibo'
AmiiboSeriesList:
description: A type that represents a list of amiibo series.
type: array
items:
$ref: '#/components/schemas/AmiiboSeries'
AmiiboTypeList:
description: A type that represents a list of amiibo types.
type: array
items:
$ref: '#/components/schemas/AmiiboType'
GameCharacterList:
description: A type that represents a list of game characters.
type: array
items:
$ref: '#/components/schemas/GameCharacter'
GameSeriesList:
description: A type that represents a list of game series.
type: array
items:
$ref: '#/components/schemas/GameSeries'
# Wrapper Entities
AmiiboWrapper:
description: A type that wraps either none, one or a list of amiibos.
@@ -542,7 +522,11 @@ components:
description: A container that have zero, one or more amiibos.
oneOf:
- $ref: '#/components/schemas/Amiibo'
- $ref: '#/components/schemas/AmiiboList'
description: A certain amiibo.
- type: array
description: A list that contains amiibos.
items:
$ref: '#/components/schemas/Amiibo'
AmiiboSeriesWrapper:
description: A type that wraps either one or a list of amiibo series.
type: object
@@ -551,7 +535,11 @@ components:
description: A container that have one or more amiibo series.
oneOf:
- $ref: '#/components/schemas/AmiiboSeries'
- $ref: '#/components/schemas/AmiiboSeriesList'
description: A certain amiibo series.
- type: array
description: A list that contains amiibo series.
items:
$ref: '#/components/schemas/AmiiboSeries'
required:
- amiibo
AmiiboTypeWrapper:
@@ -562,7 +550,11 @@ components:
description: A container that have one or more amiibo types.
oneOf:
- $ref: '#/components/schemas/AmiiboType'
- $ref: '#/components/schemas/AmiiboTypeList'
description: A certain amiibo type.
- type: array
description: A list that contains amiibo types.
items:
$ref: '#/components/schemas/AmiiboType'
required:
- amiibo
GameCharacterWrapper:
@@ -573,7 +565,11 @@ components:
description: A container that have one or more game characters.
oneOf:
- $ref: '#/components/schemas/GameCharacter'
- $ref: '#/components/schemas/GameCharacterList'
description: A certain game character.
- type: array
description: A list that contains game characters.
items:
$ref: '#/components/schemas/GameCharacter'
required:
- amiibo
GameSeriesWrapper:
@@ -584,7 +580,11 @@ components:
description: A container that have one or more game series.
oneOf:
- $ref: '#/components/schemas/GameSeries'
- $ref: '#/components/schemas/GameSeriesList'
description: A certain game series.
- type: array
description: A list that contains game series.
items:
$ref: '#/components/schemas/GameSeries'
required:
- amiibo
# Error Entities