Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update spec generation to align with reality #620

Merged
merged 3 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion src/swagger/api-spec/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/APIReferenceList"
"$ref": "#/components/schemas/ClassSpellList"
},
"example": {
"count": 2,
Expand Down Expand Up @@ -6161,6 +6161,39 @@
}
}
]
},
"ClassLevelSpell": {
"description": "`ClassLevelSpell`\n",
"allOf": [
{
"$ref": "#/components/schemas/APIReference"
},
{
"type": "object",
"properties": {
"level": {
"type": "number",
"description": "The level of the spell slot used to cast the spell."
}
}
}
]
},
"ClassSpellList": {
"description": "`ClassSpellList`\n",
"type": "object",
"properties": {
"count": {
"description": "Total number of resources available.",
"type": "number"
},
"results": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ClassLevelSpell"
}
}
}
}
}
}
Expand Down
24 changes: 23 additions & 1 deletion src/swagger/api-spec/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/APIReferenceList'
$ref: '#/components/schemas/ClassSpellList'
example:
count: 2
results:
Expand Down Expand Up @@ -4165,3 +4165,25 @@ components:
notes:
description: Information regarding the damage.
type: string
ClassLevelSpell:
description: |
`ClassLevelSpell`
allOf:
- $ref: '#/components/schemas/APIReference'
- type: object
properties:
level:
type: number
description: The level of the spell slot used to cast the spell.
ClassSpellList:
description: |
`ClassSpellList`
type: object
properties:
count:
description: Total number of resources available.
type: number
results:
type: array
items:
$ref: '#/components/schemas/ClassLevelSpell'
2 changes: 1 addition & 1 deletion src/swagger/paths/classes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class-spells-path:
content:
application/json:
schema:
$ref: '../schemas/combined.yml#/APIReferenceList'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw, in a versioned world i would totally look at reworking the actual endpoint implementation for all of these to return a more uniform shape for "spells with a level". but if feels more important to have the docs match the actual response first.

$ref: '../schemas/combined.yml#/ClassSpellList'
example:
count: 2
results:
Expand Down
23 changes: 23 additions & 0 deletions src/swagger/schemas/classes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,26 @@ class-level-model:
- $ref: '#/cs-sorcerer'
- $ref: '#/cs-warlock'
- $ref: '#/cs-wizard'
class-level-spell-model:
description: |
`ClassLevelSpell`
allOf:
- $ref: './combined.yml#/APIReference'
- type: object
properties:
level:
type: number
description: 'The level of the spell slot used to cast the spell.'

class-spell-list-model:
description: |
`ClassSpellList`
type: object
properties:
count:
description: 'Total number of resources available.'
type: number
results:
type: array
items:
$ref: '#/class-level-spell-model'
4 changes: 4 additions & 0 deletions src/swagger/schemas/combined.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,7 @@ OptionSet:
$ref: './common.yml#/option-set-model'
Option:
$ref: './common.yml#/option-model'
ClassLevelSpell:
$ref: './classes.yml#/class-level-spell-model'
ClassSpellList:
$ref: './classes.yml#/class-spell-list-model'
1 change: 1 addition & 0 deletions src/swagger/schemas/subclass.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ subclass-model:
$ref: "./combined.yml#/SpellPrerequisite"
spell:
$ref: "./combined.yml#/APIReference"

subclass-level-resource-model:
type: object
properties:
Expand Down
Loading