Package io.micronaut.openapi.generator
Interface MicronautCodeGeneratorOptionsBuilder
public interface MicronautCodeGeneratorOptionsBuilder
Builder for generic options that the Micronaut code generator supports.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
The possible date-time formatting configurations.static enum
The possible languages for generator. -
Method Summary
Modifier and TypeMethodDescriptionwithApiNamePrefix
(String apiNamePrefix) Set the api name prefix.withApiNameSuffix
(String apiNameSuffix) Set the api name suffix.withApiPackage
(String apiPackage) Sets the package of the generated API classes.withArtifactId
(String artifactId) Sets the artifact id of the project.withBeanValidation
(boolean beanValidation) If set to true, the generated code will use bean validation.Configure the date-time format.withEnumNameMapping
(Map<String, String> enumNameMapping) Add the enum name mappings.withGenerateHttpResponseAlways
(boolean generateHttpResponseAlways) If true, the generated operation return types will be wrapped in HttpResponse.withGenerateHttpResponseWhereRequired
(boolean generateHttpResponseWhereRequired) Wrap the operations response in HttpResponse object where non-200 HTTP status codes or additional headers are defined.withGenerateSwaggerAnnotations
(boolean generateSwaggerAnnotations) If set to true, controller and client method will be generated with openAPI annotations.withImplicitHeaders
(boolean implicitHeaders) Set the implicit headers flag.withImplicitHeadersRegex
(String implicitHeadersRegex) Set the implicit headers regex.withImportMapping
(Map<String, String> importMapping) Add the import mappings.withInlineSchemaNameMapping
(Map<String, String> inlineSchemaNameMapping) Add the inline schema name mappings.withInlineSchemaOption
(Map<String, String> inlineSchemaOption) Add the inline schema options.withInvokerPackage
(String invokerPackage) Sets the package of the generated invoker classes.Sets the generator language.withModelNameMapping
(Map<String, String> modelNameMapping) Add the model name mappings.withModelNamePrefix
(String modelNamePrefix) Set the model name prefix.withModelNameSuffix
(String modelNameSuffix) Set the model name suffix.withModelPackage
(String modelPackage) Sets the package of the generated model classes.withNameMapping
(Map<String, String> nameMapping) Add the name mappings.withOpenapiNormalizer
(Map<String, String> openapiNormalizer) Add the OpenAPI normalizer options.withOptional
(boolean optional) If set to true, the generated code will make use ofOptional
.withParameterMappings
(List<ParameterMapping> parameterMappings) Add the parameter mappings.withReactive
(boolean reactive) If set to true, the generator will use reactive types.withResponseBodyMappings
(List<ResponseBodyMapping> responseBodyMappings) Add the response body mappings.withSchemaMapping
(Map<String, String> schemaMapping) Add the schema mappings.Configure the serialization library.withTestFramework
(MicronautCodeGeneratorEntryPoint.TestFramework testFramework) Configures the test framework to use for generated tests.withTypeMapping
(Map<String, String> typeMapping) Add the type mappings.withUseOneOfInterfaces
(boolean useOneOfInterfaces) Flag to indicate whether to use the utils.OneOfImplementorAdditionalData related logic.
-
Method Details
-
withLang
MicronautCodeGeneratorOptionsBuilder withLang(MicronautCodeGeneratorOptionsBuilder.GeneratorLanguage lang) Sets the generator language.- Parameters:
lang
- generator language- Returns:
- this builder
-
withApiPackage
Sets the package of the generated API classes.- Parameters:
apiPackage
- the package name- Returns:
- this builder
-
withInvokerPackage
Sets the package of the generated invoker classes.- Parameters:
invokerPackage
- the package name- Returns:
- this builder
-
withModelPackage
Sets the package of the generated model classes.- Parameters:
modelPackage
- the package name- Returns:
- this builder
-
withArtifactId
Sets the artifact id of the project.- Parameters:
artifactId
- the artifact id- Returns:
- this builder
-
withParameterMappings
MicronautCodeGeneratorOptionsBuilder withParameterMappings(List<ParameterMapping> parameterMappings) Add the parameter mappings.- Parameters:
parameterMappings
- the parameter mappings specified by aParameterMapping
objects- Returns:
- this builder
-
withResponseBodyMappings
MicronautCodeGeneratorOptionsBuilder withResponseBodyMappings(List<ResponseBodyMapping> responseBodyMappings) Add the response body mappings.- Parameters:
responseBodyMappings
- the response body mappings specified by aResponseBodyMapping
objects- Returns:
- this builder
-
withSchemaMapping
Add the schema mappings.- Parameters:
schemaMapping
- the schema mappings- Returns:
- this builder
-
withImportMapping
Add the import mappings.- Parameters:
importMapping
- the import mappings- Returns:
- this builder
-
withNameMapping
Add the name mappings.- Parameters:
nameMapping
- the name mappings- Returns:
- this builder
-
withTypeMapping
Add the type mappings.- Parameters:
typeMapping
- the type mappings- Returns:
- this builder
-
withEnumNameMapping
Add the enum name mappings.- Parameters:
enumNameMapping
- the enum name mappings- Returns:
- this builder
-
withModelNameMapping
Add the model name mappings.- Parameters:
modelNameMapping
- the model name mappings- Returns:
- this builder
-
withInlineSchemaNameMapping
MicronautCodeGeneratorOptionsBuilder withInlineSchemaNameMapping(Map<String, String> inlineSchemaNameMapping) Add the inline schema name mappings.- Parameters:
inlineSchemaNameMapping
- the inline schema name mappings- Returns:
- this builder
-
withInlineSchemaOption
Add the inline schema options.- Parameters:
inlineSchemaOption
- the inline schema options- Returns:
- this builder
-
withOpenapiNormalizer
Add the OpenAPI normalizer options.- Parameters:
openapiNormalizer
- the OpenAPI normalizer options- Returns:
- this builder
-
withApiNamePrefix
Set the api name prefix.- Parameters:
apiNamePrefix
- the api name prefix- Returns:
- this builder
-
withApiNameSuffix
Set the api name suffix.- Parameters:
apiNameSuffix
- the api name suffix- Returns:
- this builder
-
withModelNamePrefix
Set the model name prefix.- Parameters:
modelNamePrefix
- the model name prefix- Returns:
- this builder
-
withModelNameSuffix
Set the model name suffix.- Parameters:
modelNameSuffix
- the model name suffix- Returns:
- this builder
-
withImplicitHeaders
Set the implicit headers flag.- Parameters:
implicitHeaders
- implicit headers- Returns:
- this builder
-
withImplicitHeadersRegex
Set the implicit headers regex.- Parameters:
implicitHeadersRegex
- implicit headers regex- Returns:
- this builder
-
withReactive
If set to true, the generator will use reactive types.- Parameters:
reactive
- the reactive flag- Returns:
- this builder
-
withGenerateHttpResponseAlways
MicronautCodeGeneratorOptionsBuilder withGenerateHttpResponseAlways(boolean generateHttpResponseAlways) If true, the generated operation return types will be wrapped in HttpResponse.- Parameters:
generateHttpResponseAlways
- the wrapping flag- Returns:
- this builder
-
withGenerateHttpResponseWhereRequired
MicronautCodeGeneratorOptionsBuilder withGenerateHttpResponseWhereRequired(boolean generateHttpResponseWhereRequired) Wrap the operations response in HttpResponse object where non-200 HTTP status codes or additional headers are defined.- Parameters:
generateHttpResponseWhereRequired
- the wrapping flag- Returns:
- this builder
-
withGenerateSwaggerAnnotations
MicronautCodeGeneratorOptionsBuilder withGenerateSwaggerAnnotations(boolean generateSwaggerAnnotations) If set to true, controller and client method will be generated with openAPI annotations.- Parameters:
generateSwaggerAnnotations
- the generate swagger annotations flag- Returns:
- this builder
-
withBeanValidation
If set to true, the generated code will use bean validation.- Parameters:
beanValidation
- the bean validation flag- Returns:
- this builder
-
withOptional
If set to true, the generated code will make use ofOptional
.- Parameters:
optional
- the optional flag- Returns:
- this builder
-
withTestFramework
MicronautCodeGeneratorOptionsBuilder withTestFramework(MicronautCodeGeneratorEntryPoint.TestFramework testFramework) Configures the test framework to use for generated tests.- Parameters:
testFramework
- the test framework- Returns:
- this builder
-
withSerializationLibrary
Configure the serialization library.- Parameters:
library
- the serialization library.- Returns:
- this builder
-
withDateTimeFormat
MicronautCodeGeneratorOptionsBuilder withDateTimeFormat(MicronautCodeGeneratorOptionsBuilder.DateTimeFormat format) Configure the date-time format.- Parameters:
format
- the date-time format.- Returns:
- this builder
-
withUseOneOfInterfaces
Flag to indicate whether to use the utils.OneOfImplementorAdditionalData related logic.- Parameters:
useOneOfInterfaces
- if true, then use the utils.OneOfImplementorAdditionalData related logic.- Returns:
- this builder
-