|
| 1 | +--- |
| 2 | +title: Documentation for the kotlin generator |
| 3 | +--- |
| 4 | + |
| 5 | +## METADATA |
| 6 | + |
| 7 | +| Property | Value | Notes | |
| 8 | +| -------- | ----- | ----- | |
| 9 | +| generator name | kotlin | pass this to the generate command after -g | |
| 10 | +| generator stability | EXPERIMENTAL | | |
| 11 | +| generator type | CLIENT | | |
| 12 | +| generator language | Kotlin | | |
| 13 | +| generator language version | 1.9.23 | | |
| 14 | +| generator default templating engine | handlebars | | |
| 15 | +| helpMsg | Generates a Kotlin client library<br /><br />Features in this generator:<br />- v3.0.0 - [v3.1.0](#schema-feature) OpenAPI Specification support<br />- Very thorough documentation generated in the style of javadocs<br />- Input types constrained for a Schema in SomeSchema.validate<br /> - validate method can accept arbitrary List/Map/null/int/long/double/float/String json data<br />- Immutable List output classes generated and returned by validate for List<?> input<br />- Immutable Map output classes generated and returned by validate for Map<?, ?> input<br />- Strictly typed list input can be instantiated in client code using generated ListBuilders<br />- Strictly typed map input can be instantiated in client code using generated MapBuilders<br /> - Sequential map builders are generated ensuring that required properties are set before build is invoked. Looks like:<br /> - `new MapBuilder().requiredA("a").requiredB("b").build()`<br /> - `new MapBuilder().requiredA("a").requiredB("b").optionalProp("c").additionalProperty("someAddProp", "d").build()`<br />- Run time type checking and validation when<br /> - validating schema payloads<br /> - instantiating List output class (validation run)<br /> - instantiating Map output class (validation run)<br /> - Note: if needed, validation of json schema keywords can be deactivated via a SchemaConfiguration class<br />- Enums classes are generated and may be input into Schema.validate or the List/MapBuilder add/setter methods<br />- Invalid (in Kotlin) property names supported like `class`, `1var`, `hi-there` etc in<br /> - component schema names<br /> - schema property names (a fallback setter is written in the MapBuilder)<br />- Generated interfaces are largely consistent with the python code<br />- Openapi spec inline schemas supported at any depth in any location<br />- Format support for: int32, int64, float, double, date, datetime, uuid<br />- Payload values are not coerced when validated, so a date/date-time value can pass other validations that describe the payload only as type string<br />- enum types are generated for enums of type string/integer/number/boolean/null<br />- String transmission of numbers supported with type: string, format: number | | |
| 16 | + |
| 17 | +## CONFIG OPTIONS |
| 18 | +These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. |
| 19 | + |
| 20 | +| Option | Description | Values | Default | |
| 21 | +| ------ | ----------- | ------ | ------- | |
| 22 | +|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| |
| 23 | +|artifactDescription|artifact description in generated pom.xml| |OpenAPI Kotlin| |
| 24 | +|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapi-json-schema-tools/openapi-json-schema-generator| |
| 25 | +|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename| |1.0.0| |
| 26 | +|developerEmail |developer email in generated pom.xml | |[email protected]| |
| 27 | +|developerName|developer name in generated pom.xml| |OpenAPI-Generator Contributors| |
| 28 | +|developerOrganization|developer organization in generated pom.xml| |OpenAPITools.org| |
| 29 | +|developerOrganizationUrl|developer organization URL in generated pom.xml| |http://openapijsonschematools.org| |
| 30 | +|groupId|groupId in generated pom.xml| |org.openapijsonschematools| |
| 31 | +|invokerPackage|root package for generated code| |org.openapijsonschematools.client| |
| 32 | +|licenseName|The name of the license| |Unlicense| |
| 33 | +|licenseUrl|The URL of the license| |http://unlicense.org| |
| 34 | +|parentArtifactId|parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |
| 35 | +|parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |
| 36 | +|parentVersion|parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| |
| 37 | +|scmConnection|SCM connection in generated pom.xml| |scm:git:git@github.com:openapi-json-schema-tools/openapi-json-schema-generator.git| |
| 38 | +|scmDeveloperConnection|SCM developer connection in generated pom.xml| |scm:git:git@github.com:openapi-json-schema-tools/openapi-json-schema-generator.git| |
| 39 | +|scmUrl|SCM URL in generated pom.xml| |https://github.com/openapi-json-schema-tools/openapi-json-schema-generator| |
| 40 | +|snapshotVersion|Uses a SNAPSHOT version.|<dl><dt>**true**</dt><dd>Use a SnapShot Version</dd><dt>**false**</dt><dd>Use a Release Version</dd></dl>|null| |
| 41 | +|sourceFolder|source folder for generated code| |src/main/kotlin| |
| 42 | +|testOutput|Set output folder for models and APIs tests| |${project.build.directory}/generated-test-sources/openapi| |
| 43 | + |
| 44 | +## SUPPORTED VENDOR EXTENSIONS |
| 45 | + |
| 46 | +| Extension name | Description | Applicable for | Default value | |
| 47 | +| -------------- | ----------- | -------------- | ------------- | |
| 48 | +|x-enum-varnames|A list of strings that defines the enum variable names, must be adjacent to enum|SCHEMA|[] |
| 49 | +|x-enum-descriptions|A list of strings that defines the enum descriptions, must be adjacent to enum|SCHEMA|[] |
| 50 | + |
| 51 | + |
| 52 | +## INSTANTIATION TYPES |
| 53 | + |
| 54 | +| Type/Alias | Instantiated By | |
| 55 | +| ---------- | --------------- | |
| 56 | +|array|FrozenList| |
| 57 | +|boolean|Boolean| |
| 58 | +|integer|Number (Int, Long, Float with integer values, Double with integer values)| |
| 59 | +|null|Nothing? (null)| |
| 60 | +|number|Number (Int, Long, Float, Double)| |
| 61 | +|object|FrozenMap| |
| 62 | +|string|String| |
| 63 | + |
| 64 | + |
| 65 | +## LANGUAGE PRIMITIVES |
| 66 | + |
| 67 | +<ul class="column-ul"> |
| 68 | +<li>Any</li> |
| 69 | +<li>Boolean</li> |
| 70 | +<li>Double</li> |
| 71 | +<li>Float</li> |
| 72 | +<li>Int</li> |
| 73 | +<li>Long</li> |
| 74 | +<li>String</li> |
| 75 | +</ul> |
| 76 | + |
| 77 | +## RESERVED WORDS |
| 78 | + |
| 79 | +<ul class="column-ul"> |
| 80 | +<li>abstract</li> |
| 81 | +<li>actual</li> |
| 82 | +<li>annotation</li> |
| 83 | +<li>apiresponse</li> |
| 84 | +<li>as</li> |
| 85 | +<li>break</li> |
| 86 | +<li>class</li> |
| 87 | +<li>companion</li> |
| 88 | +<li>const</li> |
| 89 | +<li>constructor</li> |
| 90 | +<li>continue</li> |
| 91 | +<li>contract</li> |
| 92 | +<li>crossinline</li> |
| 93 | +<li>data</li> |
| 94 | +<li>delegate</li> |
| 95 | +<li>do</li> |
| 96 | +<li>dynamic</li> |
| 97 | +<li>else</li> |
| 98 | +<li>enum</li> |
| 99 | +<li>expect</li> |
| 100 | +<li>external</li> |
| 101 | +<li>false</li> |
| 102 | +<li>field</li> |
| 103 | +<li>final</li> |
| 104 | +<li>finally</li> |
| 105 | +<li>for</li> |
| 106 | +<li>fun</li> |
| 107 | +<li>if</li> |
| 108 | +<li>import</li> |
| 109 | +<li>in</li> |
| 110 | +<li>infix</li> |
| 111 | +<li>init</li> |
| 112 | +<li>inline</li> |
| 113 | +<li>inner</li> |
| 114 | +<li>interface</li> |
| 115 | +<li>internal</li> |
| 116 | +<li>is</li> |
| 117 | +<li>it</li> |
| 118 | +<li>lateinit</li> |
| 119 | +<li>noinline</li> |
| 120 | +<li>null</li> |
| 121 | +<li>object</li> |
| 122 | +<li>open</li> |
| 123 | +<li>operator</li> |
| 124 | +<li>out</li> |
| 125 | +<li>override</li> |
| 126 | +<li>package</li> |
| 127 | +<li>param</li> |
| 128 | +<li>private</li> |
| 129 | +<li>property</li> |
| 130 | +<li>protected</li> |
| 131 | +<li>public</li> |
| 132 | +<li>receiver</li> |
| 133 | +<li>reified</li> |
| 134 | +<li>return</li> |
| 135 | +<li>sealed</li> |
| 136 | +<li>setparam</li> |
| 137 | +<li>super</li> |
| 138 | +<li>suspend</li> |
| 139 | +<li>tailrec</li> |
| 140 | +<li>this</li> |
| 141 | +<li>throw</li> |
| 142 | +<li>true</li> |
| 143 | +<li>try</li> |
| 144 | +<li>typealias</li> |
| 145 | +<li>typeof</li> |
| 146 | +<li>val</li> |
| 147 | +<li>value</li> |
| 148 | +<li>var</li> |
| 149 | +<li>vararg</li> |
| 150 | +<li>when</li> |
| 151 | +<li>where</li> |
| 152 | +<li>while</li> |
| 153 | +</ul> |
| 154 | + |
| 155 | +## FEATURE SET |
| 156 | + |
| 157 | + |
| 158 | +### Client Modification Feature |
| 159 | +| Name | Supported | Defined By | |
| 160 | +| ---- | --------- | ---------- | |
| 161 | +|BasePath|✗|ToolingExtension |
| 162 | +|Authorizations|✗|ToolingExtension |
| 163 | +|UserAgent|✗|ToolingExtension |
| 164 | +|MockServer|✗|ToolingExtension |
| 165 | + |
| 166 | +### Components Feature |
| 167 | +| Name | Supported | Defined By | |
| 168 | +| ---- | --------- | ---------- | |
| 169 | +|schemas|✓|OAS3 |
| 170 | +|responses|✓|OAS3 |
| 171 | +|parameters|✓|OAS3 |
| 172 | +|examples|✗|OAS3 |
| 173 | +|requestBodies|✓|OAS3 |
| 174 | +|headers|✓|OAS3 |
| 175 | +|securitySchemes|✓|OAS3 |
| 176 | +|links|✗|OAS3 |
| 177 | +|callbacks|✗|OAS3 |
| 178 | +|pathItems|✗|OAS3 |
| 179 | + |
| 180 | +### Data Type Feature |
| 181 | +| Name | Supported | Defined By | |
| 182 | +| ---- | --------- | ---------- | |
| 183 | +|Custom|✗|OAS2,OAS3 |
| 184 | +|Int32|✓|OAS2,OAS3 |
| 185 | +|Int64|✓|OAS2,OAS3 |
| 186 | +|Integer|✓|OAS2,OAS3 |
| 187 | +|Float|✓|OAS2,OAS3 |
| 188 | +|Double|✓|OAS2,OAS3 |
| 189 | +|Number|✓|OAS2,OAS3 |
| 190 | +|String|✓|OAS2,OAS3 |
| 191 | +|Byte|✗|OAS2,OAS3 |
| 192 | +|Binary|✗|OAS2,OAS3 |
| 193 | +|Boolean|✓|OAS2,OAS3 |
| 194 | +|Date|✓|OAS2,OAS3 |
| 195 | +|DateTime|✓|OAS2,OAS3 |
| 196 | +|Password|✗|OAS2,OAS3 |
| 197 | +|File|✗|OAS2 |
| 198 | +|Uuid|✓|OAS2,OAS3 |
| 199 | +|Array|✓|OAS2,OAS3 |
| 200 | +|Null|✓|OAS3 |
| 201 | +|AnyType|✓|OAS2,OAS3 |
| 202 | +|Object|✓|OAS2,OAS3 |
| 203 | +|Enum|✓|OAS2,OAS3 |
| 204 | + |
| 205 | +### Documentation Feature |
| 206 | +| Name | Supported | Defined By | |
| 207 | +| ---- | --------- | ---------- | |
| 208 | +|Readme|✓|ToolingExtension |
| 209 | +|Servers|✓|OAS3 |
| 210 | +|Security|✓|OAS2,OAS3 |
| 211 | +|ComponentSchemas|✓|OAS3 |
| 212 | +|ComponentResponses|✓|OAS3 |
| 213 | +|ComponentParameters|✓|OAS3 |
| 214 | +|ComponentRequestBodies|✓|OAS3 |
| 215 | +|ComponentHeaders|✓|OAS3 |
| 216 | +|ComponentSecuritySchemes|✓|OAS3 |
| 217 | +|ComponentLinks|✗|OAS3 |
| 218 | +|ComponentCallbacks|✗|OAS3 |
| 219 | +|ComponentPathItems|✗|OAS3 |
| 220 | +|Api|✓|ToolingExtension |
| 221 | + |
| 222 | +### Global Feature |
| 223 | +| Name | Supported | Defined By | |
| 224 | +| ---- | --------- | ---------- | |
| 225 | +|Info|✓|OAS2,OAS3 |
| 226 | +|Servers|✓|OAS3 |
| 227 | +|Paths|✓|OAS2,OAS3 |
| 228 | +|Webhooks|✗|OAS3 |
| 229 | +|Components|✓|OAS3 |
| 230 | +|Security|✓|OAS2,OAS3 |
| 231 | +|Tags|✗|OAS2,OAS3 |
| 232 | +|ExternalDocs|✗|OAS2,OAS3 |
| 233 | + |
| 234 | +### Operation Feature |
| 235 | +| Name | Supported | Defined By | |
| 236 | +| ---- | --------- | ---------- | |
| 237 | +|Responses_HttpStatusCode|✓|OAS3 |
| 238 | +|Responses_RangedResponseCodes|✓|OAS3 |
| 239 | +|Responses_Default|✓|OAS3 |
| 240 | +|Responses_RedirectionResponse|✓|OAS3 |
| 241 | +|Security|✓|OAS2,OAS3 |
| 242 | +|Servers|✓|OAS3 |
| 243 | + |
| 244 | +### Parameter Feature |
| 245 | +| Name | Supported | Defined By | |
| 246 | +| ---- | --------- | ---------- | |
| 247 | +|Name|✗|OAS2,OAS3 |
| 248 | +|Required|✗|OAS2,OAS3 |
| 249 | +|In_Path|✗|OAS2,OAS3 |
| 250 | +|In_Query|✗|OAS2,OAS3 |
| 251 | +|In_Header|✗|OAS2,OAS3 |
| 252 | +|In_Cookie|✗|OAS3 |
| 253 | +|Style_Matrix|✗|OAS3 |
| 254 | +|Style_Label|✗|OAS3 |
| 255 | +|Style_Form|✗|OAS3 |
| 256 | +|Style_Simple|✗|OAS3 |
| 257 | +|Style_SpaceDelimited|✗|OAS3 |
| 258 | +|Style_PipeDelimited|✗|OAS3 |
| 259 | +|Style_DeepObject|✗|OAS3 |
| 260 | +|Explode|✗|OAS3 |
| 261 | +|Schema|✗|OAS3 |
| 262 | +|Content|✗|OAS3 |
| 263 | + |
| 264 | +### Schema Feature |
| 265 | +| Name | Supported | Defined By | |
| 266 | +| ---- | --------- | ---------- | |
| 267 | +|AdditionalProperties|✓|OAS2,OAS3 |
| 268 | +|AllOf|✓|OAS2,OAS3 |
| 269 | +|AnyOf|✓|OAS3 |
| 270 | +|Const|✓|OAS3 |
| 271 | +|Contains|✓|OAS3 |
| 272 | +|Default|✓|OAS2,OAS3 |
| 273 | +|DependentRequired|✓|OAS3 |
| 274 | +|DependentSchemas|✓|OAS3 |
| 275 | +|Discriminator|✗|OAS2,OAS3 |
| 276 | +|Else|✓|OAS3 |
| 277 | +|Enum|✓|OAS2,OAS3 |
| 278 | +|ExclusiveMinimum|✓|OAS2,OAS3 |
| 279 | +|ExclusiveMaximum|✓|OAS2,OAS3 |
| 280 | +|Format|✓|OAS2,OAS3 |
| 281 | +|If|✓|OAS3 |
| 282 | +|Items|✓|OAS2,OAS3 |
| 283 | +|MaxContains|✓|OAS3 |
| 284 | +|MaxItems|✓|OAS2,OAS3 |
| 285 | +|MaxLength|✓|OAS2,OAS3 |
| 286 | +|MaxProperties|✓|OAS2,OAS3 |
| 287 | +|Maximum|✓|OAS2,OAS3 |
| 288 | +|MinContains|✓|OAS3 |
| 289 | +|MinItems|✓|OAS2,OAS3 |
| 290 | +|MinLength|✓|OAS2,OAS3 |
| 291 | +|MinProperties|✓|OAS2,OAS3 |
| 292 | +|Minimum|✓|OAS2,OAS3 |
| 293 | +|MultipleOf|✓|OAS2,OAS3 |
| 294 | +|Not|✓|OAS3 |
| 295 | +|Nullable|✓|OAS3 |
| 296 | +|OneOf|✓|OAS3 |
| 297 | +|Pattern|✓|OAS2,OAS3 |
| 298 | +|PatternProperties|✓|OAS3 |
| 299 | +|PrefixItems|✓|OAS3 |
| 300 | +|Properties|✓|OAS2,OAS3 |
| 301 | +|PropertyNames|✓|OAS3 |
| 302 | +|Ref|✓|OAS2,OAS3 |
| 303 | +|Required|✓|OAS2,OAS3 |
| 304 | +|Then|✓|OAS3 |
| 305 | +|Type|✓|OAS2,OAS3 |
| 306 | +|UnevaluatedItems|✓|OAS3 |
| 307 | +|UnevaluatedProperties|✓|OAS3 |
| 308 | +|UniqueItems|✓|OAS2,OAS3 |
| 309 | +|Xml|✗|OAS2,OAS3 |
| 310 | + |
| 311 | +### Security Feature |
| 312 | +| Name | Supported | Defined By | |
| 313 | +| ---- | --------- | ---------- | |
| 314 | +|HTTP_Basic|✓|OAS2,OAS3 |
| 315 | +|ApiKey|✓|OAS2,OAS3 |
| 316 | +|OpenIDConnect|✗|OAS3 |
| 317 | +|HTTP_Bearer|✓|OAS2,OAS3 |
| 318 | +|OAuth2_Implicit|✗|OAS2,OAS3 |
| 319 | +|OAuth2_Password|✗|OAS2,OAS3 |
| 320 | +|OAuth2_ClientCredentials|✗|OAS2,OAS3 |
| 321 | +|OAuth2_AuthorizationCode|✗|OAS2,OAS3 |
| 322 | + |
| 323 | +### Wire Format Feature |
| 324 | +| Name | Supported | Defined By | |
| 325 | +| ---- | --------- | ---------- | |
| 326 | +|JSON|✓|OAS2,OAS3 |
| 327 | +|XML|✗|OAS2,OAS3 |
| 328 | +|PROTOBUF|✗|ToolingExtension |
| 329 | +|Custom|✗|OAS2,OAS3 |
0 commit comments