Validating Hyperborea character sheets via JSON Schema.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

45 lines
1.3 KiB

# https://taskfile.dev
version: "3"
tasks:
schemas:
sources: [ 'schemas-yaml/*' ]
generates: [ 'schemas-json/*' ]
cmds:
- fd -e yml -p ./schemas-yaml -x task schema SCHEMA='{}'
schema:
vars:
TRANSFORM:
sh: |
echo {{.SCHEMA}} | \
perl -lnE's/yml$/pl/; s/^/.\//; say if -f $_'
DEST:
sh: echo {{.SCHEMA}} | perl -pe's/ya?ml/json/g'
cmds:
- transerialize {{.SCHEMA}} {{.TRANSFORM}} {{.DEST}}
validate:
deps: [ schemas ]
silent: true
cmds:
- |
ajv validate \
--all-errors \
--errors=json \
--verbose \
--data \
-c ajv-keywords \
-c ./src/sumOf.cjs \
-c ./src/maxSpells.cjs \
-r schemas-json/classes.json \
-r schemas-json/languages.json \
-r schemas-json/races.json \
-r schemas-json/spells.json \
-s schemas-json/character.json \
-d {{.CLI_ARGS}}
test:
deps: [ schemas ]
cmds:
- vitest run