Skip to main content

Documentation for the kotlin-spring Generator

METADATA

PropertyValueNotes
generator namekotlin-springpass this to the generate command after -g
generator stabilitySTABLE
generator typeSERVER
generator languageKotlin
generator default templating enginemustache
helpTxtGenerates a Kotlin Spring application.

CONFIG OPTIONS

These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to configuration docs for more details.

OptionDescriptionValuesDefault
additionalModelTypeAnnotationsAdditional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)null
annotationLibrarySelect the complementary documentation annotation library.
none
Do not annotate Model and Api with complementary annotations.
swagger1
Annotate Model and Api using the Swagger Annotations 1.x library.
swagger2
Annotate Model and Api using the Swagger Annotations 2.x library.
swagger2
apiPackageapi package for generated codeorg.openapitools.api
apiSuffixsuffix for api classesApi
artifactIdGenerated artifact id (name of jar).openapi-spring
artifactVersionGenerated artifact's package version.1.0.0
basePackagebase package (invokerPackage) for generated codeorg.openapitools
beanQualifiersWhether to add fully-qualifier class names as bean qualifiers in @Component and @RestController annotations. May be used to prevent bean names clash if multiple generated libraries (contexts) added to single project.false
configPackageconfiguration package for generated codeorg.openapitools.configuration
delegatePatternWhether to generate the server files using the delegate patternfalse
documentationProviderSelect the OpenAPI documentation provider.
none
Do not publish an OpenAPI specification.
source
Publish the original input OpenAPI specification.
springfox
Generate an OpenAPI 2 (fka Swagger RESTful API Documentation Specification) specification using SpringFox 2.x. Deprecated (for removal); use springdoc instead.
springdoc
Generate an OpenAPI 3 specification using SpringDoc.
springdoc
enumPropertyNamingNaming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'original
exceptionHandlergenerate default global exception handlers (not compatible with reactive. enabling reactive will disable exceptionHandler )true
gradleBuildFilegenerate a gradle build file using the Kotlin DSLtrue
groupIdGenerated artifact package's organization (i.e. maven groupId).org.openapitools
interfaceOnlyWhether to generate only API interface stubs without the server files.false
librarylibrary template (sub-template)
spring-boot
Spring-boot Server application.
spring-cloud
Spring-Cloud-Feign client with Spring-Boot auto-configured settings.
spring-boot
modelMutableCreate mutable modelsfalse
modelPackagemodel package for generated codeorg.openapitools.model
packageNameGenerated artifact package name.org.openapitools
parcelizeModelstoggle "@Parcelize" for generated modelsnull
reactiveuse coroutines for reactive behaviorfalse
requestMappingModeWhere to generate the class level @RequestMapping annotation.
api_interface
Generate the @RequestMapping annotation on the generated Api Interface.
controller
Generate the @RequestMapping annotation on the generated Api Controller Implementation.
none
Do not add a class level @RequestMapping annotation.
controller
serializableModelboolean - toggle "implements Serializable" for generated modelsnull
serverPortconfiguration the port in which the sever is to run on8080
serviceImplementationgenerate stub service implementations that extends service interfaces. If this is set to true service interfaces will also be generatedfalse
serviceInterfacegenerate service interfaces to go alongside controllers. In most cases this option would be used to update an existing project, so not to override implementations. Useful to help facilitate the generation gap patternfalse
skipDefaultInterfaceWhether to skip generation of default implementations for interfaces (Api interfaces or Delegate interfaces depending on the delegatePattern option)false
sortModelPropertiesByRequiredFlagSort model properties to place required parameters before optional parameters.null
sortParamsByRequiredFlagSort method arguments to place required parameters before optional parameters.null
sourceFoldersource folder for generated codesrc/main/kotlin
titleserver title name or client service nameOpenAPI Kotlin Spring
useBeanValidationUse BeanValidation API annotations to validate data typestrue
useFeignClientUrlWhether to generate Feign client with url parameter.true
useSpringBoot3Generate code and provide dependencies for use with Spring Boot 3.x. (Use jakarta instead of javax in imports). Enabling this option will also enable useJakartaEe.false
useSwaggerUIOpen the OpenApi specification in swagger-ui. Will also import and configure needed dependenciestrue
useTagsWhether to use tags for creating interface and controller class namesfalse

SUPPORTED VENDOR EXTENSIONS

Extension nameDescriptionApplicable forDefault value
x-acceptsSpecify custom value for 'Accept' header for operationOPERATIONnull
x-class-extra-annotationList of custom annotations to be added to modelMODELnull
x-content-typeSpecify custom value for 'Content-Type' header for operationOPERATIONnull
x-discriminator-valueUsed with model inheritance to specify value for discriminator that identifies current modelMODEL
x-field-extra-annotationList of custom annotations to be added to propertyFIELD, OPERATION_PARAMETERnull
x-pattern-messageAdd this property whenever you need to customize the invalidation error message for the regex pattern of a variableFIELD, OPERATION_PARAMETERnull

IMPORT MAPPING

