diff options
Diffstat (limited to 'python_client/codegen_python_client.sh')
-rwxr-xr-x | python_client/codegen_python_client.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/python_client/codegen_python_client.sh b/python_client/codegen_python_client.sh new file mode 100755 index 00000000..85d12dc4 --- /dev/null +++ b/python_client/codegen_python_client.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# This script re-generates the fatcat API client (fatcat_client) from the +# swagger/openapi2 spec file, using automated tools ("codegen") + +set -exu +set -o pipefail + +OUTPUT=`pwd`/codegen-out +mkdir -p $OUTPUT +# Strip tags, so entire API is under a single class +cat ../fatcat-openapi2.yml | grep -v "TAGLINE$" > $OUTPUT/api.yml + +docker run \ + -v $OUTPUT:/tmp/swagger/ \ + swaggerapi/swagger-codegen-cli:v2.3.1 \ + generate \ + --lang python \ + --input-spec /tmp/swagger/api.yml \ + --output /tmp/swagger/ \ + -DpackageName=fatcat_client + +sudo chown -R `whoami`:`whoami` $OUTPUT +mkdir -p fatcat_client +mkdir -p tests/codegen_tests +cp -r $OUTPUT/fatcat_client/* fatcat_client +cp -r $OUTPUT/test/* tests/codegen_tests +cp $OUTPUT/README.md fatcat_client/README.md +# ooo, this makes me nervous +rm -rf $OUTPUT |