Spaces:
Sleeping
Sleeping
File size: 753 Bytes
ab98ae3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #!/usr/bin/env bash
# Regenerates the FastAPI routes and models in generated/ from infiniteradio.yml.
# Run after every change to the API definition; never edit generated/ by hand.
# Optional argument: output directory (default: generated).
set -euo pipefail
cd "$(dirname "$0")/.."
out="${1:-generated}"
# Import sorting depends on the output location, so always generate in a temp
# directory to get the same result wherever the output goes.
tmp="$(mktemp -d)"
trap 'rm -rf "$tmp"' EXIT
fastapi-codegen \
--input infiniteradio.yml \
--output "$tmp/generated" \
--template-dir codegen/templates \
--output-model-type pydantic_v2.BaseModel \
--disable-timestamp
touch "$tmp/generated/__init__.py"
rm -rf "$out"
cp -R "$tmp/generated" "$out"
|