Fork me on GitHub

mn:generate-openapi-generic

Full name:

io.micronaut.maven:micronaut-maven-plugin:4.7.1:generate-openapi-generic

Description:

A generic OpenAPI mojo that will be used for configuring custom Micronaut OpenAPI generator extensions.

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: false
User Property: micronaut.openapi.always.use.generate.http.response
<apiPackageName> String - The package name for the APIs (controller interfaces).
Default: io.micronaut.openapi.api
User Property: micronaut.openapi.api.package.name
<dateTimeFormat> String - Configure the date-time format.
Default: ZONED_DATETIME
User Property: micronaut.openapi.date.time.format
<definitionFile> File - The OpenAPI specification file path relative to the project's root path.
Default: io.micronaut.openapi.invoker
User 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: false
User 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.invoker
User 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: false
User Property: micronaut.openapi.ksp
<modelPackageName> String - The package name for the model classes.
Default: io.micronaut.openapi.model
User 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_files
User Property: micronaut.openapi.outputs
<serializationFramework> String - Configure the serialization library.
Default: MICRONAUT_SERDE_JACKSON
User Property: micronaut.openapi.serialization.framework
<useBeanValidation> boolean - Whether to generate validation annotations for models and APIs.
Default: true
User Property: micronaut.openapi.use.bean.validation
<useOneOfInterfaces> boolean - Flag to indicate whether to use the utils.OneOfImplementorAdditionalData related logic.
Default: true
User Property: micronaut.openapi.use.one.of.interfaces
<useOptional> boolean - Whether to use java.util.Optional for non-required model properties and API parameters.
Default: false
User Property: micronaut.openapi.use.optional
<useReactive> boolean - Whether to use reactor types for operation responses.
Default: true
User 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
<apiNamePrefix> String - Set the api name prefix.
User Property: micronaut.openapi.apiNamePrefix
<apiNameSuffix> String - Set the api name suffix.
User Property: micronaut.openapi.apiNameSuffix
<ensureUniqueParams> boolean - Whether to ensure parameter names are unique in an operation (rename parameters that are not).
Default: true
User Property: micronaut.openapi.ensureUniqueParams
<enumNameMapping> Map<String,String> - Add the enum name mappings.
User Property: micronaut.openapi.enumNameMapping
<generateSwaggerAnnotations> boolean - If set to true, controller and client method will be generated with openAPI annotations.
Default: false
User Property: micronaut.openapi.generateSwaggerAnnotations
<generatorClassName> String - The classname of the generator to be used for code generation.

The generator must property overwrite the AbstractMicronautJavaCodegen#optionsBuilder() method and the builder should have setters or withers for the properties to be used in maven configuration.


User Property: micronaut.openapi.generator.builder.classname
<implicitHeaders> boolean - Set the implicit headers flag.
Default: false
User 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
<lang> String 4.3.0 Allows specifying the language of the generated code.
Default: java
User Property: micronaut.openapi.lang
<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
<properties> Map<String,String> - The configuration properties that will be passed on to the custom generator options builder.

Any configuration parameters with key micronaut.openapi.generator.properties.[PROPERTY_NAME] will be passed on to the generator options builder. String, integer and boolean value types are supported for additional properties.


User Property: micronaut.openapi.generator.properties
<removeOperationIdPrefixCount> int - Count of delimiter for the prefix. Use -1 for last. Default: 1
Default: 1
User Property: micronaut.openapi.removeOperationIdPrefixCount
<removeOperationIdPrefixDelimiter> String - Character to use as a delimiter for the prefix. Default: '_'
Default: _
User Property: micronaut.openapi.removeOperationIdPrefixDelimiter
<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: true
User Property: micronaut.openapi.sortModelPropertiesByRequiredFlag
<sortParamsByRequiredFlag> boolean - Sort method arguments to place required parameters before optional parameters. Default: true
Default: true
User Property: micronaut.openapi.sortParamsByRequiredFlag
<typeMapping> Map<String,String> - Add the type mappings.
User Property: micronaut.openapi.typeMapping
<useEnumCaseInsensitive> boolean - If set to true, the generated enums check enum value with ignoring case.
Default: false
User Property: micronaut.openapi.useEnumCaseInsensitive
<useJakartaEe> boolean - Flag to indicate whether to use the "jakarta" or "javax" package.
Default: true
User Property: micronaut.openapi.useJakartaEe

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

<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

<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

<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

<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: false

<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

<generatorClassName>

The classname of the generator to be used for code generation.

The generator must property overwrite the AbstractMicronautJavaCodegen#optionsBuilder() method and the builder should have setters or withers for the properties to be used in maven configuration.

  • Type: java.lang.String
  • Required: No
  • User Property: micronaut.openapi.generator.builder.classname

<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

<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

<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

<properties>

The configuration properties that will be passed on to the custom generator options builder.

Any configuration parameters with key micronaut.openapi.generator.properties.[PROPERTY_NAME] will be passed on to the generator options builder. String, integer and boolean value types are supported for additional properties.

  • Type: java.util.Map<java.lang.String, java.lang.String>
  • Required: No
  • User Property: micronaut.openapi.generator.properties

<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: _

<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

<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