| 1 |
#!/usr/bin/env bash |
| 2 |
set -eu |
| 3 |
|
| 4 |
# This script uses schematyper, which must be installed and in the PATH, to |
| 5 |
# convert the json schema stored in schema/ignition.json into go structs for |
| 6 |
# json deserialization in config/types/schema.go. |
| 7 |
# |
| 8 |
# This script should be run whenever schema/ignition.json is modified. |
| 9 |
|
| 10 |
hash schematyper 2>/dev/null || { |
| 11 |
echo >&2 "schematyper must be installed and in the PATH to use this script: https://github.com/idubinskiy/schematyper" |
| 12 |
exit 1 |
| 13 |
} |
| 14 |
|
| 15 |
specs="v3_0 v3_1 v3_2 v3_3 v3_4_experimental" |
| 16 |
|
| 17 |
for spec in $specs |
| 18 |
do |
| 19 |
echo "Generating schema..." |
| 20 |
schematyper --package=types "config/${spec}/schema/ignition.json" -o "config/${spec}/types/schema.go" --root-type=Config |
| 21 |
done |