sanetrade/crates/alpaca_openapi/gen_alpaca.sh

19 lines
702 B
Bash
Raw Permalink Normal View History

2024-06-07 14:47:02 +00:00
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