mn:generate-openapi-server
Full name:
io.micronaut.maven:micronaut-maven-plugin:4.11.2:generate-openapi-server
Description:
Generates an OpenAPI server. The sources are generated in the target directory.
Attributes:
- Requires a Maven project to be executed.
 - The goal is not marked as thread-safe and thus does not support parallel builds.
 - Since version: 
4.0.0. - Binds by default to the lifecycle phase: 
generate-sources. 
Required Parameters
| Name | Type | Since | Description | 
|---|---|---|---|
<alwaysUseGenerateHttpResponse> | 
boolean | 
- | 
If true, the generated operation return types will be wrapped in HttpResponse. Default: falseUser Property: micronaut.openapi.always.use.generate.http.response | 
<apiPackageName> | 
String | 
- | 
The package name for the APIs (controller interfaces). Default: io.micronaut.openapi.apiUser Property: micronaut.openapi.api.package.name | 
<controllerPackageName> | 
String | 
- | 
The package name of the controller if controller implementation files are generated. Default: io.micronaut.openapi.controller.package.nameUser Property: micronaut.openapi.server.controller.package.name | 
<dateTimeFormat> | 
String | 
- | 
Configure the date-time format. Default: ZONED_DATETIMEUser Property: micronaut.openapi.date.time.format | 
<definitionFile> | 
File | 
- | 
The OpenAPI specification file path relative to the project's root path. Default: io.micronaut.openapi.invokerUser Property: micronaut.openapi.definition | 
<generateHttpResponseWhereRequired> | 
boolean | 
- | 
Wrap the operations response in HttpResponse object where non-200 HTTP status codes or additional headers are defined. Default: trueUser Property: micronaut.openapi.generate.http.response.where.required | 
<invokerPackageName> | 
String | 
- | 
The name of the package that can be used for various classes required for invocation. Default: io.micronaut.openapi.invokerUser Property: micronaut.openapi.invoker.package.name | 
<ksp> | 
boolean | 
- | 
If set to true, generated code will be fully compatible with KSP, but not 100% with KAPT. Default: falseUser Property: micronaut.openapi.ksp | 
<modelPackageName> | 
String | 
- | 
The package name for the model classes. Default: io.micronaut.openapi.modelUser Property: micronaut.openapi.model.package.name | 
<outputDirectory> | 
File | 
- | 
The output directory to which all the sources will be generated. Default: ${project.build.directory}/generated-sources/openapi | 
<outputKinds> | 
List<String> | 
- | 
Comma-separated values of output kinds to generate. The values are defined by the io.micronaut.openapi.generator.MicronautCodeGeneratorEntryPoint.OutputKind enum.Default: apis,models,supporting_filesUser Property: micronaut.openapi.outputs | 
<serializationFramework> | 
String | 
- | 
Configure the serialization library. Default: MICRONAUT_SERDE_JACKSONUser Property: micronaut.openapi.serialization.framework | 
<useBeanValidation> | 
boolean | 
- | 
Whether to generate validation annotations for models and APIs. Default: trueUser Property: micronaut.openapi.use.bean.validation | 
<useOneOfInterfaces> | 
boolean | 
- | 
Flag to indicate whether to use the utils.OneOfImplementorAdditionalData related logic. Default: trueUser Property: micronaut.openapi.use.one.of.interfaces | 
<useOptional> | 
boolean | 
- | 
Whether to use java.util.Optional for non-required model properties and API parameters.Default: falseUser Property: micronaut.openapi.use.optional | 
<useReactive> | 
boolean | 
- | 
Whether to use reactor types for operation responses. Default: trueUser Property: micronaut.openapi.use.reactive | 
Optional Parameters
| Name | Type | Since | Description | 
|---|---|---|---|
<additionalEnumTypeAnnotations> | 
List<String> | 
- | 
Additional annotations for enum type (class level annotations). User Property: micronaut.openapi.additionalEnumTypeAnnotations | 
<additionalModelTypeAnnotations> | 
List<String> | 
- | 
Additional annotations for model type (class level annotations). User Property: micronaut.openapi.additionalModelTypeAnnotations | 
<additionalOneOfTypeAnnotations> | 
List<String> | 
- | 
Additional annotations for oneOf interfaces (class level annotations). User Property: micronaut.openapi.additionalOneOfTypeAnnotations | 
<additionalProperties> | 
Map<String,Object> | 
- | 
Additional generator properties. User Property: micronaut.openapi.additionalProperties | 
<allowUnicodeIdentifiers> | 
boolean | 
- | 
boolean, toggles whether Unicode identifiers are allowed in names or not, default is false. User Property: micronaut.openapi.allowUnicodeIdentifiers | 
<aotCompatible> | 
boolean | 
4.2.2 | 
If set to true, the generated code should be made compatible with Micronaut AOT. User Property: micronaut.openapi.server.aot.compatible | 
<apiNamePrefix> | 
String | 
- | 
Set the api name prefix. User Property: micronaut.openapi.apiNamePrefix | 
<apiNameSuffix> | 
String | 
- | 
Set the api name suffix. User Property: micronaut.openapi.apiNameSuffix | 
<coroutines> | 
boolean | 
4.8.0 | 
If set to true, generated code will be with suspend methods. Ony for kotlin generator. User Property: micronaut.openapi.coroutines | 
<enabled> | 
boolean | 
- | 
The property that defines if this mojo should be used in configuration. User Property: micronaut.openapi.generate.server | 
<ensureUniqueParams> | 
boolean | 
- | 
Whether to ensure parameter names are unique in an operation (rename parameters that are not). Default: trueUser Property: micronaut.openapi.ensureUniqueParams | 
<enumNameMapping> | 
Map<String,String> | 
- | 
Add the enum name mappings. User Property: micronaut.openapi.enumNameMapping | 
<fluxForArrays> | 
boolean | 
4.2.2 | 
Determines if the server should use flux for arrays. User Property: micronaut.openapi.server.flux.for.arrays | 
<generateControllerAsAbstract> | 
boolean | 
4.8.0 | 
If true, the generated controller interface will be without `@Controller` annotation. User Property: micronaut.openapi.generateControllerAsAbstract | 
<generateSwaggerAnnotations> | 
boolean | 
- | 
If set to true, controller and client method will be generated with openAPI annotations. Default: falseUser Property: micronaut.openapi.generateSwaggerAnnotations | 
<generatedAnnotation> | 
boolean | 
4.2.2 | 
If set to true, the `javax.annotation.Generated` annotation will be added to all generated classes. Default: trueUser Property: micronaut.openapi.server.generated.annotation | 
<implicitHeaders> | 
boolean | 
- | 
Set the implicit headers flag. Default: falseUser Property: micronaut.openapi.implicitHeaders | 
<implicitHeadersRegex> | 
String | 
- | 
Set the implicit headers regex. User Property: micronaut.openapi.implicitHeadersRegex | 
<importMapping> | 
Map<String,String> | 
- | 
Add the import mappings. User Property: micronaut.openapi.importMapping | 
<inlineSchemaNameMapping> | 
Map<String,String> | 
- | 
Add the inline schema name mappings. User Property: micronaut.openapi.inlineSchemaNameMapping | 
<inlineSchemaOption> | 
Map<String,String> | 
- | 
Add the inline schema options. User Property: micronaut.openapi.inlineSchemaOption | 
<jsonIncludeAlwaysForRequiredFields> | 
boolean | 
4.8.0 | 
If set to true, @JsonInclude annotation will be with value ALWAYS for required properties in POJO's. User Property: micronaut.openapi.jsonIncludeAlwaysForRequiredFields | 
<lang> | 
String | 
4.3.0 | 
Allows specifying the language of the generated code. Default: javaUser Property: micronaut.openapi.lang | 
<lombok> | 
boolean | 
4.2.2 | 
Determines if the server should use lombok. User Property: micronaut.openapi.server.lombok | 
<modelNameMapping> | 
Map<String,String> | 
- | 
Add the model name mappings. User Property: micronaut.openapi.modelNameMapping | 
<modelNamePrefix> | 
String | 
- | 
Set the model name prefix. User Property: micronaut.openapi.modelNamePrefix | 
<modelNameSuffix> | 
String | 
- | 
Set the model name suffix. User Property: micronaut.openapi.modelNameSuffix | 
<nameMapping> | 
Map<String,String> | 
- | 
Add the name mappings. User Property: micronaut.openapi.nameMapping | 
<openapiNormalizer> | 
Map<String,String> | 
- | 
Add the OpenAPI normalizer options. User Property: micronaut.openapi.openapiNormalizer | 
<parameterMappings> | 
List<ParameterMapping> | 
- | 
Define parameter mappings that allow using custom types for parameter binding. See ParameterMapping for details.User Property: micronaut.openapi.parameterMappings | 
<prependFormOrBodyParameters> | 
boolean | 
- | 
Add form or body parameters to the beginning of the parameter list. User Property: micronaut.openapi.prependFormOrBodyParameters | 
<removeOperationIdPrefixCount> | 
int | 
- | 
Count of delimiter for the prefix. Use -1 for last. Default: 1 Default: 1User Property: micronaut.openapi.removeOperationIdPrefixCount | 
<removeOperationIdPrefixDelimiter> | 
String | 
- | 
Character to use as a delimiter for the prefix. Default: '_' Default: _User Property: micronaut.openapi.removeOperationIdPrefixDelimiter | 
<requiredPropertiesInConstructor> | 
boolean | 
4.8.0 | 
Generate or not required properties constructor. Only for java generator. Default: trueUser Property: micronaut.openapi.requiredPropertiesInConstructor | 
<responseBodyMappings> | 
List<ResponseBodyMapping> | 
- | 
Define parameter mappings that allow using custom types for parameter binding. See ResponseBodyMapping for details.User Property: micronaut.openapi.responseBodyMappings | 
<schemaMapping> | 
Map<String,String> | 
- | 
Add the schema mappings. User Property: micronaut.openapi.schemaMapping | 
<skipOperationExample> | 
boolean | 
- | 
Skip examples defined in operations to avoid out of memory errors. Default: false User Property: micronaut.openapi.skipOperationExample | 
<skipSortingOperations> | 
boolean | 
- | 
Skip sorting operations. Default: false User Property: micronaut.openapi.skipSortingOperations | 
<sortModelPropertiesByRequiredFlag> | 
boolean | 
- | 
Sort model properties to place required parameters before optional parameters. Default: trueUser Property: micronaut.openapi.sortModelPropertiesByRequiredFlag | 
<sortParamsByRequiredFlag> | 
boolean | 
- | 
Sort method arguments to place required parameters before optional parameters. Default: true Default: trueUser Property: micronaut.openapi.sortParamsByRequiredFlag | 
<typeMapping> | 
Map<String,String> | 
- | 
Add the type mappings. User Property: micronaut.openapi.typeMapping | 
<useAuth> | 
boolean | 
- | 
Whether to generate authentication annotations for APIs. Default: falseUser Property: micronaut.openapi.server.use.auth | 
<useEnumCaseInsensitive> | 
boolean | 
- | 
If set to true, the generated enums check enum value with ignoring case. Default: falseUser Property: micronaut.openapi.useEnumCaseInsensitive | 
<useJakartaEe> | 
boolean | 
- | 
Flag to indicate whether to use the "jakarta" or "javax" package. Default: trueUser Property: micronaut.openapi.useJakartaEe | 
<useSealed> | 
boolean | 
4.8.0 | 
Whether to generate sealed model interfaces and classes. Only for java generator. User Property: micronaut.openapi.useSealed | 
Parameter Details
<additionalEnumTypeAnnotations>
Additional annotations for enum type (class level annotations).
- Type: 
java.util.List<java.lang.String> - Required: 
No - User Property: 
micronaut.openapi.additionalEnumTypeAnnotations 
<additionalModelTypeAnnotations>
Additional annotations for model type (class level annotations).
- Type: 
java.util.List<java.lang.String> - Required: 
No - User Property: 
micronaut.openapi.additionalModelTypeAnnotations 
<additionalOneOfTypeAnnotations>
Additional annotations for oneOf interfaces (class level annotations).
- Type: 
java.util.List<java.lang.String> - Required: 
No - User Property: 
micronaut.openapi.additionalOneOfTypeAnnotations 
<additionalProperties>
Additional generator properties.
- Type: 
java.util.Map<java.lang.String, java.lang.Object> - Required: 
No - User Property: 
micronaut.openapi.additionalProperties 
<allowUnicodeIdentifiers>
boolean, toggles whether Unicode identifiers are allowed in names or not, default is false.
- Type: 
boolean - Required: 
No - User Property: 
micronaut.openapi.allowUnicodeIdentifiers 
<alwaysUseGenerateHttpResponse>
If true, the generated operation return types will be wrapped in HttpResponse.
- Type: 
boolean - Required: 
Yes - User Property: 
micronaut.openapi.always.use.generate.http.response - Default: 
false 
<aotCompatible>
If set to true, the generated code should be made compatible with Micronaut AOT.
- Type: 
boolean - Since: 
4.2.2 - Required: 
No - User Property: 
micronaut.openapi.server.aot.compatible 
<apiNamePrefix>
Set the api name prefix.
- Type: 
java.lang.String - Required: 
No - User Property: 
micronaut.openapi.apiNamePrefix 
<apiNameSuffix>
Set the api name suffix.
- Type: 
java.lang.String - Required: 
No - User Property: 
micronaut.openapi.apiNameSuffix 
<apiPackageName>
The package name for the APIs (controller interfaces).
- Type: 
java.lang.String - Required: 
Yes - User Property: 
micronaut.openapi.api.package.name - Default: 
io.micronaut.openapi.api 
<controllerPackageName>
The package name of the controller if controller implementation files are generated.
- Type: 
java.lang.String - Required: 
Yes - User Property: 
micronaut.openapi.server.controller.package.name - Default: 
io.micronaut.openapi.controller.package.name 
<coroutines>
If set to true, generated code will be with suspend methods. Ony for kotlin generator.
- Type: 
boolean - Since: 
4.8.0 - Required: 
No - User Property: 
micronaut.openapi.coroutines 
<dateTimeFormat>
Configure the date-time format.
- Type: 
java.lang.String - Required: 
Yes - User Property: 
micronaut.openapi.date.time.format - Default: 
ZONED_DATETIME 
<definitionFile>
The OpenAPI specification file path relative to the project's root path.
- Type: 
java.io.File - Required: 
Yes - User Property: 
micronaut.openapi.definition - Default: 
io.micronaut.openapi.invoker 
<enabled>
The property that defines if this mojo should be used in configuration.
- Type: 
boolean - Required: 
No - User Property: 
micronaut.openapi.generate.server 
<ensureUniqueParams>
Whether to ensure parameter names are unique in an operation (rename parameters that are not).
- Type: 
boolean - Required: 
No - User Property: 
micronaut.openapi.ensureUniqueParams - Default: 
true 
<enumNameMapping>
Add the enum name mappings.
- Type: 
java.util.Map<java.lang.String, java.lang.String> - Required: 
No - User Property: 
micronaut.openapi.enumNameMapping 
<fluxForArrays>
Determines if the server should use flux for arrays.
- Type: 
boolean - Since: 
4.2.2 - Required: 
No - User Property: 
micronaut.openapi.server.flux.for.arrays 
<generateControllerAsAbstract>
If true, the generated controller interface will be without `@Controller` annotation.
- Type: 
boolean - Since: 
4.8.0 - Required: 
No - User Property: 
micronaut.openapi.generateControllerAsAbstract 
<generateHttpResponseWhereRequired>
Wrap the operations response in HttpResponse object where non-200 HTTP status codes or additional headers are defined.
- Type: 
boolean - Required: 
Yes - User Property: 
micronaut.openapi.generate.http.response.where.required - Default: 
true 
<generateSwaggerAnnotations>
If set to true, controller and client method will be generated with openAPI annotations.
- Type: 
boolean - Required: 
No - User Property: 
micronaut.openapi.generateSwaggerAnnotations - Default: 
false 
<generatedAnnotation>
If set to true, the `javax.annotation.Generated` annotation will be added to all generated classes.
- Type: 
boolean - Since: 
4.2.2 - Required: 
No - User Property: 
micronaut.openapi.server.generated.annotation - Default: 
true 
<implicitHeaders>
Set the implicit headers flag.
- Type: 
boolean - Required: 
No - User Property: 
micronaut.openapi.implicitHeaders - Default: 
false 
<implicitHeadersRegex>
Set the implicit headers regex.
- Type: 
java.lang.String - Required: 
No - User Property: 
micronaut.openapi.implicitHeadersRegex 
<importMapping>
Add the import mappings.
- Type: 
java.util.Map<java.lang.String, java.lang.String> - Required: 
No - User Property: 
micronaut.openapi.importMapping 
<inlineSchemaNameMapping>
Add the inline schema name mappings.
- Type: 
java.util.Map<java.lang.String, java.lang.String> - Required: 
No - User Property: 
micronaut.openapi.inlineSchemaNameMapping 
<inlineSchemaOption>
Add the inline schema options.
- Type: 
java.util.Map<java.lang.String, java.lang.String> - Required: 
No - User Property: 
micronaut.openapi.inlineSchemaOption 
<invokerPackageName>
The name of the package that can be used for various classes required for invocation.
- Type: 
java.lang.String - Required: 
Yes - User Property: 
micronaut.openapi.invoker.package.name - Default: 
io.micronaut.openapi.invoker 
<jsonIncludeAlwaysForRequiredFields>
If set to true, @JsonInclude annotation will be with value ALWAYS for required properties in POJO's.
- Type: 
boolean - Since: 
4.8.0 - Required: 
No - User Property: 
micronaut.openapi.jsonIncludeAlwaysForRequiredFields 
<ksp>
If set to true, generated code will be fully compatible with KSP, but not 100% with KAPT.
- Type: 
boolean - Required: 
Yes - User Property: 
micronaut.openapi.ksp - Default: 
false 
<lang>
Allows specifying the language of the generated code.
- Type: 
java.lang.String - Since: 
4.3.0 - Required: 
No - User Property: 
micronaut.openapi.lang - Default: 
java 
<lombok>
Determines if the server should use lombok.
- Type: 
boolean - Since: 
4.2.2 - Required: 
No - User Property: 
micronaut.openapi.server.lombok 
<modelNameMapping>
Add the model name mappings.
- Type: 
java.util.Map<java.lang.String, java.lang.String> - Required: 
No - User Property: 
micronaut.openapi.modelNameMapping 
<modelNamePrefix>
Set the model name prefix.
- Type: 
java.lang.String - Required: 
No - User Property: 
micronaut.openapi.modelNamePrefix 
<modelNameSuffix>
Set the model name suffix.
- Type: 
java.lang.String - Required: 
No - User Property: 
micronaut.openapi.modelNameSuffix 
<modelPackageName>
The package name for the model classes.
- Type: 
java.lang.String - Required: 
Yes - User Property: 
micronaut.openapi.model.package.name - Default: 
io.micronaut.openapi.model 
<nameMapping>
Add the name mappings.
- Type: 
java.util.Map<java.lang.String, java.lang.String> - Required: 
No - User Property: 
micronaut.openapi.nameMapping 
<openapiNormalizer>
Add the OpenAPI normalizer options.
- Type: 
java.util.Map<java.lang.String, java.lang.String> - Required: 
No - User Property: 
micronaut.openapi.openapiNormalizer 
<outputDirectory>
The output directory to which all the sources will be generated.
- Type: 
java.io.File - Required: 
Yes - Default: 
${project.build.directory}/generated-sources/openapi 
<outputKinds>
Comma-separated values of output kinds to generate. The values are defined by the 
io.micronaut.openapi.generator.MicronautCodeGeneratorEntryPoint.OutputKind enum.- Type: 
java.util.List<java.lang.String> - Required: 
Yes - User Property: 
micronaut.openapi.outputs - Default: 
apis,models,supporting_files 
<parameterMappings>
Define parameter mappings that allow using custom types for parameter binding. See 
ParameterMapping for details.- Type: 
java.util.List<io.micronaut.maven.openapi.ParameterMapping> - Required: 
No - User Property: 
micronaut.openapi.parameterMappings 
<prependFormOrBodyParameters>
Add form or body parameters to the beginning of the parameter list.
- Type: 
boolean - Required: 
No - User Property: 
micronaut.openapi.prependFormOrBodyParameters 
<removeOperationIdPrefixCount>
Count of delimiter for the prefix. Use -1 for last. Default: 1
- Type: 
int - Required: 
No - User Property: 
micronaut.openapi.removeOperationIdPrefixCount - Default: 
1 
<removeOperationIdPrefixDelimiter>
Character to use as a delimiter for the prefix. Default: '_'
- Type: 
java.lang.String - Required: 
No - User Property: 
micronaut.openapi.removeOperationIdPrefixDelimiter - Default: 
_ 
<requiredPropertiesInConstructor>
Generate or not required properties constructor. Only for java generator.
- Type: 
boolean - Since: 
4.8.0 - Required: 
No - User Property: 
micronaut.openapi.requiredPropertiesInConstructor - Default: 
true 
<responseBodyMappings>
Define parameter mappings that allow using custom types for parameter binding. See 
ResponseBodyMapping for details.- Type: 
java.util.List<io.micronaut.maven.openapi.ResponseBodyMapping> - Required: 
No - User Property: 
micronaut.openapi.responseBodyMappings 
<schemaMapping>
Add the schema mappings.
- Type: 
java.util.Map<java.lang.String, java.lang.String> - Required: 
No - User Property: 
micronaut.openapi.schemaMapping 
<serializationFramework>
Configure the serialization library.
- Type: 
java.lang.String - Required: 
Yes - User Property: 
micronaut.openapi.serialization.framework - Default: 
MICRONAUT_SERDE_JACKSON 
<skipOperationExample>
Skip examples defined in operations to avoid out of memory errors. Default: false
- Type: 
boolean - Required: 
No - User Property: 
micronaut.openapi.skipOperationExample 
<skipSortingOperations>
Skip sorting operations. Default: false
- Type: 
boolean - Required: 
No - User Property: 
micronaut.openapi.skipSortingOperations 
<sortModelPropertiesByRequiredFlag>
Sort model properties to place required parameters before optional parameters.
- Type: 
boolean - Required: 
No - User Property: 
micronaut.openapi.sortModelPropertiesByRequiredFlag - Default: 
true 
<sortParamsByRequiredFlag>
Sort method arguments to place required parameters before optional parameters. Default: true
- Type: 
boolean - Required: 
No - User Property: 
micronaut.openapi.sortParamsByRequiredFlag - Default: 
true 
<typeMapping>
Add the type mappings.
- Type: 
java.util.Map<java.lang.String, java.lang.String> - Required: 
No - User Property: 
micronaut.openapi.typeMapping 
<useAuth>
Whether to generate authentication annotations for APIs.
- Type: 
boolean - Required: 
No - User Property: 
micronaut.openapi.server.use.auth - Default: 
false 
<useBeanValidation>
Whether to generate validation annotations for models and APIs.
- Type: 
boolean - Required: 
Yes - User Property: 
micronaut.openapi.use.bean.validation - Default: 
true 
<useEnumCaseInsensitive>
If set to true, the generated enums check enum value with ignoring case.
- Type: 
boolean - Required: 
No - User Property: 
micronaut.openapi.useEnumCaseInsensitive - Default: 
false 
<useJakartaEe>
Flag to indicate whether to use the "jakarta" or "javax" package.
- Type: 
boolean - Required: 
No - User Property: 
micronaut.openapi.useJakartaEe - Default: 
true 
<useOneOfInterfaces>
Flag to indicate whether to use the utils.OneOfImplementorAdditionalData related logic.
- Type: 
boolean - Required: 
Yes - User Property: 
micronaut.openapi.use.one.of.interfaces - Default: 
true 
<useOptional>
Whether to use 
java.util.Optional for non-required model properties and API parameters.- Type: 
boolean - Required: 
Yes - User Property: 
micronaut.openapi.use.optional - Default: 
false 
<useReactive>
Whether to use reactor types for operation responses.
- Type: 
boolean - Required: 
Yes - User Property: 
micronaut.openapi.use.reactive - Default: 
true 
<useSealed>
Whether to generate sealed model interfaces and classes. Only for java generator.
- Type: 
boolean - Since: 
4.8.0 - Required: 
No - User Property: 
micronaut.openapi.useSealed