mirror of
https://github.com/xataio/pgroll.git
synced 2024-08-15 16:50:22 +03:00
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:
parent
c08ef7065c
commit
52fb532e63
4
Makefile
4
Makefile
@ -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
|
||||
|
||||
|
24
schema.json
24
schema.json
@ -155,11 +155,11 @@
|
||||
{
|
||||
"required": ["up", "down"],
|
||||
"oneOf": [
|
||||
{"required": ["check"]},
|
||||
{"required": ["type"]},
|
||||
{"required": ["nullable"]},
|
||||
{"required": ["unique"]},
|
||||
{"required": ["references"]}
|
||||
{ "required": ["check"] },
|
||||
{ "required": ["type"] },
|
||||
{ "required": ["nullable"] },
|
||||
{ "required": ["unique"] },
|
||||
{ "required": ["references"] }
|
||||
],
|
||||
"not": {
|
||||
"required": ["name"]
|
||||
@ -169,13 +169,13 @@
|
||||
"required": ["name"],
|
||||
"not": {
|
||||
"anyOf": [
|
||||
{ "required": [ "up" ] },
|
||||
{ "required": [ "down" ] },
|
||||
{ "required": [ "check" ] },
|
||||
{ "required": [ "type" ] },
|
||||
{ "required": [ "nullable" ] },
|
||||
{ "required": [ "unique" ] },
|
||||
{ "required": [ "references" ] }
|
||||
{ "required": ["up"] },
|
||||
{ "required": ["down"] },
|
||||
{ "required": ["check"] },
|
||||
{ "required": ["type"] },
|
||||
{ "required": ["nullable"] },
|
||||
{ "required": ["unique"] },
|
||||
{ "required": ["references"] }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user