This directory contains configuration to generate OpenAPI clients together with custom templates for part of generated code. Layout:
- configs - configuration files
- custom_templates - custom_templates directory used for all generated clients
OpenAPI client generation is orchestrated by script scripts/generate_client.sh. Script either creates a new client
if no such exists or update existing client code.
Use prepared make targets from repository root:
make afm-clientmake metadata-clientmake scan-client
Predefined targets use http://localhost:3000 URL to fetch OpenAPI schema.
When you need to point generator to different schema source, use generate_client.sh script directly.
Below is the example for gooddata-scan-client and schema on URL https://my-gd-cn, execute it from
the repository root:
./scripts/generate_client.sh gooddata-scan-client -u 'https://my-gd-cn'It is possible to generate default openapi generator templates. Execute the following from the repository root
docker run --rm \
-v "$(pwd):/local" \
-u $(id -u ${USER}):$(id -g ${USER}) \
openapitools/openapi-generator-cli:v5.3.1 author template \
-g python --library urllib3 \
-o /local/.openapi-generator/templatesTemplates can be used as the base for customizations. See templating documentation for the details.
If new file needs to be added refer to customization documentation.
List of options available for python generator is here.
There are also options common to all generators. Execute docker cli with help to list them.
docker run --rm \
-u $(id -u ${USER}):$(id -g ${USER}) \
openapitools/openapi-generator-cli help generateCode used to generate python client code is here
- Find out the last used generator version and the last used OpenAPI version
- Dump default templates and compare them with custom templates
- Update custom templates based on a new updates from generated templates
- Generate new clients using new version of generator and the last used version of OpenAPI