Skip to main content

Documentation for the kotlin-server Generator

METADATA

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

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
apiSuffixsuffix for api classesApi
artifactIdGenerated artifact id (name of jar).kotlin-server
artifactVersionGenerated artifact's package version.1.0.0
enumPropertyNamingNaming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'original
featureAutoHeadAutomatically provide responses to HEAD requests for existing routes that have the GET verb defined.true
featureCORSKtor by default provides an interceptor for implementing proper support for Cross-Origin Resource Sharing (CORS). See enable-cors.org.false
featureCompressionAdds ability to compress outgoing content using gzip, deflate or custom encoder and thus reduce size of the response.true
featureConditionalHeadersAvoid sending content if client already has same content, by checking ETag or LastModified properties.false
featureHSTSAvoid sending content if client already has same content, by checking ETag or LastModified properties.true
featureMetricsEnables metrics feature.true
featureResourcesGenerates routes in a typed way, for both: constructing URLs and reading the parameters.true
groupIdGenerated artifact package's organization (i.e. maven groupId).org.openapitools
interfaceOnlyWhether to generate only API interface stubs without the server files. This option is currently supported only when using jaxrs-spec library.false
librarylibrary template (sub-template)
ktor
ktor framework
ktor2
ktor (2.x) framework
jaxrs-spec
JAX-RS spec only
javalin5
Javalin 5
javalin6
Javalin 6
ktor
modelMutableCreate mutable modelsfalse
omitGradleWrapperWhether to omit Gradle wrapper for creating a sub project.false
packageNameGenerated artifact package name.org.openapitools.server
parcelizeModelstoggle "@Parcelize" for generated modelsnull
returnResponseWhether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true. This option is currently supported only when using jaxrs-spec library.false
serializableModelboolean - toggle "implements Serializable" for generated modelsnull
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
useBeanValidationUse BeanValidation API annotations. This option is currently supported only when using jaxrs-spec library.false
useCoroutinesWhether to use the Coroutines. This option is currently supported only when using jaxrs-spec library.false
useJakartaEewhether to use Jakarta EE namespace instead of javaxfalse
useMutinyWhether to use Mutiny (should not be used with useCoroutines). This option is currently supported only when using jaxrs-spec library.false

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

  • 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