Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit 4bc351b

Browse files
committed
Updates SetMaker and UnsetAddPropsSetter
Updates UuidJsonSchema Updates AdditionalPropertiesValidatorTest Removes unused kotlin files in petstore Updates the type value method interfaces and enum validators Updates some lingering java code to kotlin Fixes compile errors Fixes JsonSchemaKeywordFlagsTest Fixes JsonSchemaFactory and existing tests FIxes CustomIsoparserTest Updates FormatValidatorTest Updates ItemsValidatorTest Updates JsonSchemaTest Updates PropertiesValidatorTest Updates RequiredValidatorTest Updates TypeValidatorTest Updates AnyTypeSchemaTest Updates ArrayTypeSchemaTest Updates BooleanSchemaTest Updates ListBuilderTest Updates ListSchemaTest Updates MapSchemaTest Updates NullSchemaTest Updates NumberSchemaTest Partial updated to ObjectTypeSchemaTest kt file only More partial updates to ObjectTypeSchemaTest kt file Adds ObjectTypeSchemaTest Partial update of RefBooleanSchemaTest Updates RefBooleanSchemaTest Stops generating api client and rest client if there are no paths in kotlin Kotlin does not generate response sif there are not component responses or paths Makes request body kotlin generation conditional on presence of paths or component request bodies Conditionally generate parameters and headers packages for kotlin 303 sample regen Conditionally generates mediatype in kotlin Kotlin makes contenttype generation conditional Refactors supporting file adding into one method in kotlin Conditionally generate ApiCOnfiguration, fix artifactId warning Conditionally generates ApiException Makes generation of NotImplementedException conditional Updates readme to detect no endpoints, updates readme and gradle settings to use generatorSettings Fixes readme reference to artifactVersion Fixes various kotlin bugs, tests now pass without generated schemas Kotlin 303 regen, component schemas and tests deleted Fixes object output class initialization and requiredProps and optionalProps static vars Fixes object output class property methods Fixes output types for kotlin Fixes kotlin input types Fixes of input type definitions Removes list map and set imports Objects import removed Many schema generation fixes, imports property methods Removes casts because kotlin smart casts Many fixes for builder setter interfaces and methods More improvements to builder setters Fixes setters and builder classes Fixes sealed interfaces for schemas Updates type values Udpates properties, moves JsonSchemaInfo higher Partial validate fix Adds needed schema constructors Updates getNewInstance Fixes broken code in validate methods Removes PropertyEntry, more fixes Fixes many more kotlin errors Fixes some kotlin casting issues Updates schema info list creation to use listOf Updates code to use setOf Fixes array input and output classes Fixes schema extension of primitive json schemas Fixes enum types Fixes json schema enum data Fixes defaultValue method Fixes character escaping Removes many unneeded semicolons Fixes kotlin 303 tests Kotlin 303 sample added to ci Adds kotlin doc Adds circleci test for kotlin tweaks circleci file Turns off kotlinc version printing Checks gradle wrapper version Updates android image Switches image version Changes kotlin image ot use openjdk Removes kotlinc log Updates wrapper invocation Turns on test logging, forces to be rerun
1 parent 9313454 commit 4bc351b

File tree

2,529 files changed

+76136
-236332
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,529 files changed

+76136
-236332
lines changed

.circleci/config.yml

+20-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ commands: # a reusable command with parameters
1212
# In many cases you can simplify this from what is generated here.
1313
# 'See docs on artifact collection here https://circleci.com/docs/2.0/artifacts/'
1414
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
15-
# This is based on your 1.0 configuration file or project settings
16-
- run:
17-
command: java -version
18-
# Test
15+
# Show jobId
1916
- run:
2017
name: "Setup custom environment variables"
2118
command: echo 'export CIRCLE_JOB_ID="<<parameters.jobId>>"' >> $BASH_ENV
@@ -137,6 +134,24 @@ jobs:
137134
key: javaClientMavenCache
138135
paths:
139136
- ~/.m2
137+
testKotlinClientSamples:
138+
docker:
139+
- image: cimg/openjdk:17.0.9
140+
working_directory: ~/OpenAPITools/openapi-json-schema-generator
141+
shell: /bin/bash --login
142+
environment:
143+
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
144+
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
145+
steps:
146+
- restore_cache:
147+
keys:
148+
- kotlinClientGradleCache
149+
- command_build_and_test:
150+
jobId: "testKotlinClientSamples"
151+
- save_cache:
152+
key: kotlinClientGradleCache
153+
paths:
154+
- ~/build
140155
workflows:
141156
version: 2
142157
build:
@@ -146,3 +161,4 @@ workflows:
146161
- testPython38ClientSamples
147162
- testPython39ClientSamples
148163
- testJava17ClientSamples
164+
- testKotlinClientSamples

.circleci/parallel.sh

+7
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ elif [ "$JOB_ID" = "testJava17ClientSamples" ]; then
3333

3434
cat ./.circleci/testJava17ClientSamples.sh | parallel
3535

36+
elif [ "$JOB_ID" = "testKotlinClientSamples" ]; then
37+
echo "Running job $JOB_ID ..."
38+
gradle --version
39+
java -version
40+
41+
cat ./.circleci/testKotlinClientSamples.sh | parallel
42+
3643
else
3744
echo "Running job $JOB_ID"
3845

.circleci/testKotlinClientSamples.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(cd samples/client/3_0_3_unit_test/kotlin && gradle wrapper && ./gradlew cleanTest test)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
generatorName: kotlin
2+
outputDir: samples/client/3_0_3_unit_test/kotlin
3+
inputSpec: src/test/resources/3_0/unit_test_spec/3_0_3_unit_test_spec_nopaths.yaml
4+
intsAllowedForFloatDoubleFormats: true
5+
artifactId: unit-test-api
6+
hideGenerationTimestamp: true

docs/generators/kotlin.md

+329
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,329 @@
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&lt;?&gt; input<br />- Immutable Map output classes generated and returned by validate for Map&lt;?, ?&gt; 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

Comments
 (0)