Based on some feedback in #6509, this PR allows users to run ./bin/generate-samples.sh
with a single config and additional arguments similar to how individual bash scripts previously worked.
See also #6608 which updates docs for Windows users to execute through GitBash or equivalent.
Examples are embedded in the script as a header/preamble so users will always be presented these options without the need to --help
.
For example:
# START SCRIPT: ./bin/utils/ensure-up-to-date
IMPORTANT: this script should be run by the CI (e.g. Shippable) to ensure that the 'samples/' folder is up to date.
# START SCRIPT: /Users/jim/projects/openapi-generator/bin/generate-samples.sh
This script generates all configs under bin/configs by default.
You may generate a targeted script or set of scripts using glob patterns.
For example:
/Users/jim/projects/openapi-generator/bin/generate-samples.sh bin/configs/java-*
You may generate a single config with additional options if you use -- to
separate the single config file from the generator arguments.
For example:
/Users/jim/projects/openapi-generator/bin/generate-samples.sh bin/configs/java-vertx.yaml -- --global-property debugModels=true
Please press CTRL+C to stop or the script will continue in 5 seconds.
This should have little or no impact on users following our docs, which describe running the generate command from the jar directly.
cc @OpenAPITools/generator-core-team
PR checklist
-
Read the contribution guidelines. -
If contributing template-only or documentation-only changes which will change sample output, build the project beforehand. -
Run the shell script ./bin/generate-samples.sh
to update all Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example./bin/generate-samples.sh bin/config/java*
. -
File the PR against the correct branch: master
,4.3.x
,5.0.x
. Default:master
. -
Copy the technical committee to review the pull request if your PR is targeting a particular programming language.