feat: add quiet mode to suppress verbose generation output (#11211)#23831
Merged
Conversation
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
daadd46 to
91c816e
Compare
Contributor
Author
|
Rebased my commit on the current |
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! |
Member
|
let me try to review and get this merged this weekend. thanks again for the PR have a nice weekend. |
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. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement a
--quiet/-qflag 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:
-q,--quietin Generate command<quiet>true</quiet>openApiGenerator.quiet = trueif (!isQuietMode())guard, ensuring all other lifecycle activities execute normally regardless of quiet modeisQuietMode()to language-specific codegenVerification:
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
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.
master(upcoming7.x.0minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)"fixes #123"present in the PR description)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
-q,--quiet<quiet>true</quiet>oropenapi.generator.maven.plugin.quietopenApiGenerate.quiet = trueWorkflowSettingsandCodegenConfigurator#setQuiet, propagated viaGlobalSettingsRefactors
DefaultCodegenand 19 language generators withif (!isQuietMode())isQuietMode()helper to read thequietglobal settingWritten for commit 91c816e. Summary will update on new commits.