Skip to content

Conversation

@btpnlsl
Copy link
Contributor

@btpnlsl btpnlsl commented Jul 8, 2025

fix Issue 19628

For consideration, this code change to DefaultGenerator.java allows API, MODELS, SUPPORTED_FILES & WEBHOOKS properties to include white space and newlines which are trimmed after splitting. This allows users to specify longer lists of models using maven without having to worry about extra spaces or newlines.

I opted to change DefaultGenerator instead of modifying the CodeGenMojo in the maven plugin since MODELS or APIS can be specified in either in modelsToGenerate or in the globalProperties/models setting. Doing so in DefaultGenerator allows for either method to span multi-lines. See the maven plugin README for an example of specifying MODELS via globalProperties or modelsToGenerate.

I've added a unit test in DefaultGeneratorTest that should cover all the properties except for WEBHOOKS. If there are some modifications I can make to the unit test to support multiple WEBHOOKS in the OpenAPI spec, let me know and I can add them.

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 is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request. @wing328

@wing328
Copy link
Member

wing328 commented Jul 9, 2025

when you've time, can you please rebase this change with the latest master?

thank you

@btpnlsl btpnlsl force-pushed the mutiline-models-and-apis branch from fba55b9 to cdebf4d Compare July 9, 2025 05:58
@btpnlsl
Copy link
Contributor Author

btpnlsl commented Jul 9, 2025

Rebased and fixed a couple of variable names in the unit test.

@wing328 wing328 merged commit 81e135e into OpenAPITools:master Jul 10, 2025
14 checks passed
@wing328
Copy link
Member

wing328 commented Jul 10, 2025

thanks for the contribution.

let's give it a try

@wing328 wing328 added this to the 7.15.0 milestone Jul 10, 2025
@wing328 wing328 changed the title [req] Allow models and apis list properties to span multi-lines and i… [req] Allow models and apis list properties to span multi-lines Aug 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REQ] Allow modelsToGenerate to have multiline input

3 participants