2017-03-09 16:27:23 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
|
|
# This script uses schematyper, which must be installed and in the PATH, to
|
|
|
|
|
# convert the json schema stored in schema/ignition.json into go structs for
|
|
|
|
|
# json deserialization in config/types/schema.go.
|
|
|
|
|
#
|
|
|
|
|
# This script should be run whenever schema/ignition.json is modified.
|
|
|
|
|
|
|
|
|
|
hash schematyper 2>/dev/null || {
|
|
|
|
|
echo >&2 "schematyper must be installed and in the PATH to use this script: https://github.com/idubinskiy/schematyper"
|
|
|
|
|
exit 1
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-30 14:45:50 +02:00
|
|
|
specs="v3_0 v3_1 v3_2 v3_3 v3_4 v3_5 v3_6_experimental"
|
2019-02-28 13:23:45 -08:00
|
|
|
|
|
|
|
|
for spec in $specs
|
|
|
|
|
do
|
2023-03-24 05:18:35 -04:00
|
|
|
echo "Generating $spec schema..."
|
2019-02-28 13:23:45 -08:00
|
|
|
schematyper --package=types "config/${spec}/schema/ignition.json" -o "config/${spec}/types/schema.go" --root-type=Config
|
|
|
|
|
done
|
2023-03-24 05:18:35 -04:00
|
|
|
|
|
|
|
|
echo "Generating docs..."
|
|
|
|
|
eval $(go env)
|
|
|
|
|
if [ -z ${BIN_PATH+a} ]; then
|
|
|
|
|
export BIN_PATH=${PWD}/bin/${GOARCH}
|
|
|
|
|
fi
|
2023-04-08 18:31:49 -04:00
|
|
|
go build -o ${BIN_PATH}/doc internal/doc/main.go
|
2023-03-24 05:18:35 -04:00
|
|
|
${BIN_PATH}/doc ${PWD}/docs
|