mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 20:50:55 +00:00
* [kotlin] Enum should match spec Adjust the enum generation to match what is in the spec, rather than camel-casing it. Add tests for capitalization scenarios, including for kotlin keywords * [kotlin] export docs generators for enum change * [kotlin] export docs generators for enum change * fix conflicts --------- Co-authored-by: Tyler B. Thrailkill <tylerbthrailkill@gmail.com> Co-authored-by: Jari Nystedt <jari.nystedt@tietoevry.com>
10 KiB
10 KiB
title |
---|
Documentation for the kotlin-spring Generator |
METADATA
Property | Value | Notes |
---|---|---|
generator name | kotlin-spring | pass this to the generate command after -g |
generator stability | STABLE | |
generator type | SERVER | |
generator language | Kotlin | |
generator default templating engine | mustache | |
helpTxt | Generates 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.
Option | Description | Values | Default |
---|---|---|---|
additionalModelTypeAnnotations | Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows) | null | |
annotationLibrary | Select the complementary documentation annotation library. |
|
swagger2 |
apiPackage | api package for generated code | org.openapitools.api | |
apiSuffix | suffix for api classes | Api | |
appendRequestToHandler | Append ServerHttpRequest to handler method for getting request stuff | false | |
artifactId | Generated artifact id (name of jar). | openapi-spring | |
artifactVersion | Generated artifact's package version. | 1.0.0 | |
basePackage | base package (invokerPackage) for generated code | org.openapitools | |
beanQualifiers | Whether 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 | |
configPackage | configuration package for generated code | org.openapitools.configuration | |
delegatePattern | Whether to generate the server files using the delegate pattern | false | |
documentationProvider | Select the OpenAPI documentation provider. |
|
springdoc |
enumPropertyNaming | Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original' | original | |
exceptionHandler | generate default global exception handlers (not compatible with reactive. enabling reactive will disable exceptionHandler ) | true | |
gradleBuildFile | generate a gradle build file using the Kotlin DSL | true | |
groupId | Generated artifact package's organization (i.e. maven groupId). | org.openapitools | |
interfaceOnly | Whether to generate only API interface stubs without the server files. | false | |
library | library template (sub-template) |
|
spring-boot |
modelMutable | Create mutable models | false | |
modelPackage | model package for generated code | org.openapitools.model | |
packageName | Generated artifact package name. | org.openapitools | |
parcelizeModels | toggle "@Parcelize" for generated models | null | |
reactive | use coroutines for reactive behavior | false | |
serializableModel | boolean - toggle "implements Serializable" for generated models | null | |
serverPort | configuration the port in which the sever is to run on | 8080 | |
serviceImplementation | generate stub service implementations that extends service interfaces. If this is set to true service interfaces will also be generated | false | |
serviceInterface | generate 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 pattern | false | |
skipDefaultInterface | Whether to skip generation of default implementations for interfaces | false | |
sortModelPropertiesByRequiredFlag | Sort model properties to place required parameters before optional parameters. | null | |
sortParamsByRequiredFlag | Sort method arguments to place required parameters before optional parameters. | null | |
sourceFolder | source folder for generated code | src/main/kotlin | |
title | server title name or client service name | OpenAPI Kotlin Spring | |
useBeanValidation | Use BeanValidation API annotations to validate data types | true | |
useFeignClientUrl | Whether to generate Feign client with url parameter. | true | |
useSpringBoot3 | Generate 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 | |
useSwaggerUI | Open the OpenApi specification in swagger-ui. Will also import and configure needed dependencies | true | |
useTags | Whether to use tags for creating interface and controller class names | false |
IMPORT MAPPING
Type/Alias | Imports |
---|---|
BigDecimal | java.math.BigDecimal |
Date | java.time.LocalDate |
DateTime | java.time.OffsetDateTime |
File | java.io.File |
LocalDate | java.time.LocalDate |
LocalDateTime | java.time.LocalDateTime |
LocalTime | java.time.LocalTime |
Timestamp | java.sql.Timestamp |
URI | java.net.URI |
UUID | java.util.UUID |
INSTANTIATION TYPES
Type/Alias | Instantiated By |
---|---|
array | kotlin.collections.ArrayList |
list | kotlin.collections.ArrayList |
map | kotlin.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
Name | Supported | Defined By |
---|---|---|
BasePath | ✗ | ToolingExtension |
Authorizations | ✗ | ToolingExtension |
UserAgent | ✗ | ToolingExtension |
MockServer | ✗ | ToolingExtension |
Data Type Feature
Name | Supported | Defined By |
---|---|---|
Custom | ✗ | OAS2,OAS3 |
Int32 | ✓ | OAS2,OAS3 |
Int64 | ✓ | OAS2,OAS3 |
Float | ✓ | OAS2,OAS3 |
Double | ✓ | OAS2,OAS3 |
Decimal | ✓ | ToolingExtension |
String | ✓ | OAS2,OAS3 |
Byte | ✓ | OAS2,OAS3 |
Binary | ✓ | OAS2,OAS3 |
Boolean | ✓ | OAS2,OAS3 |
Date | ✓ | OAS2,OAS3 |
DateTime | ✓ | OAS2,OAS3 |
Password | ✓ | OAS2,OAS3 |
File | ✓ | OAS2 |
Uuid | ✗ | |
Array | ✓ | OAS2,OAS3 |
Null | ✗ | OAS3 |
AnyType | ✗ | OAS2,OAS3 |
Object | ✓ | OAS2,OAS3 |
Maps | ✓ | ToolingExtension |
CollectionFormat | ✓ | OAS2 |
CollectionFormatMulti | ✓ | OAS2 |
Enum | ✓ | OAS2,OAS3 |
ArrayOfEnum | ✓ | ToolingExtension |
ArrayOfModel | ✓ | ToolingExtension |
ArrayOfCollectionOfPrimitives | ✓ | ToolingExtension |
ArrayOfCollectionOfModel | ✓ | ToolingExtension |
ArrayOfCollectionOfEnum | ✓ | ToolingExtension |
MapOfEnum | ✓ | ToolingExtension |
MapOfModel | ✓ | ToolingExtension |
MapOfCollectionOfPrimitives | ✓ | ToolingExtension |
MapOfCollectionOfModel | ✓ | ToolingExtension |
MapOfCollectionOfEnum | ✓ | ToolingExtension |
Documentation Feature
Name | Supported | Defined By |
---|---|---|
Readme | ✓ | ToolingExtension |
Model | ✓ | ToolingExtension |
Api | ✓ | ToolingExtension |
Global Feature
Name | Supported | Defined By |
---|---|---|
Host | ✓ | OAS2,OAS3 |
BasePath | ✓ | OAS2,OAS3 |
Info | ✓ | OAS2,OAS3 |
Schemes | ✗ | OAS2,OAS3 |
PartialSchemes | ✓ | OAS2,OAS3 |
Consumes | ✓ | OAS2 |
Produces | ✓ | OAS2 |
ExternalDocumentation | ✓ | OAS2,OAS3 |
Examples | ✓ | OAS2,OAS3 |
XMLStructureDefinitions | ✗ | OAS2,OAS3 |
MultiServer | ✗ | OAS3 |
ParameterizedServer | ✗ | OAS3 |
ParameterStyling | ✗ | OAS3 |
Callbacks | ✗ | OAS3 |
LinkObjects | ✗ | OAS3 |
Parameter Feature
Name | Supported | Defined By |
---|---|---|
Path | ✓ | OAS2,OAS3 |
Query | ✓ | OAS2,OAS3 |
Header | ✓ | OAS2,OAS3 |
Body | ✓ | OAS2 |
FormUnencoded | ✓ | OAS2 |
FormMultipart | ✓ | OAS2 |
Cookie | ✓ | OAS3 |
Schema Support Feature
Name | Supported | Defined By |
---|---|---|
Simple | ✓ | OAS2,OAS3 |
Composite | ✓ | OAS2,OAS3 |
Polymorphism | ✓ | OAS2,OAS3 |
Union | ✗ | OAS3 |
allOf | ✗ | OAS2,OAS3 |
anyOf | ✗ | OAS3 |
oneOf | ✗ | OAS3 |
not | ✗ | OAS3 |
Security Feature
Name | Supported | Defined By |
---|---|---|
BasicAuth | ✓ | OAS2,OAS3 |
ApiKey | ✓ | OAS2,OAS3 |
OpenIDConnect | ✗ | OAS3 |
BearerToken | ✗ | OAS3 |
OAuth2_Implicit | ✓ | OAS2,OAS3 |
OAuth2_Password | ✓ | OAS2,OAS3 |
OAuth2_ClientCredentials | ✓ | OAS2,OAS3 |
OAuth2_AuthorizationCode | ✓ | OAS2,OAS3 |
SignatureAuth | ✗ | OAS3 |
AWSV4Signature | ✗ | ToolingExtension |
Wire Format Feature
Name | Supported | Defined By |
---|---|---|
JSON | ✓ | OAS2,OAS3 |
XML | ✓ | OAS2,OAS3 |
PROTOBUF | ✗ | ToolingExtension |
Custom | ✗ | OAS2,OAS3 |