Skip to content

Commit 1ba7a4e

Browse files
committed
reuse 1 open api schema for everything. Add also case where interface extends interface.
1 parent b1141e1 commit 1ba7a4e

24 files changed

Lines changed: 477 additions & 1157 deletions

File tree

bin/configs/kotlin-spring-boot-x-kotlin-implements.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
generatorName: kotlin-spring
22
outputDir: samples/server/petstore/kotlin-springboot-x-kotlin-implements
33
library: spring-boot
4-
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-x-kotlin-implements.yaml
4+
inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-with-x-kotlin-implements.yaml
55
templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
66
additionalProperties:
77
documentationProvider: none

modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -977,12 +977,12 @@ public void generateSerializableModelWithXimplements() throws Exception {
977977

978978
generator.opts(input).generate();
979979

980-
Path path = Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Pet.kt");
980+
Path path = Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Dog.kt");
981981
assertFileContains(
982982
path,
983983
"import java.io.Serializable",
984-
"@get:JsonProperty(\"name\", required = true) override val name: kotlin.String,",
985-
") : Serializable, com.some.package.Named {",
984+
"@get:JsonProperty(\"likesFetch\", required = true) override val likesFetch: kotlin.Boolean,",
985+
") : Pet, Serializable, com.some.pack.Fetchable {",
986986
"private const val serialVersionUID: kotlin.Long = 1"
987987
);
988988
}
@@ -1009,17 +1009,17 @@ public void generateNonSerializableModelWithXimplements() throws Exception {
10091009

10101010
generator.opts(input).generate();
10111011

1012-
Path path = Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Pet.kt");
1012+
Path path = Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Dog.kt");
10131013
assertFileContains(
10141014
path,
1015-
"@get:JsonProperty(\"name\", required = true) override val name: kotlin.String,",
1016-
") : com.some.package.Named {"
1015+
"@get:JsonProperty(\"likesFetch\", required = true) override val likesFetch: kotlin.Boolean,",
1016+
") : Pet, com.some.pack.Fetchable {"
10171017
);
10181018
assertFileNotContains(
10191019
path,
10201020
"import java.io.Serializable",
1021-
") : Serializable, com.some.package.Named {",
1022-
") : Serializable {",
1021+
") : Pet, Serializable, com.some.pack.Fetchable {",
1022+
") : Pet, Serializable {",
10231023
"private const val serialVersionUID: kotlin.Long = 1"
10241024
);
10251025
}

0 commit comments

Comments
 (0)