sanetrade/crates/alpaca_openapi/gen_alpaca.sh
2024-06-07 17:48:49 +03:00

18 lines
702 B
Bash
Executable file

set -euo pipefail
if [ $# -eq 1 ] && [ -f openapi/$1/openapi.yaml ]; then
spec=openapi/$1/openapi.yaml
if [ -f $spec ]; then
echo "regen $1 ($spec)"
rm -rf ./gen/$1
openapi-generator-cli generate -i $spec -g rust -o ./gen/$1 --additional-properties=packageName=alpaca_$1,library=reqwest,supportMultipleResponses=true,useSingleRequestParameter=true
fi
else
for i in $(ls openapi); do
spec=openapi/$i/openapi.yaml
if [ -f $spec ]; then
echo "gen from $i ($spec)"
openapi-generator-cli generate -i $spec -g rust -o ./gen/$i --additional-properties=packageName=alpaca_$i,library=reqwest,supportMultipleResponses=true,useSingleRequestParameter=true
fi
done
fi