You can specify what you are going to generate or what to exclude from generation using the command parameter --global-property
Take a look at the docs: https://openapi-generator.tech/docs/customization/#selective-generation
It says:
You may not want to generate all models in your project. Likewise, you may want just one or two apis to be written. If that's the case, you can use system properties or global properties to control the output.
The default is generate everything supported by the specific library. Once you enable a feature, it will restrict the contents generated:
# generate only models
--global-property models
# generate only apis
--global-property apis
# generate only supporting files
--global-property supportingFiles
# generate models and supporting files
--global-property models,supportingFiles
To control the specific files being generated, you can pass a CSV list of what you want:
# generate the User and Pet models only
--global-property models="User:Pet"
# generate the User model and the supportingFile `StringUtil.java`:
--global-property models=User,supportingFiles=StringUtil.java
To control generation of docs and tests for api and models, pass false to the option. For api, these options are --global-property apiTests=false,apiDocs=false. For models, --global-property modelTests=false,modelDocs=false. These options default to true and don't limit the generation of the feature options listed above (like --global-property api):
# generate only models (with tests and documentation)
--global-property models
# generate only models (with tests but no documentation)
--global-property models,modelDocs=false
# generate only User and Pet models (no tests and no documentation)
--global-property models="User:Pet",modelTests=false
# generate only apis (without tests)
--global-property apis,apiTests=false
# generate only apis (modelTests option is ignored)
--global-property apis,modelTests=false
When using selective generation, only the templates needed for the specific generation will be used.
To skip models defined as the form parameters in "requestBody", please use skipFormModel (default to true) (this option is introduced at v3.2.2 and true by default starting from v5.x).
--global-property skipFormModel=true
This option will be helpful to skip model generation due to the form parameter, which is defined differently in OAS3 as there's no form parameter in OAS3
apis
and then couldn't figure out why i was getting a bunch of compilation errors when models/supporting files (specificallyruntime.ts
in my case) weren't generated. – Playback