Skip to content

Commit

Permalink
fix: update spec generation to align with reality (#620)
Browse files Browse the repository at this point in the history
* fix: monster alignment update schema

* feat: add generated spec to git

* fix: correct class spell responses
  • Loading branch information
ecshreve authored Dec 4, 2024
1 parent 60c2eb7 commit f49a053
Show file tree
Hide file tree
Showing 8 changed files with 10,420 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"dev": "nodemon npm run start",
"lint": "eslint . --config eslint.config.js",
"validate-swagger": "swagger-cli validate src/swagger/swagger.yml",
"bundle-swagger": "npm run validate-swagger && swagger-cli bundle --outfile src/swagger/dist/openapi.yml --type yaml src/swagger/swagger.yml && swagger-cli bundle --outfile src/swagger/dist/openapi.json --type json src/swagger/swagger.yml",
"bundle-swagger": "npm run validate-swagger && swagger-cli bundle --outfile src/swagger/api-spec/openapi.yml --type yaml src/swagger/swagger.yml && swagger-cli bundle --outfile src/swagger/api-spec/openapi.json --type json src/swagger/swagger.yml",
"gen-postman": "npm run bundle-swagger && portman --cliOptionsFile portman-cli.json",
"test": "npm run test:unit && npm run test:integration:local",
"test:unit": "node --experimental-vm-modules node_modules/jest/bin/jest.js -c jest.config.unit.ts",
Expand Down
6,200 changes: 6,200 additions & 0 deletions src/swagger/api-spec/openapi.json

Large diffs are not rendered by default.

4,189 changes: 4,189 additions & 0 deletions src/swagger/api-spec/openapi.yml

Large diffs are not rendered by default.

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'
$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'
14 changes: 1 addition & 13 deletions src/swagger/schemas/monsters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,9 @@ monster-model:
subtype:
description: The sub-category of a monster used for classification of monsters."
type: string
alignments:
alignment:
description: "A creature's general moral and personal attitudes."
type: string
enum:
- chaotic neutral
- chaotic evil
- chaotic good
- lawful neutral
- lawful evil
- lawful good
- neutral
- neutral evil
- neutral good
- any alignment
- unaligned
armor_class:
description: 'The difficulty for a player to successfully deal damage to a monster.'
type: array
Expand Down
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

0 comments on commit f49a053

Please sign in to comment.