Supported 'openapi‐generator‐maven‐plugin' Configuration options - Chrimle/openapi-to-java-records-mustache-templates GitHub Wiki
The plugin openapi-generator-maven-plugin has various configurations, <configuration>, which will affect what will be generated and how it will be generated.
Since openapi-generator-maven-plugin uses mustache to generate classes, overriding these mustache templates may result in classes being generated incorrectly, or not at all. Because of this, the following table will describe which configurations are supported, are inapplicable or are known to cause issues.
Important
This list of <configuration>-options are sourced from openapi-generator-maven-plugin/README.md, and may not always be up-to-date. For this reason, please refer to the original source for the detailed description of each option. The version being used can be found in the pom.xml-file.
Note
The options can be set either in the build <configuration>-tag,
or by the complete property name prefixed by openapi.generator.maven.plugin.{option}.
Tip
The following options are supported. See the second table for the remaining <configuration>-options.
| Option | Supported | Works as Designed | Additional Comments |
|---|---|---|---|
generateModels |
✔️ | ✔️ | |
modelPackage |
✔️ | ✔️ | |
modelNamePrefix |
✔️ | ✔️ | |
modelNameSuffix |
✔️ | ✔️ | |
library |
❗ | ❗ | Planned to support okhttp-gson (default) and webclient
|
configOptions |
❗ | ❗ | Planned to support configOptions for okhttp-gson (default) and webclient
|
templateDirectory |
✔️ | ✔️ | Not Applicable. |
groupId |
✔️ | ✔️ | Not Applicable. |
artifactId |
✔️ | ✔️ | Not Applicable. |
artifactVersion |
✔️ | ✔️ | Not Applicable. |
engine |
❌ | ❗ | Only mustache (default) is supported. |
generatorName |
❌ | ❗ | Only java (default) is supported. |
Warning
The following options have not yet been evaluated, and may either be ignored or may cause issues. Use caution when using these options.
Click to Expand
| Option | Applicable | Checked | Works as Designed | Additional Comments |
|---|---|---|---|---|
verbose |
||||
inputSpec |
||||
inputSpecRootDirectory |
||||
mergedFileName |
||||
language |
||||
cleanupOutput |
||||
output |
||||
gitHost |
||||
gitUserId |
||||
gitRepoId |
||||
collapsedSpec |
||||
includeCollapsedSpecInArtifacts |
||||
templateResourcePath |
||||
auth |
||||
configurationFile |
||||
skipOverwrite |
||||
apiPackage |
||||
invokerPackage |
||||
packageName |
||||
apiNameSuffix |
||||
ignoreFileOverride |
||||
httpUserAgent |
||||
removeOperationIdPrefix |
||||
skipOperationExample |
||||
logToStderr |
||||
enablePostProcessFile |
||||
skipValidateSpec |
||||
strictSpec |
||||
openapiNormalizer |
||||
generateAliasAsModel |
||||
instantiationTypes |
||||
importMappings |
||||
typeMappings |
||||
schemaMappings |
||||
nameMappings |
||||
modelNameMappings |
||||
parameterNameMappings |
||||
inlineSchemaNameMappings |
||||
inlineSchemaOptions |
||||
languageSpecificPrimitives |
||||
additionalProperties |
||||
serverVariableOverrides |
||||
reservedWordsMappings |
||||
generateApis |
||||
apisToGenerate |
||||
modelsToGenerate |
||||
generateSupportingFiles |
||||
supportingFilesToGenerate |
||||
generateModelTests |
||||
generateModelDocumentation |
||||
generateApiTests |
||||
generateApiDocumentation |
||||
skip |
||||
skipIfSpecIsUnchanged |
||||
addCompileSourceRoot |
||||
addTestCompileSourceRoot |
||||
dryRun |
||||
environmentVariables |
||||
globalProperties |
||||
configHelp |
Tip
The following options are supported and are completely optional. These can be enabled like so:
<configuration>
<configOptions>
<{option}>{value}</{option}>
</configOptions>
</configuration>Note
The execution.id-column refers to the id of the <execution> in the pom.xml. Example, the standard is named generate-standard.
| Option | Default value | Description | Since Version |
|---|---|---|---|
additionalEnumTypeAnnotations |
null |
Annotates generated Java enums with given annotations. Separate with semi-colon. | v1.6.2 |
additionalModelTypeAnnotations |
null |
Annotates generated Java records with given annotations. Separate with semi-colon. | v1.6.2 |
enumUnknownDefaultCase |
false |
Adds an extra enum constant, which will be the default value returned from fromValue(T value)
|
v2.7.0 |
generateBuilders |
false |
Generates an inner class Builder, with builder methods to build the parent record class. Does not generate a shallow-copy method. |
v1.7.0 |
serializableModel |
false |
Generated Java records implement Serializable, and has a private constant field serialVersionUID set to 1L. |
v1.6.2 |
useBeanValidation |
false |
Annotates record-fields with Bean Validation annotations (jakarta.validation.constraints) | v1.8.0 |
useEnumCaseInsensitive |
false |
Adds a case-insensitive parse-method fromValue(String) to each Enum class, if true. |
v1.3.0 |
useJakartaEe |
false |
Annotates fields with @Nullable/@Nonnull. Uses @jakarta if true, otherwise @javax. |
Warning
Other <configOptions> not listed here may either be ignored, or may cause issues. Use with caution.