mirror of
https://github.com/xataio/pgroll.git
synced 2024-09-11 05:45:48 +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
|
.PHONY: generate
|
||||||
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
|
# 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
|
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"],
|
"required": ["up", "down"],
|
||||||
"oneOf": [
|
"oneOf": [
|
||||||
{"required": ["check"]},
|
{ "required": ["check"] },
|
||||||
{"required": ["type"]},
|
{ "required": ["type"] },
|
||||||
{"required": ["nullable"]},
|
{ "required": ["nullable"] },
|
||||||
{"required": ["unique"]},
|
{ "required": ["unique"] },
|
||||||
{"required": ["references"]}
|
{ "required": ["references"] }
|
||||||
],
|
],
|
||||||
"not": {
|
"not": {
|
||||||
"required": ["name"]
|
"required": ["name"]
|
||||||
@ -169,13 +169,13 @@
|
|||||||
"required": ["name"],
|
"required": ["name"],
|
||||||
"not": {
|
"not": {
|
||||||
"anyOf": [
|
"anyOf": [
|
||||||
{ "required": [ "up" ] },
|
{ "required": ["up"] },
|
||||||
{ "required": [ "down" ] },
|
{ "required": ["down"] },
|
||||||
{ "required": [ "check" ] },
|
{ "required": ["check"] },
|
||||||
{ "required": [ "type" ] },
|
{ "required": ["type"] },
|
||||||
{ "required": [ "nullable" ] },
|
{ "required": ["nullable"] },
|
||||||
{ "required": [ "unique" ] },
|
{ "required": ["unique"] },
|
||||||
{ "required": [ "references" ] }
|
{ "required": ["references"] }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user