2022-09-14 17:50:34 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
if [[ -f "openapi.yaml" ]]; then
|
|
|
|
rm openapi.yaml
|
|
|
|
fi
|
|
|
|
if [[ -d "generated" ]]; then
|
|
|
|
rm -r generated
|
|
|
|
fi
|
2022-09-15 16:17:19 +02:00
|
|
|
if [[ -d "../sdk" ]]; then
|
|
|
|
rm -r ../sdk
|
2022-09-14 17:50:34 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Generate new SDK
|
|
|
|
mkdir generated
|
|
|
|
cp ../../server/specs/openapi.yaml ./
|
|
|
|
docker run --rm \
|
|
|
|
-v ${PWD}/openapi.yaml:/openapi.yml \
|
|
|
|
-v ${PWD}/generated:/generated \
|
2022-09-15 16:38:09 +02:00
|
|
|
-v ${PWD}/config.json:/config.json \
|
2022-09-14 17:50:34 +02:00
|
|
|
-u $(id -u):$(id -g) \
|
|
|
|
swaggerapi/swagger-codegen-cli-v3 generate \
|
|
|
|
-i /openapi.yml \
|
|
|
|
-l javascript \
|
2022-09-15 16:38:09 +02:00
|
|
|
-o /generated \
|
|
|
|
-c /config.json
|
2022-09-14 17:50:34 +02:00
|
|
|
|
|
|
|
# Use a subset of the generated files
|
2022-09-15 16:17:19 +02:00
|
|
|
mv generated/src ../sdk
|
2022-09-14 17:50:34 +02:00
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
if [[ -f "openapi.yaml" ]]; then
|
|
|
|
rm openapi.yaml
|
|
|
|
fi
|
|
|
|
if [[ -d "generated" ]]; then
|
|
|
|
rm -r generated
|
|
|
|
fi
|