SDK_DIR=src/MyBundle/SdkFolder ; \
OPENAPI_URL="http://localhost:8080/api-doc.json" ; \
sh ./generate_openapi_php_sdk.sh
Last active
March 25, 2021 16:33
-
-
Save SylvainMarty/2d9a5176b3d57a21f2a0f4725fbfb4c5 to your computer and use it in GitHub Desktop.
Generate PHP SDK from OpenAPI with Docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
additionalProperties: | |
invokerPackage: MyBundle\SdkFolder | |
variableNamingConvention: camelCase |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
docker run -it --rm -v "$(shell pwd)/${SDK_DIR}:/local" \ | |
-u 1000 \ | |
openapitools/openapi-generator-cli \ | |
/bin/sh -c "java -Xmx1024M -DloggerPath=conf/log4j.properties -jar '/opt/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar' generate -i ${OPENAPI_URL} -g php -o /tmp -c /local/config.yml && cp -fR /tmp/lib/* /local" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Generate SDK for specific OpenAPI URL. Expects SDK_DIR=<src/Component/Agenda> and OPENAPI_URL=<http://localhost:5000/api-json> (SDK directory must contains a config.yml file) | |
openapi-gen-sdk: | |
printf "Generating SDK in $(shell pwd)/${SDK_DIR}\n" | |
docker run -it --rm -v "$(shell pwd)/${SDK_DIR}:/local" \ | |
-u 1000 \ | |
openapitools/openapi-generator-cli \ | |
/bin/sh -c "java -Xmx1024M -DloggerPath=conf/log4j.properties -jar '/opt/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar' generate -i ${OPENAPI_URL} -g php -o /tmp -c /local/config.yml && cp -fR /tmp/lib/* /local" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment