Interface MicronautCodeGeneratorOptionsBuilder


public interface MicronautCodeGeneratorOptionsBuilder
Builder for generic options that the Micronaut code generator supports.
  • Method Details

    • withLang

      Sets the generator language.
      Parameters:
      lang - generator language
      Returns:
      this builder
    • withApiPackage

      MicronautCodeGeneratorOptionsBuilder withApiPackage(String apiPackage)
      Sets the package of the generated API classes.
      Parameters:
      apiPackage - the package name
      Returns:
      this builder
    • withInvokerPackage

      MicronautCodeGeneratorOptionsBuilder withInvokerPackage(String invokerPackage)
      Sets the package of the generated invoker classes.
      Parameters:
      invokerPackage - the package name
      Returns:
      this builder
    • withModelPackage

      MicronautCodeGeneratorOptionsBuilder withModelPackage(String modelPackage)
      Sets the package of the generated model classes.
      Parameters:
      modelPackage - the package name
      Returns:
      this builder
    • withArtifactId

      MicronautCodeGeneratorOptionsBuilder withArtifactId(String artifactId)
      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 a ParameterMapping objects
      Returns:
      this builder
    • withResponseBodyMappings

      MicronautCodeGeneratorOptionsBuilder withResponseBodyMappings(List<ResponseBodyMapping> responseBodyMappings)
      Add the response body mappings.
      Parameters:
      responseBodyMappings - the response body mappings specified by a ResponseBodyMapping objects
      Returns:
      this builder
    • withSchemaMapping

      MicronautCodeGeneratorOptionsBuilder withSchemaMapping(Map<String,String> schemaMapping)
      Add the schema mappings.
      Parameters:
      schemaMapping - the schema mappings
      Returns:
      this builder
    • withImportMapping

      MicronautCodeGeneratorOptionsBuilder withImportMapping(Map<String,String> importMapping)
      Add the import mappings.
      Parameters:
      importMapping - the import mappings
      Returns:
      this builder
    • withNameMapping

      MicronautCodeGeneratorOptionsBuilder withNameMapping(Map<String,String> nameMapping)
      Add the name mappings.
      Parameters:
      nameMapping - the name mappings
      Returns:
      this builder
    • withTypeMapping

      MicronautCodeGeneratorOptionsBuilder withTypeMapping(Map<String,String> typeMapping)
      Add the type mappings.
      Parameters:
      typeMapping - the type mappings
      Returns:
      this builder
    • withEnumNameMapping

      MicronautCodeGeneratorOptionsBuilder withEnumNameMapping(Map<String,String> enumNameMapping)
      Add the enum name mappings.
      Parameters:
      enumNameMapping - the enum name mappings
      Returns:
      this builder
    • withModelNameMapping

      MicronautCodeGeneratorOptionsBuilder withModelNameMapping(Map<String,String> modelNameMapping)
      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

      MicronautCodeGeneratorOptionsBuilder withInlineSchemaOption(Map<String,String> inlineSchemaOption)
      Add the inline schema options.
      Parameters:
      inlineSchemaOption - the inline schema options
      Returns:
      this builder
    • withOpenapiNormalizer

      MicronautCodeGeneratorOptionsBuilder withOpenapiNormalizer(Map<String,String> openapiNormalizer)
      Add the OpenAPI normalizer options.
      Parameters:
      openapiNormalizer - the OpenAPI normalizer options
      Returns:
      this builder
    • withApiNamePrefix

      MicronautCodeGeneratorOptionsBuilder withApiNamePrefix(String apiNamePrefix)
      Set the api name prefix.
      Parameters:
      apiNamePrefix - the api name prefix
      Returns:
      this builder
    • withApiNameSuffix

      MicronautCodeGeneratorOptionsBuilder withApiNameSuffix(String apiNameSuffix)
      Set the api name suffix.
      Parameters:
      apiNameSuffix - the api name suffix
      Returns:
      this builder
    • withModelNamePrefix

      MicronautCodeGeneratorOptionsBuilder withModelNamePrefix(String modelNamePrefix)
      Set the model name prefix.
      Parameters:
      modelNamePrefix - the model name prefix
      Returns:
      this builder
    • withModelNameSuffix

      MicronautCodeGeneratorOptionsBuilder withModelNameSuffix(String modelNameSuffix)
      Set the model name suffix.
      Parameters:
      modelNameSuffix - the model name suffix
      Returns:
      this builder
    • withImplicitHeaders

      MicronautCodeGeneratorOptionsBuilder withImplicitHeaders(boolean implicitHeaders)
      Set the implicit headers flag.
      Parameters:
      implicitHeaders - implicit headers
      Returns:
      this builder
    • withImplicitHeadersRegex

      MicronautCodeGeneratorOptionsBuilder withImplicitHeadersRegex(String implicitHeadersRegex)
      Set the implicit headers regex.
      Parameters:
      implicitHeadersRegex - implicit headers regex
      Returns:
      this builder
    • withReactive

      MicronautCodeGeneratorOptionsBuilder withReactive(boolean reactive)
      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

      MicronautCodeGeneratorOptionsBuilder withBeanValidation(boolean beanValidation)
      If set to true, the generated code will use bean validation.
      Parameters:
      beanValidation - the bean validation flag
      Returns:
      this builder
    • withUseEnumCaseInsensitive

      MicronautCodeGeneratorOptionsBuilder withUseEnumCaseInsensitive(boolean useEnumCaseInsensitive)
      If set to true, the generated enums check enum value with ignoring case.
      Parameters:
      useEnumCaseInsensitive - the useEnumCaseInsensitive flag
      Returns:
      this builder
    • withOptional

      MicronautCodeGeneratorOptionsBuilder withOptional(boolean optional)
      If set to true, the generated code will make use of Optional.
      Parameters:
      optional - the optional flag
      Returns:
      this builder
    • withTestFramework

      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

      Configure the date-time format.
      Parameters:
      format - the date-time format.
      Returns:
      this builder
    • withUseOneOfInterfaces

      MicronautCodeGeneratorOptionsBuilder withUseOneOfInterfaces(boolean useOneOfInterfaces)
      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
    • withAdditionalEnumTypeAnnotations

      MicronautCodeGeneratorOptionsBuilder withAdditionalEnumTypeAnnotations(List<String> additionalEnumTypeAnnotations)
      Additional annotations for enum type (class level annotations).
      Parameters:
      additionalEnumTypeAnnotations - additional annotations for enum type (class level annotations).
      Returns:
      this builder
    • withAdditionalModelTypeAnnotations

      MicronautCodeGeneratorOptionsBuilder withAdditionalModelTypeAnnotations(List<String> additionalModelTypeAnnotations)
      Additional annotations for model type (class level annotations).
      Parameters:
      additionalModelTypeAnnotations - additional annotations for model type (class level annotations).
      Returns:
      this builder
    • withAdditionalOneOfTypeAnnotations

      MicronautCodeGeneratorOptionsBuilder withAdditionalOneOfTypeAnnotations(List<String> additionalOneOfTypeAnnotations)
      Additional annotations for oneOf interfaces (class level annotations).
      Parameters:
      additionalOneOfTypeAnnotations - additional annotations for oneOf interfaces (class level annotations).
      Returns:
      this builder
    • withAdditionalProperties

      MicronautCodeGeneratorOptionsBuilder withAdditionalProperties(Map<String,Object> additionalProperties)
      Additional generator properties.
      Parameters:
      additionalProperties - additional generator properties.
      Returns:
      this builder
    • withUseJakartaEe

      MicronautCodeGeneratorOptionsBuilder withUseJakartaEe(boolean useJakartaEe)
      Flag to indicate whether to use the "jakarta" or "javax" package.
      Parameters:
      useJakartaEe - if true, then use the "jakarta" package, otherwise - "javax".
      Returns:
      this builder
    • withSortParamsByRequiredFlag

      MicronautCodeGeneratorOptionsBuilder withSortParamsByRequiredFlag(boolean sortParamsByRequiredFlag)
      Sort method arguments to place required parameters before optional parameters. Default: true
      Parameters:
      sortParamsByRequiredFlag - Sort method arguments to place required parameters before optional parameters
      Returns:
      this builder
    • withSkipOperationExample

      MicronautCodeGeneratorOptionsBuilder withSkipOperationExample(boolean skipOperationExample)
      Skip examples defined in operations to avoid out of memory errors. Default: false
      Parameters:
      skipOperationExample - Skip examples defined in operations to avoid out of memory errors.
      Returns:
      this builder
    • withSkipSortingOperations

      MicronautCodeGeneratorOptionsBuilder withSkipSortingOperations(boolean skipSortingOperations)
      Skip sorting operations. Default: false
      Parameters:
      skipSortingOperations - Skip sorting operations
      Returns:
      this builder
    • withRemoveOperationIdPrefixDelimiter

      MicronautCodeGeneratorOptionsBuilder withRemoveOperationIdPrefixDelimiter(String removeOperationIdPrefixDelimiter)
      Character to use as a delimiter for the prefix. Default: '_'
      Parameters:
      removeOperationIdPrefixDelimiter - Character to use as a delimiter for the prefix. Default: '_'
      Returns:
      this builder
    • withRemoveOperationIdPrefixCount

      MicronautCodeGeneratorOptionsBuilder withRemoveOperationIdPrefixCount(int removeOperationIdPrefixCount)
      Count of delimiter for the prefix. Use -1 for last Default: 1
      Parameters:
      removeOperationIdPrefixCount - Count of delimiter for the prefix. Use -1 for last Default: 1
      Returns:
      this builder
    • withSortModelPropertiesByRequiredFlag

      MicronautCodeGeneratorOptionsBuilder withSortModelPropertiesByRequiredFlag(boolean sortModelPropertiesByRequiredFlag)
      Sort model properties to place required parameters before optional parameters.
      Parameters:
      sortModelPropertiesByRequiredFlag - Sort model properties to place required parameters before optional parameters.
      Returns:
      this builder
    • withEnsureUniqueParams

      MicronautCodeGeneratorOptionsBuilder withEnsureUniqueParams(boolean ensureUniqueParams)
      Whether to ensure parameter names are unique in an operation (rename parameters that are not).
      Parameters:
      ensureUniqueParams - Whether to ensure parameter names are unique in an operation (rename parameters that are not).
      Returns:
      this builder
    • withAllowUnicodeIdentifiers

      MicronautCodeGeneratorOptionsBuilder withAllowUnicodeIdentifiers(boolean allowUnicodeIdentifiers)
      boolean, toggles whether Unicode identifiers are allowed in names or not, default is false.
      Parameters:
      allowUnicodeIdentifiers - toggles whether Unicode identifiers are allowed in names or not, default is false
      Returns:
      this builder
    • withPrependFormOrBodyParameters

      MicronautCodeGeneratorOptionsBuilder withPrependFormOrBodyParameters(boolean prependFormOrBodyParameters)
      Add form or body parameters to the beginning of the parameter list.
      Parameters:
      prependFormOrBodyParameters - Add form or body parameters to the beginning of the parameter list.
      Returns:
      this builder