Type/AliasImports
BigDecimaljava.math.BigDecimal
Datejava.time.LocalDate
DateTimejava.time.OffsetDateTime
Filejava.io.File
LocalDatejava.time.LocalDate
LocalDateTimejava.time.LocalDateTime
LocalTimejava.time.LocalTime
Timestampjava.sql.Timestamp
URIjava.net.URI
UUIDjava.util.UUID

INSTANTIATION TYPES

Type/AliasInstantiated By
arraykotlin.collections.ArrayList
listkotlin.collections.ArrayList
mapkotlin.collections.HashMap

LANGUAGE PRIMITIVES

  • kotlin.Array
  • kotlin.Boolean
  • kotlin.Byte
  • kotlin.ByteArray
  • kotlin.Char
  • kotlin.Double
  • kotlin.Float
  • kotlin.Int
  • kotlin.Long
  • kotlin.Short
  • kotlin.String
  • kotlin.collections.List
  • kotlin.collections.Map
  • kotlin.collections.MutableList
  • kotlin.collections.MutableMap
  • kotlin.collections.MutableSet
  • kotlin.collections.Set

RESERVED WORDS

  • ApiClient
  • ApiException
  • ApiResponse
  • abstract
  • actual
  • annotation
  • as
  • break
  • class
  • companion
  • const
  • constructor
  • continue
  • contract
  • crossinline
  • data
  • delegate
  • do
  • dynamic
  • else
  • enum
  • expect
  • external
  • false
  • field
  • final
  • finally
  • for
  • fun
  • if
  • import
  • in
  • infix
  • init
  • inline
  • inner
  • interface
  • internal
  • is
  • it
  • lateinit
  • noinline
  • null
  • object
  • open
  • operator
  • out
  • override
  • package
  • param
  • private
  • property
  • protected
  • public
  • receiver
  • reified
  • return
  • sealed
  • setparam
  • super
  • suspend
  • tailrec
  • this
  • throw
  • true
  • try
  • typealias
  • typeof
  • val
  • value
  • var
  • vararg
  • when
  • where
  • while

FEATURE SET

Client Modification Feature

NameSupportedDefined By
BasePathToolingExtension
AuthorizationsToolingExtension
UserAgentToolingExtension
MockServerToolingExtension

Data Type Feature

NameSupportedDefined By
CustomOAS2,OAS3
Int32OAS2,OAS3
Int64OAS2,OAS3
FloatOAS2,OAS3
DoubleOAS2,OAS3
DecimalToolingExtension
StringOAS2,OAS3
ByteOAS2,OAS3
BinaryOAS2,OAS3
BooleanOAS2,OAS3
DateOAS2,OAS3
DateTimeOAS2,OAS3
PasswordOAS2,OAS3
FileOAS2
Uuid
ArrayOAS2,OAS3
NullOAS3
AnyTypeOAS2,OAS3
ObjectOAS2,OAS3
MapsToolingExtension
CollectionFormatOAS2
CollectionFormatMultiOAS2
EnumOAS2,OAS3
ArrayOfEnumToolingExtension
ArrayOfModelToolingExtension
ArrayOfCollectionOfPrimitivesToolingExtension
ArrayOfCollectionOfModelToolingExtension
ArrayOfCollectionOfEnumToolingExtension
MapOfEnumToolingExtension
MapOfModelToolingExtension
MapOfCollectionOfPrimitivesToolingExtension
MapOfCollectionOfModelToolingExtension
MapOfCollectionOfEnumToolingExtension

Documentation Feature

NameSupportedDefined By
ReadmeToolingExtension
ModelToolingExtension
ApiToolingExtension

Global Feature

NameSupportedDefined By
HostOAS2,OAS3
BasePathOAS2,OAS3
InfoOAS2,OAS3
SchemesOAS2,OAS3
PartialSchemesOAS2,OAS3
ConsumesOAS2
ProducesOAS2
ExternalDocumentationOAS2,OAS3
ExamplesOAS2,OAS3
XMLStructureDefinitionsOAS2,OAS3
MultiServerOAS3
ParameterizedServerOAS3
ParameterStylingOAS3
CallbacksOAS3
LinkObjectsOAS3

Parameter Feature

NameSupportedDefined By
PathOAS2,OAS3
QueryOAS2,OAS3
HeaderOAS2,OAS3
BodyOAS2
FormUnencodedOAS2
FormMultipartOAS2
CookieOAS3

Schema Support Feature

NameSupportedDefined By
SimpleOAS2,OAS3
CompositeOAS2,OAS3
PolymorphismOAS2,OAS3
UnionOAS3
allOfOAS2,OAS3
anyOfOAS3
oneOfOAS3
notOAS3

Security Feature

NameSupportedDefined By
BasicAuthOAS2,OAS3
ApiKeyOAS2,OAS3
OpenIDConnectOAS3
BearerTokenOAS3
OAuth2_ImplicitOAS2,OAS3
OAuth2_PasswordOAS2,OAS3
OAuth2_ClientCredentialsOAS2,OAS3
OAuth2_AuthorizationCodeOAS2,OAS3
SignatureAuthOAS3
AWSV4SignatureToolingExtension

Wire Format Feature

NameSupportedDefined By
JSONOAS2,OAS3
XMLOAS2,OAS3
PROTOBUFToolingExtension
CustomOAS2,OAS3