Format schema.json on generate (#294)

Add rule to format JSON Schema with prettier

---------

Signed-off-by: Alexis Rico <sferadev@gmail.com>
This commit is contained in:
Alexis Rico 2024-03-01 10:24:05 +01:00 committed by GitHub
parent c08ef7065c
commit 52fb532e63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 12 deletions

View File

@ -1,5 +1,9 @@
.PHONY: generate
generate:
# Format JSON schema
docker run --rm -v $$PWD/schema.json:/mnt/schema.json node:alpine npx prettier /mnt/schema.json --parser json --tab-width 2 --single-quote --trailing-comma all --no-semi --arrow-parens always --print-width 120 > schema.json.tmp
mv schema.json.tmp schema.json
# Generate the types from the JSON schema
docker run --rm -v $$PWD/schema.json:/mnt/schema.json omissis/go-jsonschema:0.14.1 --only-models -p migrations --tags json /mnt/schema.json > pkg/migrations/types.go