Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci][cli] Allow invoking generate-samples.sh with single file + args #6609

Merged

Conversation

jimschubert
Copy link
Member

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.shto 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.

@auto-labeler
Copy link

auto-labeler bot commented Jun 10, 2020

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

@jimschubert jimschubert added this to the 5.0.0 milestone Jun 10, 2020
Copy link
Member

@wing328 wing328 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and works like a charm

@wing328 wing328 merged commit 0cb080d into OpenAPITools:master Jun 11, 2020
@jimschubert jimschubert deleted the generate-samples-allow-generate branch June 12, 2020 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants