Skip to content

feat: add quiet mode to suppress verbose generation output (#11211)#23831

Merged
wing328 merged 1 commit into
OpenAPITools:masterfrom
saxicek:saxicek/issue11211
Jun 21, 2026
Merged

feat: add quiet mode to suppress verbose generation output (#11211)#23831
wing328 merged 1 commit into
OpenAPITools:masterfrom
saxicek:saxicek/issue11211

Conversation

@saxicek

@saxicek saxicek commented May 20, 2026

Copy link
Copy Markdown
Contributor

Implement a --quiet / -q flag to suppress donation banners and contributor messages during code generation. This addresses issue #11211 by providing users a way to reduce noisy console output while maintaining full generation semantics.

Changes:

  • Add quiet mode configuration to WorkflowSettings (core module)
  • Wire quiet setting through CodegenConfigurator
  • Implement CLI option: -q, --quiet in Generate command
  • Add Maven plugin parameter: <quiet>true</quiet>
  • Add Gradle extension property: openApiGenerator.quiet = true
  • Refactor postProcess() in DefaultCodegen and 19 language generators to wrap println statements with if (!isQuietMode()) guard, ensuring all other lifecycle activities execute normally regardless of quiet mode
  • Add GlobalSettings lookup utility isQuietMode() to language-specific codegen
  • Update documentation for usage.md, Maven plugin README, Gradle plugin README
  • Add comprehensive test coverage across all modules:
    • WorkflowSettingsTest: quiet setting serialization
    • GenerateTest: CLI quiet flag parsing
    • DefaultGeneratorTest: postProcess execution verification
    • GenerateTaskDslTest: Gradle quiet output suppression
    • CodeGenMojoTest: Maven plugin quiet behavior

Verification:

  • DefaultGeneratorTest: 24 tests, 0 failures
  • GenerateTaskDslTest: all tests pass
  • Build: EXIT 0

This implementation maintains backward compatibility (quiet defaults to false) and ensures semantic correctness by always invoking postProcess(), affecting only the console output suppression behavior.

Closes #11211

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    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/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR solves a reported issue, reference it using GitHub's linking syntax (e.g., having "fixes #123" present in the PR description)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Adds a quiet mode to suppress donation and contributor banners during generation across CLI, Maven, and Gradle. Behavior is unchanged; postProcess still runs and quiet defaults to false.

  • New Features

    • CLI: -q, --quiet
    • Maven: <quiet>true</quiet> or openapi.generator.maven.plugin.quiet
    • Gradle: openApiGenerate.quiet = true
    • Core: WorkflowSettings and CodegenConfigurator#setQuiet, propagated via GlobalSettings
    • Docs and tests updated for CLI, Gradle, Maven, and generator lifecycle
  • Refactors

    • Wrapped banner prints in DefaultCodegen and 19 language generators with if (!isQuietMode())
    • Added isQuietMode() helper to read the quiet global setting

Written for commit 91c816e. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 36 files

Re-trigger cubic

@wing328

wing328 commented May 20, 2026

Copy link
Copy Markdown
Member

thanks for contributing this enhancement.

i'll review and let you know if i've any question or feedback.

…ols#11211)

Implement a `--quiet` / `-q` flag to suppress donation banners and contributor
messages during code generation. This addresses issue OpenAPITools#11211 by providing users
a way to reduce noisy console output while maintaining full generation semantics.

Changes:
- Add quiet mode configuration to WorkflowSettings (core module)
- Wire quiet setting through CodegenConfigurator
- Implement CLI option: `-q`, `--quiet` in Generate command
- Add Maven plugin parameter: `<quiet>true</quiet>`
- Add Gradle extension property: `openApiGenerator.quiet = true`
- Refactor postProcess() in DefaultCodegen and 19 language generators to wrap
  println statements with `if (!isQuietMode())` guard, ensuring all other
  lifecycle activities execute normally regardless of quiet mode
- Add GlobalSettings lookup utility `isQuietMode()` to language-specific codegen
- Update documentation for usage.md, Maven plugin README, Gradle plugin README
- Add comprehensive test coverage across all modules:
  * WorkflowSettingsTest: quiet setting serialization
  * GenerateTest: CLI quiet flag parsing
  * DefaultGeneratorTest: postProcess execution verification
  * GenerateTaskDslTest: Gradle quiet output suppression
  * CodeGenMojoTest: Maven plugin quiet behavior

Verification:
- DefaultGeneratorTest: 24 tests, 0 failures
- GenerateTaskDslTest: all tests pass
- Build: EXIT 0

This implementation maintains backward compatibility (quiet defaults to false)
and ensures semantic correctness by always invoking postProcess(), affecting
only the console output suppression behavior.

Closes OpenAPITools#11211
@saxicek saxicek force-pushed the saxicek/issue11211 branch from daadd46 to 91c816e Compare June 12, 2026 18:43
@saxicek

saxicek commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Rebased my commit on the current master branch.

@saxicek

saxicek commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

@wing328 Sorry to disturb, do you think you can check this anytime soon? Or shall I mention someone else to have a look? Thank you!

@wing328

wing328 commented Jun 19, 2026

Copy link
Copy Markdown
Member

let me try to review and get this merged this weekend.

thanks again for the PR

have a nice weekend.

@wing328

wing328 commented Jun 21, 2026

Copy link
Copy Markdown
Member

tested locally and worked as expected to suppress donation messages.

but later users may have feedback on what "quiet mode" means.

some other commands have quiet mode that suppresses even error messages while others only suppress "typical output" (INFO by the logger) for example.

we may need to further revise it after shipping it to our users.

@wing328 wing328 merged commit 862bfdb into OpenAPITools:master Jun 21, 2026
17 checks passed
@wing328 wing328 added this to the 7.24.0 milestone Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants