diff --git a/.github/workflows/samples-kotlin-server.yaml b/.github/workflows/samples-kotlin-server.yaml index 6dbb7d6ed9a..191e0861c93 100644 --- a/.github/workflows/samples-kotlin-server.yaml +++ b/.github/workflows/samples-kotlin-server.yaml @@ -38,6 +38,7 @@ jobs: - samples/server/petstore/kotlin-springboot-source-swagger1 - samples/server/petstore/kotlin-springboot-source-swagger2 - samples/server/petstore/kotlin-springboot-springfox + - samples/server/petstore/kotlin-springboot-x-kotlin-implements - samples/server/petstore/kotlin-server/ktor - samples/server/petstore/kotlin-server/ktor2 - samples/server/petstore/kotlin-server/jaxrs-spec diff --git a/bin/configs/kotlin-spring-boot-x-kotlin-implements.yaml b/bin/configs/kotlin-spring-boot-x-kotlin-implements.yaml new file mode 100644 index 00000000000..c4068770d55 --- /dev/null +++ b/bin/configs/kotlin-spring-boot-x-kotlin-implements.yaml @@ -0,0 +1,14 @@ +generatorName: kotlin-spring +outputDir: samples/server/petstore/kotlin-springboot-x-kotlin-implements +library: spring-boot +inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-with-x-kotlin-implements.yaml +templateDir: modules/openapi-generator/src/main/resources/kotlin-spring +additionalProperties: + documentationProvider: none + annotationLibrary: none + useSwaggerUI: "false" + serviceImplementation: "false" + skipDefaultInterface: "true" + interfaceOnly: "true" + serializableModel: "true" + beanValidations: "true" diff --git a/docs/generators/kotlin-spring.md b/docs/generators/kotlin-spring.md index 195c51460ef..9fc742bd246 100644 --- a/docs/generators/kotlin-spring.md +++ b/docs/generators/kotlin-spring.md @@ -67,6 +67,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl |x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL| |x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null |x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null +|x-kotlin-implements|Ability to specify interfaces that model must implement|MODEL|empty array +|x-kotlin-implements-fields|Specify attributes that are implemented by the interface(s) added via `x-kotlin-implements`|MODEL|empty array ## IMPORT MAPPING diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java index fe97b12695f..70aa9ce222b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/VendorExtension.java @@ -10,6 +10,8 @@ import java.util.List; public enum VendorExtension { X_IMPLEMENTS("x-implements", ExtensionLevel.MODEL, "Ability to specify interfaces that model must implements", "empty array"), + X_KOTLIN_IMPLEMENTS("x-kotlin-implements", ExtensionLevel.MODEL, "Ability to specify interfaces that model must implement", "empty array"), + X_KOTLIN_IMPLEMENTS_FIELDS("x-kotlin-implements-fields", ExtensionLevel.MODEL, "Specify attributes that are implemented by the interface(s) added via `x-kotlin-implements`", "empty array"), X_SPRING_PAGINATED("x-spring-paginated", ExtensionLevel.OPERATION, "Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.", "false"), X_SPRING_PROVIDE_ARGS("x-spring-provide-args", ExtensionLevel.OPERATION, "Allows adding additional hidden parameters in the API specification to allow access to content such as header values or properties", "empty array"), X_DISCRIMINATOR_VALUE("x-discriminator-value", ExtensionLevel.MODEL, "Used with model inheritance to specify value for discriminator that identifies current model", ""), diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java index 12c333ca184..e637234fb0f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java @@ -835,6 +835,16 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co @Override public CodegenModel fromModel(String name, Schema schema) { CodegenModel m = super.fromModel(name, schema); + List implementedInterfacesClasses = (List) m.getVendorExtensions().getOrDefault(VendorExtension.X_KOTLIN_IMPLEMENTS.getName(), List.of()); + List implementedInterfacesFields = Optional.ofNullable((List) m.getVendorExtensions().get(VendorExtension.X_KOTLIN_IMPLEMENTS_FIELDS.getName())) + .map(xKotlinImplementsFields -> { + if (implementedInterfacesClasses.isEmpty() && !xKotlinImplementsFields.isEmpty()) { + LOGGER.warn("Annotating {} with {} without {} is not supported. {} will be ignored.", + name, VendorExtension.X_KOTLIN_IMPLEMENTS_FIELDS.getName(), VendorExtension.X_KOTLIN_IMPLEMENTS.getName(), + VendorExtension.X_KOTLIN_IMPLEMENTS_FIELDS.getName()); + } + return xKotlinImplementsFields; + }).orElse(List.of()); m.optionalVars = m.optionalVars.stream().distinct().collect(Collectors.toList()); // Update allVars/requiredVars/optionalVars with isInherited // Each of these lists contains elements that are similar, but they are all cloned @@ -850,7 +860,9 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co // Update any other vars (requiredVars, optionalVars) Stream.of(m.requiredVars, m.optionalVars) .flatMap(List::stream) - .filter(p -> allVarsMap.containsKey(p.baseName)) + .filter(p -> allVarsMap.containsKey(p.baseName) + || implementedInterfacesFields.contains(p.baseName) + ) .forEach(p -> p.isInherited = true); return m; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java index d096e90cdcb..43b849998f2 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java @@ -1012,6 +1012,8 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen extensions.add(VendorExtension.X_DISCRIMINATOR_VALUE); extensions.add(VendorExtension.X_FIELD_EXTRA_ANNOTATION); extensions.add(VendorExtension.X_PATTERN_MESSAGE); + extensions.add(VendorExtension.X_KOTLIN_IMPLEMENTS); + extensions.add(VendorExtension.X_KOTLIN_IMPLEMENTS_FIELDS); return extensions; } diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClass.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClass.mustache index 5d066ded759..f818fd75239 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClass.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClass.mustache @@ -17,7 +17,34 @@ {{/-last}}{{/requiredVars}}{{#hasRequired}}{{#hasOptional}}, {{/hasOptional}}{{/hasRequired}}{{#optionalVars}}{{>dataClassOptVar}}{{^-last}}, {{/-last}}{{/optionalVars}} - ) {{/discriminator}}{{#parent}}: {{{.}}}{{#serializableModel}}, Serializable{{/serializableModel}}{{/parent}}{{^parent}}{{#serializableModel}}: Serializable{{/serializableModel}}{{/parent}}{ +){{/discriminator}}{{! no newline +}}{{#parent}} : {{{.}}}{{! no newline + }}{{#serializableModel}}{{! no newline + }}{{^vendorExtensions.x-kotlin-implements}}, Serializable{{/vendorExtensions.x-kotlin-implements}}{{! no newline + }}{{#vendorExtensions.x-kotlin-implements}}, Serializable, {{! no newline + }}{{#-first}} {{{.}}}{{/-first}}{{! no newline + }}{{^-first}}, {{{.}}}{{/-first}}{{! no newline + }}{{/vendorExtensions.x-kotlin-implements}}{{! no newline + }}{{/serializableModel}}{{! no newline + }}{{^serializableModel}}{{! no newline + }}{{#vendorExtensions.x-kotlin-implements}}, {{{.}}}{{/vendorExtensions.x-kotlin-implements}}{{! no newline + }}{{/serializableModel}}{{! no newline +}}{{/parent}}{{! no newline +}}{{^parent}}{{! no newline + }}{{#serializableModel}}{{! no newline + }}{{^vendorExtensions.x-kotlin-implements}} : Serializable{{/vendorExtensions.x-kotlin-implements}}{{! no newline + }}{{#vendorExtensions.x-kotlin-implements}}{{! no newline + }}{{#-first}} : Serializable, {{{.}}}{{/-first}}{{! no newline + }}{{^-first}}, {{{.}}}{{/-first}}{{! no newline + }}{{/vendorExtensions.x-kotlin-implements}}{{! no newline + }}{{/serializableModel}}{{! no newline + }}{{^serializableModel}}{{! no newline + }}{{#vendorExtensions.x-kotlin-implements}}{{! no newline + }}{{#-first}} : {{{.}}}{{/-first}}{{! no newline + }}{{^-first}}, {{{.}}}{{/-first}}{{! no newline + }}{{/vendorExtensions.x-kotlin-implements}}{{! no newline + }}{{/serializableModel}}{{! no newline +}}{{/parent}} { {{#discriminator}} {{#requiredVars}} {{>interfaceReqVar}}{{! prevent indent}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/enumClass.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/enumClass.mustache index afdc7a8d68d..30916567a54 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/enumClass.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/enumClass.mustache @@ -2,7 +2,7 @@ * {{{description}}} * Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} */ -enum class {{classname}}(@get:JsonValue val value: {{dataType}}) { +enum class {{classname}}(@get:JsonValue val value: {{dataType}}) {{#vendorExtensions.x-kotlin-implements}}{{#-first}}: {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}} {{/vendorExtensions.x-kotlin-implements}}{ {{#allowableValues}}{{#enumVars}} {{&name}}({{{value}}}){{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}}; diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java index f2ce3c3adeb..d036a1f9433 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java @@ -946,10 +946,80 @@ public class KotlinSpringServerCodegenTest { generator.opts(input).generate(); + Path path = Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Pet.kt"); assertFileContains( - Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Pet.kt"), + path, "import java.io.Serializable", - ") : Serializable{", + ") : Serializable {", + "private const val serialVersionUID: kotlin.Long = 1" + ); + } + @Test + public void generateSerializableModelWithXimplements() throws Exception { + File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + String outputPath = output.getAbsolutePath().replace('\\', '/'); + + KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + codegen.additionalProperties().put(CodegenConstants.SERIALIZABLE_MODEL, true); + + ClientOptInput input = new ClientOptInput() + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/petstore-with-x-kotlin-implements.yaml")) + .config(codegen); + DefaultGenerator generator = new DefaultGenerator(); + + generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "true"); + generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false"); + + generator.opts(input).generate(); + + Path path = Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Dog.kt"); + assertFileContains( + path, + "import java.io.Serializable", + "@get:JsonProperty(\"likesFetch\", required = true) override val likesFetch: kotlin.Boolean,", + ") : Pet, Serializable, com.some.pack.Fetchable {", + "private const val serialVersionUID: kotlin.Long = 1" + ); + } + + @Test + public void generateNonSerializableModelWithXimplements() throws Exception { + File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + String outputPath = output.getAbsolutePath().replace('\\', '/'); + + KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + + ClientOptInput input = new ClientOptInput() + .openAPI(TestUtils.parseSpec("src/test/resources/3_0/kotlin/petstore-with-x-kotlin-implements.yaml")) + .config(codegen); + DefaultGenerator generator = new DefaultGenerator(); + + generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "true"); + generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "false"); + generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false"); + + generator.opts(input).generate(); + + Path path = Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Dog.kt"); + assertFileContains( + path, + "@get:JsonProperty(\"likesFetch\", required = true) override val likesFetch: kotlin.Boolean,", + ") : Pet, com.some.pack.Fetchable {" + ); + assertFileNotContains( + path, + "import java.io.Serializable", + ") : Pet, Serializable, com.some.pack.Fetchable {", + ") : Pet, Serializable {", "private const val serialVersionUID: kotlin.Long = 1" ); } diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-with-x-kotlin-implements.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-with-x-kotlin-implements.yaml new file mode 100644 index 00000000000..b54ec0cd53e --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-with-x-kotlin-implements.yaml @@ -0,0 +1,646 @@ +openapi: 3.0.3 +info: + title: OpenAPI Petstore + version: 1.0.0 + description: > + This is a sample server Petstore server. + For this sample, you can use the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html +servers: + - url: https://petstore.swagger.io/v2 +tags: + - name: pet + description: Everything about your Pets + - name: store + description: Access to Petstore orders + - name: user + description: Operations about user + +paths: + /pet: + post: + tags: + - pet + summary: Add a new pet to the store + operationId: addPet + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + put: + tags: + - pet + summary: Update an existing pet + operationId: updatePet + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + responses: + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + /pet/findByStatus: + get: + tags: + - pet + summary: Finds Pets by status + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - name: status + in: query + description: Status values that need to be considered for filter + required: true + schema: + type: array + items: + type: string + enum: + - available + - pending + - sold + default: [ available ] + style: form + explode: false + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + /pet/findByTags: + get: + tags: + - pet + summary: Finds Pets by tags + description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - name: tags + in: query + description: Tags to filter by + required: true + schema: + type: array + items: + type: string + style: form + explode: false + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + /pet/{petId}: + get: + tags: + - pet + summary: Find pet by ID + description: Returns a single pet + operationId: getPetById + parameters: + - name: petId + in: path + description: ID of pet to return + required: true + schema: + type: integer + format: int64 + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [ ] + post: + tags: + - pet + summary: Updates a pet in the store with form data + operationId: updatePetWithForm + requestBody: + required: false + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + name: + type: string + description: Updated name of the pet + status: + type: string + description: Updated status of the pet + parameters: + - name: petId + in: path + description: ID of pet that needs to be updated + required: true + schema: + type: integer + format: int64 + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + delete: + tags: + - pet + summary: Deletes a pet + operationId: deletePet + parameters: + - name: petId + in: path + description: Pet id to delete + required: true + schema: + type: integer + format: int64 + - name: api_key + in: header + required: false + schema: + type: string + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + /pet/{petId}/uploadImage: + post: + tags: + - pet + summary: Uploads an image + operationId: uploadFile + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + schema: + type: integer + format: int64 + requestBody: + required: false + content: + multipart/form-data: + schema: + type: object + properties: + additionalMetadata: + type: string + file: + type: string + format: binary + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + security: + - petstore_auth: + - write:pets + - read:pets + /store/inventory: + get: + tags: + - store + summary: Returns pet inventories by status + operationId: getInventory + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: object + additionalProperties: + type: integer + format: int32 + security: + - api_key: [ ] + /store/order: + post: + tags: + - store + summary: Place an order for a pet + operationId: placeOrder + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + '400': + description: Invalid Order + /store/order/{orderId}: + get: + tags: + - store + summary: Find purchase order by ID + operationId: getOrderById + parameters: + - name: orderId + in: path + required: true + schema: + type: integer + minimum: 1 + maximum: 5 + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + '400': + description: Invalid ID supplied + '404': + description: Order not found + delete: + tags: + - store + summary: Delete purchase order by ID + operationId: deleteOrder + parameters: + - name: orderId + in: path + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + /user: + post: + tags: + - user + summary: Create user + operationId: createUser + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/User' + responses: + '200': + description: successful operation + /user/createWithArray: + post: + tags: + - user + summary: Creates list of users with given input array + operationId: createUsersWithArrayInput + requestBody: + required: true + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/User' + responses: + '200': + description: successful operation + /user/createWithList: + post: + tags: + - user + summary: Creates list of users with given input array + operationId: createUsersWithListInput + requestBody: + required: true + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/User' + responses: + '200': + description: successful operation + /user/login: + get: + tags: + - user + summary: Logs user into the system + operationId: loginUser + parameters: + - name: username + in: query + required: true + schema: + type: string + - name: password + in: query + required: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + type: string + headers: + X-Rate-Limit: + schema: + type: integer + X-Expires-After: + schema: + type: string + '400': + description: Invalid username/password supplied + /user/logout: + get: + tags: + - user + summary: Logs out current logged in user session + operationId: logoutUser + responses: + '200': + description: successful operation + /user/{username}: + get: + tags: + - user + summary: Get user by user name + operationId: getUserByName + parameters: + - name: username + in: path + required: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/User' + '400': + description: Invalid username supplied + '404': + description: User not found + put: + tags: + - user + summary: Updated user + operationId: updateUser + parameters: + - name: username + in: path + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/User' + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + delete: + tags: + - user + summary: Delete user + operationId: deleteUser + parameters: + - name: username + in: path + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + +components: + securitySchemes: + petstore_auth: + type: oauth2 + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + api_key: + type: apiKey + name: api_key + in: header + schemas: + Pet: + type: object + discriminator: + propertyName: petType + mapping: + Dog: '#/components/schemas/Dog' + Cat: '#/components/schemas/Cat' + x-kotlin-implements: [ com.some.pack.Named, com.some.pack.WithCategory, com.some.pack.WithDefaultMethods ] + x-kotlin-implements-fields: [ name, category ] + required: + - name + - photoUrls + - petType + properties: + id: + type: integer + format: int64 + category: + $ref: '#/components/schemas/Category' + name: + type: string + photoUrls: + type: array + items: + type: string + tags: + type: array + items: + $ref: '#/components/schemas/Tag' + color: + $ref: '#/components/schemas/Color' + petType: + type: string + Dog: + allOf: + - $ref: '#/components/schemas/Pet' + x-kotlin-implements: [ com.some.pack.Fetchable ] + x-kotlin-implements-fields: [ likesFetch ] + properties: + bark: + type: boolean + breed: + type: string + enum: + - Dingo + - Husky + - Retriever + - Shepherd + likesFetch: + type: boolean + description: Whether the dog enjoys fetching + required: [ bark, breed, likesFetch ] + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Pet' + properties: + hunts: + type: boolean + age: + type: integer + type: object + Category: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + Tag: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + Color: + x-kotlin-implements: [ com.some.pack.WithDefaultMethods ] + type: string + enum: + - black + - white + - brown + - yellow + - violet + Order: + type: object + properties: + id: + type: integer + format: int64 + petId: + type: integer + format: int64 + quantity: + type: integer + format: int32 + shipDate: + type: string + format: date-time + status: + type: string + enum: + - placed + - approved + - delivered + complete: + type: boolean + default: false + User: + type: object + properties: + id: + type: integer + format: int64 + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + type: integer + format: int32 + ApiResponse: + type: object + properties: + code: + type: integer + format: int32 + type: + type: string + message: + type: string diff --git a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Category.kt index 2db415c931c..98a854a51b3 100644 --- a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Category.kt @@ -25,7 +25,7 @@ data class Category( @get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @get:JsonProperty("name") val name: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index bf5b0e47098..f520047d850 100644 --- a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -27,7 +27,7 @@ data class ModelApiResponse( @get:JsonProperty("type") val type: kotlin.String? = null, @get:JsonProperty("message") val message: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Order.kt index 8defd87ff6e..4ebe51e765e 100644 --- a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Order.kt @@ -38,7 +38,7 @@ data class Order( @get:JsonProperty("status") val status: Order.Status? = null, @get:JsonProperty("complete") val complete: kotlin.Boolean? = false - ) : Serializable{ +) : Serializable { /** * Order Status diff --git a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Pet.kt index 5ee645c0706..2f7be6be5ce 100644 --- a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Pet.kt @@ -43,7 +43,7 @@ data class Pet( @Deprecated(message = "") @get:JsonProperty("status") val status: Pet.Status? = null - ) : Serializable{ +) : Serializable { /** * pet status in the store diff --git a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Tag.kt index 4977cb04051..36f84160004 100644 --- a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/Tag.kt @@ -24,7 +24,7 @@ data class Tag( @get:JsonProperty("id") val id: kotlin.Long? = null, @get:JsonProperty("name") val name: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/User.kt index b6d34aa6f69..b04c9e31259 100644 --- a/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-spring-cloud/src/main/kotlin/org/openapitools/model/User.kt @@ -42,7 +42,7 @@ data class User( @get:JsonProperty("phone") val phone: kotlin.String? = null, @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Annotation.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Annotation.kt index abaf9f657c1..fbe2546e842 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Annotation.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Annotation.kt @@ -22,7 +22,7 @@ data class Annotation( @Schema(example = "null", description = "") @get:JsonProperty("id") val id: java.util.UUID? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPet.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPet.kt index a335ebada03..2e2b228abcb 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPet.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPet.kt @@ -79,7 +79,7 @@ data class AnyOfUserOrPet( @Schema(example = "null", description = "pet status in the store") @Deprecated(message = "") @get:JsonProperty("status") val status: AnyOfUserOrPet.Status? = null - ) { +) { /** * pet status in the store diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPetOrArrayString.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPetOrArrayString.kt index 4d5ace6c4f2..926a00f8a5e 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPetOrArrayString.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/AnyOfUserOrPetOrArrayString.kt @@ -79,7 +79,7 @@ data class AnyOfUserOrPetOrArrayString( @Schema(example = "null", description = "pet status in the store") @Deprecated(message = "") @get:JsonProperty("status") val status: AnyOfUserOrPetOrArrayString.Status? = null - ) { +) { /** * pet status in the store diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Category.kt index f64734a0fa2..4f5e1ae1bcd 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Category.kt @@ -27,7 +27,7 @@ data class Category( @get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @Schema(example = "null", description = "") @get:JsonProperty("name") val name: kotlin.String? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 130d334355e..29636f4bad1 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -30,7 +30,7 @@ data class ModelApiResponse( @Schema(example = "null", description = "") @get:JsonProperty("message") val message: kotlin.String? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Order.kt index e31b7557a27..5225690f54b 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Order.kt @@ -44,7 +44,7 @@ data class Order( @Schema(example = "null", description = "") @get:JsonProperty("complete") val complete: kotlin.Boolean? = false - ) { +) { /** * Order Status diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Pet.kt index 91067599fe2..963d5c05640 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Pet.kt @@ -49,7 +49,7 @@ data class Pet( @Schema(example = "null", description = "pet status in the store") @Deprecated(message = "") @get:JsonProperty("status") val status: Pet.Status? = null - ) { +) { /** * pet status in the store diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Tag.kt index b35add1c83a..179b6d27b5c 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/Tag.kt @@ -26,7 +26,7 @@ data class Tag( @Schema(example = "null", description = "") @get:JsonProperty("name") val name: kotlin.String? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/User.kt index 61339293a06..afae2dbbf1f 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/User.kt @@ -50,7 +50,7 @@ data class User( @Schema(example = "null", description = "User Status") @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/UserOrPet.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/UserOrPet.kt index 1f849c4fe6d..b4e44ad9fc3 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/UserOrPet.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/UserOrPet.kt @@ -79,7 +79,7 @@ data class UserOrPet( @Schema(example = "null", description = "pet status in the store") @Deprecated(message = "") @get:JsonProperty("status") val status: UserOrPet.Status? = null - ) { +) { /** * pet status in the store diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/UserOrPetOrArrayString.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/UserOrPetOrArrayString.kt index e1bb175af30..929d8d32d28 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/UserOrPetOrArrayString.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/model/UserOrPetOrArrayString.kt @@ -79,7 +79,7 @@ data class UserOrPetOrArrayString( @Schema(example = "null", description = "pet status in the store") @Deprecated(message = "") @get:JsonProperty("status") val status: UserOrPetOrArrayString.Status? = null - ) { +) { /** * pet status in the store diff --git a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Category.kt index d89e27f8954..50cfbcf8062 100644 --- a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Category.kt @@ -25,7 +25,7 @@ data class Category( @get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @get:JsonProperty("name") val name: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index d89135af2f8..4d12f23ba41 100644 --- a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -27,7 +27,7 @@ data class ModelApiResponse( @get:JsonProperty("type") val type: kotlin.String? = null, @get:JsonProperty("message") val message: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Order.kt index 619528dcea4..bee507c64e6 100644 --- a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Order.kt @@ -38,7 +38,7 @@ data class Order( @get:JsonProperty("status") val status: Order.Status? = null, @get:JsonProperty("complete") val complete: kotlin.Boolean? = false - ) : Serializable{ +) : Serializable { /** * Order Status diff --git a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Pet.kt index 24edd25b718..e78365b4781 100644 --- a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Pet.kt @@ -43,7 +43,7 @@ data class Pet( @Deprecated(message = "") @get:JsonProperty("status") val status: Pet.Status? = null - ) : Serializable{ +) : Serializable { /** * pet status in the store diff --git a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Tag.kt index 2093a67f4b3..bee0b3c419d 100644 --- a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/Tag.kt @@ -24,7 +24,7 @@ data class Tag( @get:JsonProperty("id") val id: kotlin.Long? = null, @get:JsonProperty("name") val name: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/User.kt index cefb33522a3..df4b7c3b588 100644 --- a/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/model/User.kt @@ -42,7 +42,7 @@ data class User( @get:JsonProperty("phone") val phone: kotlin.String? = null, @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot-bigdecimal-default/src/main/kotlin/org/openapitools/model/Apa.kt b/samples/server/petstore/kotlin-springboot-bigdecimal-default/src/main/kotlin/org/openapitools/model/Apa.kt index c9bbcb4c0d1..1277bb02978 100644 --- a/samples/server/petstore/kotlin-springboot-bigdecimal-default/src/main/kotlin/org/openapitools/model/Apa.kt +++ b/samples/server/petstore/kotlin-springboot-bigdecimal-default/src/main/kotlin/org/openapitools/model/Apa.kt @@ -43,7 +43,7 @@ data class Apa( @Schema(example = "null", description = "") @get:JsonProperty("gepa") val gepa: java.math.BigDecimal? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Category.kt index ad519ddd263..fe6df76075e 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Category.kt @@ -27,7 +27,7 @@ data class Category( @get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @Schema(example = "null", description = "") @get:JsonProperty("name") val name: kotlin.String? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index fddef14ee1f..5c9e5e3de7f 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -30,7 +30,7 @@ data class ModelApiResponse( @Schema(example = "null", description = "") @get:JsonProperty("message") val message: kotlin.String? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Order.kt index 49619dcb854..f6fd42546c7 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Order.kt @@ -44,7 +44,7 @@ data class Order( @Schema(example = "null", description = "") @get:JsonProperty("complete") val complete: kotlin.Boolean? = false - ) { +) { /** * Order Status diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Pet.kt index fbf16ce5bbc..a107c48f16b 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Pet.kt @@ -49,7 +49,7 @@ data class Pet( @Schema(example = "null", description = "pet status in the store") @Deprecated(message = "") @get:JsonProperty("status") val status: Pet.Status? = null - ) { +) { /** * pet status in the store diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Tag.kt index 6a26ec198dd..73b86b861f5 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/Tag.kt @@ -26,7 +26,7 @@ data class Tag( @Schema(example = "null", description = "") @get:JsonProperty("name") val name: kotlin.String? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/User.kt index 1bdef782439..14ce728a1e4 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/model/User.kt @@ -50,7 +50,7 @@ data class User( @Schema(example = "null", description = "User Status") @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Category.kt index f64734a0fa2..4f5e1ae1bcd 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Category.kt @@ -27,7 +27,7 @@ data class Category( @get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @Schema(example = "null", description = "") @get:JsonProperty("name") val name: kotlin.String? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 130d334355e..29636f4bad1 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -30,7 +30,7 @@ data class ModelApiResponse( @Schema(example = "null", description = "") @get:JsonProperty("message") val message: kotlin.String? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Order.kt index e31b7557a27..5225690f54b 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Order.kt @@ -44,7 +44,7 @@ data class Order( @Schema(example = "null", description = "") @get:JsonProperty("complete") val complete: kotlin.Boolean? = false - ) { +) { /** * Order Status diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Pet.kt index 91067599fe2..963d5c05640 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Pet.kt @@ -49,7 +49,7 @@ data class Pet( @Schema(example = "null", description = "pet status in the store") @Deprecated(message = "") @get:JsonProperty("status") val status: Pet.Status? = null - ) { +) { /** * pet status in the store diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Tag.kt index b35add1c83a..179b6d27b5c 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/Tag.kt @@ -26,7 +26,7 @@ data class Tag( @Schema(example = "null", description = "") @get:JsonProperty("name") val name: kotlin.String? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/User.kt index b8612151182..c51087a6f57 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/model/User.kt @@ -50,7 +50,7 @@ data class User( @Schema(example = "null", description = "User Status") @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-integer-enum/src/main/kotlin/org/openapitools/model/ApiError.kt b/samples/server/petstore/kotlin-springboot-integer-enum/src/main/kotlin/org/openapitools/model/ApiError.kt index 07180a007ac..b4c348328e4 100644 --- a/samples/server/petstore/kotlin-springboot-integer-enum/src/main/kotlin/org/openapitools/model/ApiError.kt +++ b/samples/server/petstore/kotlin-springboot-integer-enum/src/main/kotlin/org/openapitools/model/ApiError.kt @@ -27,7 +27,7 @@ data class ApiError( @field:Valid @get:JsonProperty("reasonCode") val reasonCode: ReasonCode? = null - ) { +) { /** * diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Category.kt index c461236ba92..5df427d7579 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Category.kt @@ -27,7 +27,7 @@ data class Category( @Schema(example = "null", description = "") @get:JsonProperty("name") var name: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 1b0e48b1b18..e504e4f5221 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -31,7 +31,7 @@ data class ModelApiResponse( @Schema(example = "null", description = "") @get:JsonProperty("message") var message: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Order.kt index 7eda583a9aa..e75d0e40cdc 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Order.kt @@ -45,7 +45,7 @@ data class Order( @Schema(example = "null", description = "") @get:JsonProperty("complete") var complete: kotlin.Boolean? = false - ) : Serializable{ +) : Serializable { /** * Order Status diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Pet.kt index 2d8a9e61455..7f59bf951d8 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Pet.kt @@ -49,7 +49,7 @@ data class Pet( @Schema(example = "null", description = "pet status in the store") @get:JsonProperty("status") var status: Pet.Status? = null - ) : Serializable{ +) : Serializable { /** * pet status in the store diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Tag.kt index 22870b8f00b..fc7c99144ca 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/Tag.kt @@ -27,7 +27,7 @@ data class Tag( @Schema(example = "null", description = "") @get:JsonProperty("name") var name: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/User.kt index ad66ce80c7c..acf3fff184a 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/model/User.kt @@ -51,7 +51,7 @@ data class User( @Schema(example = "null", description = "User Status") @get:JsonProperty("userStatus") var userStatus: kotlin.Int? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot-multipart-request-model/src/main/kotlin/org/openapitools/model/MultipartMixedRequestMarker.kt b/samples/server/petstore/kotlin-springboot-multipart-request-model/src/main/kotlin/org/openapitools/model/MultipartMixedRequestMarker.kt index 284dcac560f..ec1d852f4e9 100644 --- a/samples/server/petstore/kotlin-springboot-multipart-request-model/src/main/kotlin/org/openapitools/model/MultipartMixedRequestMarker.kt +++ b/samples/server/petstore/kotlin-springboot-multipart-request-model/src/main/kotlin/org/openapitools/model/MultipartMixedRequestMarker.kt @@ -22,7 +22,7 @@ data class MultipartMixedRequestMarker( @Schema(example = "null", description = "") @get:JsonProperty("name") val name: kotlin.String? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Category.kt index f64734a0fa2..4f5e1ae1bcd 100644 --- a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Category.kt @@ -27,7 +27,7 @@ data class Category( @get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @Schema(example = "null", description = "") @get:JsonProperty("name") val name: kotlin.String? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 130d334355e..29636f4bad1 100644 --- a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -30,7 +30,7 @@ data class ModelApiResponse( @Schema(example = "null", description = "") @get:JsonProperty("message") val message: kotlin.String? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Order.kt index e31b7557a27..5225690f54b 100644 --- a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Order.kt @@ -44,7 +44,7 @@ data class Order( @Schema(example = "null", description = "") @get:JsonProperty("complete") val complete: kotlin.Boolean? = false - ) { +) { /** * Order Status diff --git a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Pet.kt index 91067599fe2..963d5c05640 100644 --- a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Pet.kt @@ -49,7 +49,7 @@ data class Pet( @Schema(example = "null", description = "pet status in the store") @Deprecated(message = "") @get:JsonProperty("status") val status: Pet.Status? = null - ) { +) { /** * pet status in the store diff --git a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Tag.kt index b35add1c83a..179b6d27b5c 100644 --- a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/Tag.kt @@ -26,7 +26,7 @@ data class Tag( @Schema(example = "null", description = "") @get:JsonProperty("name") val name: kotlin.String? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/User.kt index b8612151182..c51087a6f57 100644 --- a/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-reactive-without-flow/src/main/kotlin/org/openapitools/model/User.kt @@ -50,7 +50,7 @@ data class User( @Schema(example = "null", description = "User Status") @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt index f64734a0fa2..4f5e1ae1bcd 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt @@ -27,7 +27,7 @@ data class Category( @get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @Schema(example = "null", description = "") @get:JsonProperty("name") val name: kotlin.String? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 130d334355e..29636f4bad1 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -30,7 +30,7 @@ data class ModelApiResponse( @Schema(example = "null", description = "") @get:JsonProperty("message") val message: kotlin.String? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt index e31b7557a27..5225690f54b 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt @@ -44,7 +44,7 @@ data class Order( @Schema(example = "null", description = "") @get:JsonProperty("complete") val complete: kotlin.Boolean? = false - ) { +) { /** * Order Status diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt index 91067599fe2..963d5c05640 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt @@ -49,7 +49,7 @@ data class Pet( @Schema(example = "null", description = "pet status in the store") @Deprecated(message = "") @get:JsonProperty("status") val status: Pet.Status? = null - ) { +) { /** * pet status in the store diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt index b35add1c83a..179b6d27b5c 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt @@ -26,7 +26,7 @@ data class Tag( @Schema(example = "null", description = "") @get:JsonProperty("name") val name: kotlin.String? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt index b8612151182..c51087a6f57 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt @@ -50,7 +50,7 @@ data class User( @Schema(example = "null", description = "User Status") @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Animal.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Animal.kt index aab459aa9b9..c65f0ca8ac6 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Animal.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Animal.kt @@ -32,7 +32,7 @@ import io.swagger.v3.oas.annotations.media.Schema JsonSubTypes.Type(value = Dog::class, name = "DOG") ) -interface Animal{ +interface Animal { @get:Schema(example = "null", requiredMode = Schema.RequiredMode.REQUIRED, description = "") val className: kotlin.String diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Cat.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Cat.kt index 99bd7012b47..55337a40dfc 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Cat.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Cat.kt @@ -29,7 +29,7 @@ data class Cat( @Schema(example = "null", description = "") @get:JsonProperty("color") override val color: kotlin.String? = "red" - ) : Animal{ +) : Animal { } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Category.kt index 3836efee92f..a900b026763 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Category.kt @@ -26,7 +26,7 @@ data class Category( @Schema(example = "null", description = "") @get:JsonProperty("id") val id: kotlin.Long? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Client.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Client.kt index c56244d6188..c235e7f12d1 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Client.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Client.kt @@ -22,7 +22,7 @@ data class Client( @Schema(example = "null", description = "") @get:JsonProperty("client") val client: kotlin.String? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Dog.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Dog.kt index 77f347e6767..62085ab06df 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Dog.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Dog.kt @@ -29,7 +29,7 @@ data class Dog( @Schema(example = "null", description = "") @get:JsonProperty("color") override val color: kotlin.String? = "red" - ) : Animal{ +) : Animal { } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Foo.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Foo.kt index 99d69f31d3b..04e8d84844d 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Foo.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Foo.kt @@ -22,7 +22,7 @@ data class Foo( @Schema(example = "null", description = "") @get:JsonProperty("bar") val bar: kotlin.String? = "bar" - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/FooGetDefaultResponse.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/FooGetDefaultResponse.kt index e03f6782477..8b422b6fd29 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/FooGetDefaultResponse.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/FooGetDefaultResponse.kt @@ -24,7 +24,7 @@ data class FooGetDefaultResponse( @field:Valid @Schema(example = "null", description = "") @get:JsonProperty("string") val string: Foo? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index b0db805428c..e2594ffae0e 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -30,7 +30,7 @@ data class ModelApiResponse( @Schema(example = "null", description = "") @get:JsonProperty("message") val message: kotlin.String? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Order.kt index 708b8b64632..5f4608b1f49 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Order.kt @@ -44,7 +44,7 @@ data class Order( @Schema(example = "null", description = "") @get:JsonProperty("complete") val complete: kotlin.Boolean? = false - ) { +) { /** * Order Status diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Pet.kt index 6b7e81e01bc..0683dc03dd0 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Pet.kt @@ -48,7 +48,7 @@ data class Pet( @Schema(example = "null", description = "pet status in the store") @get:JsonProperty("status") val status: Pet.Status? = null - ) { +) { /** * pet status in the store diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Tag.kt index dd4c06abce8..4a9ea5f1f25 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/Tag.kt @@ -26,7 +26,7 @@ data class Tag( @Schema(example = "null", description = "") @get:JsonProperty("name") val name: kotlin.String? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/User.kt index bb4d0432632..8b13675d3db 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/model/User.kt @@ -50,7 +50,7 @@ data class User( @Schema(example = "null", description = "User Status") @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null - ) { +) { } diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Category.kt index b6e8ca66c8e..8514f2c8ba0 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Category.kt @@ -27,7 +27,7 @@ data class Category( @ApiModelProperty(example = "null", value = "") @get:JsonProperty("name") val name: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 8ee88bf1f62..58be39aeacf 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -31,7 +31,7 @@ data class ModelApiResponse( @ApiModelProperty(example = "null", value = "") @get:JsonProperty("message") val message: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Order.kt index 71928c0744b..c67dc14ec91 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Order.kt @@ -45,7 +45,7 @@ data class Order( @ApiModelProperty(example = "null", value = "") @get:JsonProperty("complete") val complete: kotlin.Boolean? = false - ) : Serializable{ +) : Serializable { /** * Order Status diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Pet.kt index baa07eec045..0303d2d9d3d 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Pet.kt @@ -49,7 +49,7 @@ data class Pet( @ApiModelProperty(example = "null", value = "pet status in the store") @get:JsonProperty("status") val status: Pet.Status? = null - ) : Serializable{ +) : Serializable { /** * pet status in the store diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Tag.kt index 6319ca0bdc5..d8a5928093c 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/Tag.kt @@ -27,7 +27,7 @@ data class Tag( @ApiModelProperty(example = "null", value = "") @get:JsonProperty("name") val name: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/User.kt index d95fc35c473..8d982852e32 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/model/User.kt @@ -51,7 +51,7 @@ data class User( @ApiModelProperty(example = "null", value = "User Status") @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Category.kt index d7a49f7938f..90635595b37 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Category.kt @@ -27,7 +27,7 @@ data class Category( @Schema(example = "null", description = "") @get:JsonProperty("name") val name: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index ee2151c581c..331d9196ed7 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -31,7 +31,7 @@ data class ModelApiResponse( @Schema(example = "null", description = "") @get:JsonProperty("message") val message: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Order.kt index 67cafde7e75..3453faf1bae 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Order.kt @@ -45,7 +45,7 @@ data class Order( @Schema(example = "null", description = "") @get:JsonProperty("complete") val complete: kotlin.Boolean? = false - ) : Serializable{ +) : Serializable { /** * Order Status diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Pet.kt index b0a8c220d18..28a0e7e268f 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Pet.kt @@ -49,7 +49,7 @@ data class Pet( @Schema(example = "null", description = "pet status in the store") @get:JsonProperty("status") val status: Pet.Status? = null - ) : Serializable{ +) : Serializable { /** * pet status in the store diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Tag.kt index 8166a76dd54..ef9382e70b5 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/Tag.kt @@ -27,7 +27,7 @@ data class Tag( @Schema(example = "null", description = "") @get:JsonProperty("name") val name: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/User.kt index 6c6448ebe1d..a88450a17f8 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/model/User.kt @@ -51,7 +51,7 @@ data class User( @Schema(example = "null", description = "User Status") @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Category.kt index b6e8ca66c8e..8514f2c8ba0 100644 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Category.kt @@ -27,7 +27,7 @@ data class Category( @ApiModelProperty(example = "null", value = "") @get:JsonProperty("name") val name: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 8ee88bf1f62..58be39aeacf 100644 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -31,7 +31,7 @@ data class ModelApiResponse( @ApiModelProperty(example = "null", value = "") @get:JsonProperty("message") val message: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Order.kt index 71928c0744b..c67dc14ec91 100644 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Order.kt @@ -45,7 +45,7 @@ data class Order( @ApiModelProperty(example = "null", value = "") @get:JsonProperty("complete") val complete: kotlin.Boolean? = false - ) : Serializable{ +) : Serializable { /** * Order Status diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Pet.kt index baa07eec045..0303d2d9d3d 100644 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Pet.kt @@ -49,7 +49,7 @@ data class Pet( @ApiModelProperty(example = "null", value = "pet status in the store") @get:JsonProperty("status") val status: Pet.Status? = null - ) : Serializable{ +) : Serializable { /** * pet status in the store diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Tag.kt index 6319ca0bdc5..d8a5928093c 100644 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/Tag.kt @@ -27,7 +27,7 @@ data class Tag( @ApiModelProperty(example = "null", value = "") @get:JsonProperty("name") val name: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/User.kt index d95fc35c473..8d982852e32 100644 --- a/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/model/User.kt @@ -51,7 +51,7 @@ data class User( @ApiModelProperty(example = "null", value = "User Status") @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/.openapi-generator-ignore b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/.openapi-generator/FILES b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/.openapi-generator/FILES new file mode 100644 index 00000000000..59aed4399e9 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/.openapi-generator/FILES @@ -0,0 +1,23 @@ +README.md +build.gradle.kts +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +pom.xml +settings.gradle +src/main/kotlin/org/openapitools/api/ApiUtil.kt +src/main/kotlin/org/openapitools/api/Exceptions.kt +src/main/kotlin/org/openapitools/api/PetApi.kt +src/main/kotlin/org/openapitools/api/StoreApi.kt +src/main/kotlin/org/openapitools/api/UserApi.kt +src/main/kotlin/org/openapitools/configuration/EnumConverterConfiguration.kt +src/main/kotlin/org/openapitools/model/Cat.kt +src/main/kotlin/org/openapitools/model/Category.kt +src/main/kotlin/org/openapitools/model/Color.kt +src/main/kotlin/org/openapitools/model/Dog.kt +src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +src/main/kotlin/org/openapitools/model/Order.kt +src/main/kotlin/org/openapitools/model/Pet.kt +src/main/kotlin/org/openapitools/model/Tag.kt +src/main/kotlin/org/openapitools/model/User.kt diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/.openapi-generator/VERSION b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/.openapi-generator/VERSION new file mode 100644 index 00000000000..5e528295308 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.16.0-SNAPSHOT diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/README.md b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/README.md new file mode 100644 index 00000000000..b6865a08113 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/README.md @@ -0,0 +1,21 @@ +# openAPIPetstore + +This Kotlin based [Spring Boot](https://spring.io/projects/spring-boot) application has been generated using the [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator). + +## Getting Started + +This document assumes you have either maven or gradle available, either via the wrapper or otherwise. This does not come with a gradle / maven wrapper checked in. + +By default a [`pom.xml`](pom.xml) file will be generated. If you specified `gradleBuildFile=true` when generating this project, a `build.gradle.kts` will also be generated. Note this uses [Gradle Kotlin DSL](https://github.com/gradle/kotlin-dsl). + +To build the project using maven, run: +```bash +mvn package && java -jar target/openapi-spring-1.0.0.jar +``` + +To build the project using gradle, run: +```bash +gradle build && java -jar build/libs/openapi-spring-1.0.0.jar +``` + +If all builds successfully, the server should run on [http://localhost:8080/](http://localhost:8080/) diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/build.gradle.kts b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/build.gradle.kts new file mode 100644 index 00000000000..d1c663986d7 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/build.gradle.kts @@ -0,0 +1,52 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.6.7") + } +} + +group = "org.openapitools" +version = "1.0.0" + +repositories { + mavenCentral() +} + +tasks.withType { + kotlinOptions.jvmTarget = "1.8" +} + +tasks.bootJar { + enabled = false +} + +plugins { + val kotlinVersion = "1.9.25" + id("org.jetbrains.kotlin.jvm") version kotlinVersion + id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion + id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion + id("org.springframework.boot") version "2.6.7" + id("io.spring.dependency-management") version "1.0.11.RELEASE" +} + +dependencies { + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") + implementation("org.jetbrains.kotlin:kotlin-reflect") + implementation("org.springframework.boot:spring-boot-starter-web") + + implementation("com.google.code.findbugs:jsr305:3.0.2") + implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml") + implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml") + implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310") + implementation("com.fasterxml.jackson.module:jackson-module-kotlin") + implementation("javax.validation:validation-api") + implementation("javax.annotation:javax.annotation-api:1.3.2") + testImplementation("org.jetbrains.kotlin:kotlin-test-junit5") + testImplementation("org.springframework.boot:spring-boot-starter-test") { + exclude(module = "junit") + } +} diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/gradle/wrapper/gradle-wrapper.jar b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000000..e6441136f3d Binary files /dev/null and b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/gradle/wrapper/gradle-wrapper.properties b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000000..80187ac3043 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/gradlew b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/gradlew new file mode 100644 index 00000000000..9d0ce634cb1 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/gradlew.bat b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/gradlew.bat new file mode 100644 index 00000000000..25da30dbdee --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/pom.xml b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/pom.xml new file mode 100644 index 00000000000..852c00952ba --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/pom.xml @@ -0,0 +1,131 @@ + + 4.0.0 + org.openapitools + openapi-spring + jar + openapi-spring + 1.0.0 + + 3.0.2 + 1.3.2 + 1.6.21 + + 1.6.21 + UTF-8 + + + org.springframework.boot + spring-boot-starter-parent + 2.7.15 + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/test/kotlin + + + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + + jar + + + + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${kotlin.version} + + + spring + + 1.8 + + + + compile + compile + + compile + + + + test-compile + test-compile + + test-compile + + + + + + org.jetbrains.kotlin + kotlin-maven-allopen + ${kotlin.version} + + + + + + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + org.jetbrains.kotlin + kotlin-reflect + ${kotlin.version} + + + org.springframework.boot + spring-boot-starter-web + + + + + + + com.google.code.findbugs + jsr305 + ${findbugs-jsr305.version} + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + com.fasterxml.jackson.module + jackson-module-kotlin + + + + javax.validation + validation-api + + + javax.annotation + javax.annotation-api + ${javax-annotation.version} + provided + + + org.jetbrains.kotlin + kotlin-test-junit5 + ${kotlin-test-junit5.version} + test + + + diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/settings.gradle b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/settings.gradle new file mode 100644 index 00000000000..14844905cd4 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/settings.gradle @@ -0,0 +1,15 @@ +pluginManagement { + repositories { + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } + gradlePluginPortal() + } + resolutionStrategy { + eachPlugin { + if (requested.id.id == "org.springframework.boot") { + useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}") + } + } + } +} +rootProject.name = "openapi-spring" diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/com/some/pack/Fetchable.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/com/some/pack/Fetchable.kt new file mode 100644 index 00000000000..b8680298a11 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/com/some/pack/Fetchable.kt @@ -0,0 +1,6 @@ +package com.some.pack + +interface Fetchable { + + val likesFetch: Boolean +} \ No newline at end of file diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/com/some/pack/Named.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/com/some/pack/Named.kt new file mode 100644 index 00000000000..2107a848740 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/com/some/pack/Named.kt @@ -0,0 +1,6 @@ +package com.some.pack + +interface Named { + + val name: String +} \ No newline at end of file diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/com/some/pack/WithCategory.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/com/some/pack/WithCategory.kt new file mode 100644 index 00000000000..6689da89888 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/com/some/pack/WithCategory.kt @@ -0,0 +1,6 @@ +package com.some.pack + +interface WithCategory { + + val category: org.openapitools.model.Category? +} \ No newline at end of file diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/com/some/pack/WithDefaultMethods.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/com/some/pack/WithDefaultMethods.kt new file mode 100644 index 00000000000..34acc951357 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/com/some/pack/WithDefaultMethods.kt @@ -0,0 +1,12 @@ +package com.some.pack + +interface WithDefaultMethods { + + fun defaultMethodOne(): String { + return "defaultOne" + } + + fun defaultMethodTwo(): Int { + return 2 + } +} \ No newline at end of file diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/api/ApiUtil.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/api/ApiUtil.kt new file mode 100644 index 00000000000..88e892d0f49 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/api/ApiUtil.kt @@ -0,0 +1,19 @@ +package org.openapitools.api + +import org.springframework.web.context.request.NativeWebRequest + +import javax.servlet.http.HttpServletResponse +import java.io.IOException + +object ApiUtil { + fun setExampleResponse(req: NativeWebRequest, contentType: String, example: String) { + try { + val res = req.getNativeResponse(HttpServletResponse::class.java) + res?.characterEncoding = "UTF-8" + res?.addHeader("Content-Type", contentType) + res?.writer?.print(example) + } catch (e: IOException) { + throw RuntimeException(e) + } + } +} diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/api/Exceptions.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/api/Exceptions.kt new file mode 100644 index 00000000000..901db1237ee --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/api/Exceptions.kt @@ -0,0 +1,30 @@ +package org.openapitools.api + +import org.springframework.context.annotation.Configuration +import org.springframework.http.HttpStatus +import org.springframework.web.bind.annotation.ControllerAdvice +import org.springframework.web.bind.annotation.ExceptionHandler +import javax.servlet.http.HttpServletResponse +import javax.validation.ConstraintViolationException + +// TODO Extend ApiException for custom exception handling, e.g. the below NotFound exception +sealed class ApiException(msg: String, val code: Int) : Exception(msg) + +class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code) + +@Configuration("org.openapitools.api.DefaultExceptionHandler") +@ControllerAdvice +class DefaultExceptionHandler { + + @ExceptionHandler(value = [ApiException::class]) + fun onApiException(ex: ApiException, response: HttpServletResponse): Unit = + response.sendError(ex.code, ex.message) + + @ExceptionHandler(value = [NotImplementedError::class]) + fun onNotImplemented(ex: NotImplementedError, response: HttpServletResponse): Unit = + response.sendError(HttpStatus.NOT_IMPLEMENTED.value()) + + @ExceptionHandler(value = [ConstraintViolationException::class]) + fun onConstraintViolation(ex: ConstraintViolationException, response: HttpServletResponse): Unit = + response.sendError(HttpStatus.BAD_REQUEST.value(), ex.constraintViolations.joinToString(", ") { it.message }) +} diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/api/PetApi.kt new file mode 100644 index 00000000000..9c9c038b48f --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -0,0 +1,99 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.16.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. +*/ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity + +import org.springframework.web.bind.annotation.* +import org.springframework.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +import kotlin.collections.List +import kotlin.collections.Map + +@RestController +@Validated +interface PetApi { + + + @RequestMapping( + method = [RequestMethod.POST], + value = ["/pet"], + consumes = ["application/json"] + ) + fun addPet( @Valid @RequestBody pet: Pet): ResponseEntity + + + @RequestMapping( + method = [RequestMethod.DELETE], + value = ["/pet/{petId}"] + ) + fun deletePet( @PathVariable("petId") petId: kotlin.Long, @RequestHeader(value = "api_key", required = false) apiKey: kotlin.String?): ResponseEntity + + + @RequestMapping( + method = [RequestMethod.GET], + value = ["/pet/findByStatus"], + produces = ["application/json"] + ) + fun findPetsByStatus(@NotNull @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List): ResponseEntity> + + + @RequestMapping( + method = [RequestMethod.GET], + value = ["/pet/findByTags"], + produces = ["application/json"] + ) + fun findPetsByTags(@NotNull @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List): ResponseEntity> + + + @RequestMapping( + method = [RequestMethod.GET], + value = ["/pet/{petId}"], + produces = ["application/json"] + ) + fun getPetById( @PathVariable("petId") petId: kotlin.Long): ResponseEntity + + + @RequestMapping( + method = [RequestMethod.PUT], + value = ["/pet"], + consumes = ["application/json"] + ) + fun updatePet( @Valid @RequestBody pet: Pet): ResponseEntity + + + @RequestMapping( + method = [RequestMethod.POST], + value = ["/pet/{petId}"], + consumes = ["application/x-www-form-urlencoded"] + ) + fun updatePetWithForm( @PathVariable("petId") petId: kotlin.Long, @Valid @RequestParam(value = "name", required = false) name: kotlin.String? , @Valid @RequestParam(value = "status", required = false) status: kotlin.String? ): ResponseEntity + + + @RequestMapping( + method = [RequestMethod.POST], + value = ["/pet/{petId}/uploadImage"], + produces = ["application/json"], + consumes = ["multipart/form-data"] + ) + fun uploadFile( @PathVariable("petId") petId: kotlin.Long, @Valid @RequestParam(value = "additionalMetadata", required = false) additionalMetadata: kotlin.String? , @Valid @RequestPart("file", required = false) file: org.springframework.web.multipart.MultipartFile?): ResponseEntity +} diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/api/StoreApi.kt new file mode 100644 index 00000000000..7e1cabcb257 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -0,0 +1,66 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.16.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. +*/ +package org.openapitools.api + +import org.openapitools.model.Order +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity + +import org.springframework.web.bind.annotation.* +import org.springframework.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +import kotlin.collections.List +import kotlin.collections.Map + +@RestController +@Validated +interface StoreApi { + + + @RequestMapping( + method = [RequestMethod.DELETE], + value = ["/store/order/{orderId}"] + ) + fun deleteOrder( @PathVariable("orderId") orderId: kotlin.String): ResponseEntity + + + @RequestMapping( + method = [RequestMethod.GET], + value = ["/store/inventory"], + produces = ["application/json"] + ) + fun getInventory(): ResponseEntity> + + + @RequestMapping( + method = [RequestMethod.GET], + value = ["/store/order/{orderId}"], + produces = ["application/json"] + ) + fun getOrderById(@Min(1) @Max(5) @PathVariable("orderId") orderId: kotlin.Int): ResponseEntity + + + @RequestMapping( + method = [RequestMethod.POST], + value = ["/store/order"], + produces = ["application/json"], + consumes = ["application/json"] + ) + fun placeOrder( @Valid @RequestBody order: Order): ResponseEntity +} diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/api/UserApi.kt new file mode 100644 index 00000000000..3ff8e2a94ea --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -0,0 +1,96 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.16.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. +*/ +package org.openapitools.api + +import org.openapitools.model.User +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity + +import org.springframework.web.bind.annotation.* +import org.springframework.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +import kotlin.collections.List +import kotlin.collections.Map + +@RestController +@Validated +interface UserApi { + + + @RequestMapping( + method = [RequestMethod.POST], + value = ["/user"], + consumes = ["application/json"] + ) + fun createUser( @Valid @RequestBody user: User): ResponseEntity + + + @RequestMapping( + method = [RequestMethod.POST], + value = ["/user/createWithArray"], + consumes = ["application/json"] + ) + fun createUsersWithArrayInput( @Valid @RequestBody user: kotlin.collections.List): ResponseEntity + + + @RequestMapping( + method = [RequestMethod.POST], + value = ["/user/createWithList"], + consumes = ["application/json"] + ) + fun createUsersWithListInput( @Valid @RequestBody user: kotlin.collections.List): ResponseEntity + + + @RequestMapping( + method = [RequestMethod.DELETE], + value = ["/user/{username}"] + ) + fun deleteUser( @PathVariable("username") username: kotlin.String): ResponseEntity + + + @RequestMapping( + method = [RequestMethod.GET], + value = ["/user/{username}"], + produces = ["application/json"] + ) + fun getUserByName( @PathVariable("username") username: kotlin.String): ResponseEntity + + + @RequestMapping( + method = [RequestMethod.GET], + value = ["/user/login"], + produces = ["application/json"] + ) + fun loginUser(@NotNull @Valid @RequestParam(value = "username", required = true) username: kotlin.String,@NotNull @Valid @RequestParam(value = "password", required = true) password: kotlin.String): ResponseEntity + + + @RequestMapping( + method = [RequestMethod.GET], + value = ["/user/logout"] + ) + fun logoutUser(): ResponseEntity + + + @RequestMapping( + method = [RequestMethod.PUT], + value = ["/user/{username}"], + consumes = ["application/json"] + ) + fun updateUser( @PathVariable("username") username: kotlin.String, @Valid @RequestBody user: User): ResponseEntity +} diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/configuration/EnumConverterConfiguration.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/configuration/EnumConverterConfiguration.kt new file mode 100644 index 00000000000..20229410386 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/configuration/EnumConverterConfiguration.kt @@ -0,0 +1,26 @@ +package org.openapitools.configuration + +import org.openapitools.model.Color + +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Configuration +import org.springframework.core.convert.converter.Converter + +/** + * This class provides Spring Converter beans for the enum models in the OpenAPI specification. + * + * By default, Spring only converts primitive types to enums using Enum::valueOf, which can prevent + * correct conversion if the OpenAPI specification is using an `enumPropertyNaming` other than + * `original` or the specification has an integer enum. + */ +@Configuration(value = "org.openapitools.configuration.enumConverterConfiguration") +class EnumConverterConfiguration { + + @Bean(name = ["org.openapitools.configuration.EnumConverterConfiguration.colorConverter"]) + fun colorConverter(): Converter { + return object: Converter { + override fun convert(source: kotlin.String): Color = Color.forValue(source) + } + } + +} diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Cat.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Cat.kt new file mode 100644 index 00000000000..147ed4ff31a --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Cat.kt @@ -0,0 +1,56 @@ +package org.openapitools.model + +import java.util.Locale +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonValue +import org.openapitools.model.Category +import org.openapitools.model.Color +import org.openapitools.model.Pet +import org.openapitools.model.Tag +import java.io.Serializable +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +/** + * + * @param hunts + * @param age + */ +data class Cat( + + @get:JsonProperty("name", required = true) override val name: kotlin.String, + + @get:JsonProperty("photoUrls", required = true) override val photoUrls: kotlin.collections.List, + + @get:JsonProperty("petType", required = true) override val petType: kotlin.String, + + @get:JsonProperty("hunts") val hunts: kotlin.Boolean? = null, + + @get:JsonProperty("age") val age: kotlin.Int? = null, + + @get:JsonProperty("id") override val id: kotlin.Long? = null, + + @field:Valid + @get:JsonProperty("category") override val category: Category? = null, + + @field:Valid + @get:JsonProperty("tags") override val tags: kotlin.collections.List? = null, + + @field:Valid + @get:JsonProperty("color") override val color: Color? = null +) : Pet, Serializable { + + companion object { + private const val serialVersionUID: kotlin.Long = 1 + } +} + diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Category.kt new file mode 100644 index 00000000000..f98ea616ec2 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Category.kt @@ -0,0 +1,33 @@ +package org.openapitools.model + +import java.util.Locale +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import java.io.Serializable +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +/** + * + * @param id + * @param name + */ +data class Category( + + @get:JsonProperty("id") val id: kotlin.Long? = null, + + @get:JsonProperty("name") val name: kotlin.String? = null +) : Serializable { + + companion object { + private const val serialVersionUID: kotlin.Long = 1 + } +} + diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Color.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Color.kt new file mode 100644 index 00000000000..d46c704e991 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Color.kt @@ -0,0 +1,40 @@ +package org.openapitools.model + +import java.util.Locale +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonValue +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import java.io.Serializable +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +/** +* +* Values: black,white,brown,yellow,violet +*/ +enum class Color(@get:JsonValue val value: kotlin.String) : com.some.pack.WithDefaultMethods { + + black("black"), + white("white"), + brown("brown"), + yellow("yellow"), + violet("violet"); + + companion object { + @JvmStatic + @JsonCreator + fun forValue(value: kotlin.String): Color { + return values().firstOrNull{it -> it.value == value} + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Color'") + } + } +} + diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Dog.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Dog.kt new file mode 100644 index 00000000000..789cb452e74 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Dog.kt @@ -0,0 +1,80 @@ +package org.openapitools.model + +import java.util.Locale +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonValue +import org.openapitools.model.Category +import org.openapitools.model.Color +import org.openapitools.model.Pet +import org.openapitools.model.Tag +import java.io.Serializable +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +/** + * + * @param bark + * @param breed + * @param likesFetch Whether the dog enjoys fetching + */ +data class Dog( + + @get:JsonProperty("bark", required = true) val bark: kotlin.Boolean, + + @get:JsonProperty("breed", required = true) val breed: Dog.Breed, + + @get:JsonProperty("likesFetch", required = true) override val likesFetch: kotlin.Boolean, + + @get:JsonProperty("name", required = true) override val name: kotlin.String, + + @get:JsonProperty("photoUrls", required = true) override val photoUrls: kotlin.collections.List, + + @get:JsonProperty("petType", required = true) override val petType: kotlin.String, + + @get:JsonProperty("id") override val id: kotlin.Long? = null, + + @field:Valid + @get:JsonProperty("category") override val category: Category? = null, + + @field:Valid + @get:JsonProperty("tags") override val tags: kotlin.collections.List? = null, + + @field:Valid + @get:JsonProperty("color") override val color: Color? = null +) : Pet, Serializable, com.some.pack.Fetchable { + + /** + * + * Values: Dingo,Husky,Retriever,Shepherd + */ + enum class Breed(@get:JsonValue val value: kotlin.String) { + + Dingo("Dingo"), + Husky("Husky"), + Retriever("Retriever"), + Shepherd("Shepherd"); + + companion object { + @JvmStatic + @JsonCreator + fun forValue(value: kotlin.String): Breed { + return values().firstOrNull{it -> it.value == value} + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Dog'") + } + } + } + + companion object { + private const val serialVersionUID: kotlin.Long = 1 + } +} + diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt new file mode 100644 index 00000000000..d5f1bfed634 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -0,0 +1,36 @@ +package org.openapitools.model + +import java.util.Locale +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import java.io.Serializable +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +/** + * + * @param code + * @param type + * @param message + */ +data class ModelApiResponse( + + @get:JsonProperty("code") val code: kotlin.Int? = null, + + @get:JsonProperty("type") val type: kotlin.String? = null, + + @get:JsonProperty("message") val message: kotlin.String? = null +) : Serializable { + + companion object { + private const val serialVersionUID: kotlin.Long = 1 + } +} + diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Order.kt new file mode 100644 index 00000000000..b9cf389785a --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Order.kt @@ -0,0 +1,67 @@ +package org.openapitools.model + +import java.util.Locale +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonValue +import java.io.Serializable +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +/** + * + * @param id + * @param petId + * @param quantity + * @param shipDate + * @param status + * @param complete + */ +data class Order( + + @get:JsonProperty("id") val id: kotlin.Long? = null, + + @get:JsonProperty("petId") val petId: kotlin.Long? = null, + + @get:JsonProperty("quantity") val quantity: kotlin.Int? = null, + + @get:JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + + @get:JsonProperty("status") val status: Order.Status? = null, + + @get:JsonProperty("complete") val complete: kotlin.Boolean? = false +) : Serializable { + + /** + * + * Values: placed,approved,delivered + */ + enum class Status(@get:JsonValue val value: kotlin.String) { + + placed("placed"), + approved("approved"), + delivered("delivered"); + + companion object { + @JvmStatic + @JsonCreator + fun forValue(value: kotlin.String): Status { + return values().firstOrNull{it -> it.value == value} + ?: throw IllegalArgumentException("Unexpected value '$value' for enum 'Order'") + } + } + } + + companion object { + private const val serialVersionUID: kotlin.Long = 1 + } +} + diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Pet.kt new file mode 100644 index 00000000000..a3dbd5258a1 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Pet.kt @@ -0,0 +1,72 @@ +package org.openapitools.model + +import java.util.Locale +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonIgnoreProperties +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonSubTypes +import com.fasterxml.jackson.annotation.JsonTypeInfo +import com.fasterxml.jackson.annotation.JsonValue +import org.openapitools.model.Category +import org.openapitools.model.Color +import org.openapitools.model.Tag +import java.io.Serializable +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +/** + * + * @param name + * @param photoUrls + * @param petType + * @param id + * @param category + * @param tags + * @param color + */ +@JsonIgnoreProperties( + value = ["petType"], // ignore manually set petType, it will be automatically generated by Jackson during serialization + allowSetters = true // allows the petType to be set during deserialization +) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "petType", visible = true) +@JsonSubTypes( + JsonSubTypes.Type(value = Cat::class, name = "Cat"), + JsonSubTypes.Type(value = Dog::class, name = "Dog") +) + +interface Pet : Serializable, com.some.pack.Named, com.some.pack.WithCategory, com.some.pack.WithDefaultMethods { + + override val name: kotlin.String + + + val photoUrls: kotlin.collections.List + + + val petType: kotlin.String + + + val id: kotlin.Long? + + + override val category: Category? + + + val tags: kotlin.collections.List? + + + val color: Color? + + + companion object { + private const val serialVersionUID: kotlin.Long = 1 + } +} + diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Tag.kt new file mode 100644 index 00000000000..cce8583e6d5 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/Tag.kt @@ -0,0 +1,33 @@ +package org.openapitools.model + +import java.util.Locale +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import java.io.Serializable +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +/** + * + * @param id + * @param name + */ +data class Tag( + + @get:JsonProperty("id") val id: kotlin.Long? = null, + + @get:JsonProperty("name") val name: kotlin.String? = null +) : Serializable { + + companion object { + private const val serialVersionUID: kotlin.Long = 1 + } +} + diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/User.kt new file mode 100644 index 00000000000..f24ba91ffb7 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/kotlin/org/openapitools/model/User.kt @@ -0,0 +1,51 @@ +package org.openapitools.model + +import java.util.Locale +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import java.io.Serializable +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Email +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import javax.validation.Valid + +/** + * + * @param id + * @param username + * @param firstName + * @param lastName + * @param email + * @param password + * @param phone + * @param userStatus + */ +data class User( + + @get:JsonProperty("id") val id: kotlin.Long? = null, + + @get:JsonProperty("username") val username: kotlin.String? = null, + + @get:JsonProperty("firstName") val firstName: kotlin.String? = null, + + @get:JsonProperty("lastName") val lastName: kotlin.String? = null, + + @get:JsonProperty("email") val email: kotlin.String? = null, + + @get:JsonProperty("password") val password: kotlin.String? = null, + + @get:JsonProperty("phone") val phone: kotlin.String? = null, + + @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null +) : Serializable { + + companion object { + private const val serialVersionUID: kotlin.Long = 1 + } +} + diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/resources/application.yaml b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/resources/application.yaml new file mode 100644 index 00000000000..8e2ebcde976 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/main/resources/application.yaml @@ -0,0 +1,10 @@ +spring: + application: + name: openAPIPetstore + + jackson: + serialization: + WRITE_DATES_AS_TIMESTAMPS: false + +server: + port: 8080 diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/test/kotlin/org/openapitools/api/PetApiTest.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/test/kotlin/org/openapitools/api/PetApiTest.kt new file mode 100644 index 00000000000..4ee3b320cc3 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/test/kotlin/org/openapitools/api/PetApiTest.kt @@ -0,0 +1,129 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import org.junit.jupiter.api.Test +import org.springframework.http.ResponseEntity + +class PetApiTest { + + private val service: PetApiService = PetApiServiceImpl() + private val api: PetApiController = PetApiController(service) + + /** + * To test PetApiController.addPet + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun addPetTest() { + val body: Pet = TODO() + val response: ResponseEntity = api.addPet(body) + + // TODO: test validations + } + + /** + * To test PetApiController.deletePet + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun deletePetTest() { + val petId: kotlin.Long = TODO() + val apiKey: kotlin.String? = TODO() + val response: ResponseEntity = api.deletePet(petId, apiKey) + + // TODO: test validations + } + + /** + * To test PetApiController.findPetsByStatus + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun findPetsByStatusTest() { + val status: kotlin.collections.List = TODO() + val response: ResponseEntity> = api.findPetsByStatus(status) + + // TODO: test validations + } + + /** + * To test PetApiController.findPetsByTags + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun findPetsByTagsTest() { + val tags: kotlin.collections.List = TODO() + val response: ResponseEntity> = api.findPetsByTags(tags) + + // TODO: test validations + } + + /** + * To test PetApiController.getPetById + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun getPetByIdTest() { + val petId: kotlin.Long = TODO() + val response: ResponseEntity = api.getPetById(petId) + + // TODO: test validations + } + + /** + * To test PetApiController.updatePet + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun updatePetTest() { + val body: Pet = TODO() + val response: ResponseEntity = api.updatePet(body) + + // TODO: test validations + } + + /** + * To test PetApiController.updatePetWithForm + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun updatePetWithFormTest() { + val petId: kotlin.Long = TODO() + val name: kotlin.String? = TODO() + val status: kotlin.String? = TODO() + val response: ResponseEntity = api.updatePetWithForm(petId, name, status) + + // TODO: test validations + } + + /** + * To test PetApiController.uploadFile + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun uploadFileTest() { + val petId: kotlin.Long = TODO() + val additionalMetadata: kotlin.String? = TODO() + val file: org.springframework.web.multipart.MultipartFile? = TODO() + val response: ResponseEntity = api.uploadFile(petId, additionalMetadata, file) + + // TODO: test validations + } +} diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/test/kotlin/org/openapitools/api/StoreApiTest.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/test/kotlin/org/openapitools/api/StoreApiTest.kt new file mode 100644 index 00000000000..69e269b03ef --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/test/kotlin/org/openapitools/api/StoreApiTest.kt @@ -0,0 +1,66 @@ +package org.openapitools.api + +import org.openapitools.model.Order +import org.junit.jupiter.api.Test +import org.springframework.http.ResponseEntity + +class StoreApiTest { + + private val service: StoreApiService = StoreApiServiceImpl() + private val api: StoreApiController = StoreApiController(service) + + /** + * To test StoreApiController.deleteOrder + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun deleteOrderTest() { + val orderId: kotlin.String = TODO() + val response: ResponseEntity = api.deleteOrder(orderId) + + // TODO: test validations + } + + /** + * To test StoreApiController.getInventory + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun getInventoryTest() { + val response: ResponseEntity> = api.getInventory() + + // TODO: test validations + } + + /** + * To test StoreApiController.getOrderById + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun getOrderByIdTest() { + val orderId: kotlin.Long = TODO() + val response: ResponseEntity = api.getOrderById(orderId) + + // TODO: test validations + } + + /** + * To test StoreApiController.placeOrder + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun placeOrderTest() { + val body: Order = TODO() + val response: ResponseEntity = api.placeOrder(body) + + // TODO: test validations + } +} diff --git a/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/test/kotlin/org/openapitools/api/UserApiTest.kt b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/test/kotlin/org/openapitools/api/UserApiTest.kt new file mode 100644 index 00000000000..eb20423da71 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-x-kotlin-implements/src/test/kotlin/org/openapitools/api/UserApiTest.kt @@ -0,0 +1,124 @@ +package org.openapitools.api + +import org.openapitools.model.User +import org.junit.jupiter.api.Test +import org.springframework.http.ResponseEntity + +class UserApiTest { + + private val service: UserApiService = UserApiServiceImpl() + private val api: UserApiController = UserApiController(service) + + /** + * To test UserApiController.createUser + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun createUserTest() { + val body: User = TODO() + val response: ResponseEntity = api.createUser(body) + + // TODO: test validations + } + + /** + * To test UserApiController.createUsersWithArrayInput + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun createUsersWithArrayInputTest() { + val body: kotlin.collections.List = TODO() + val response: ResponseEntity = api.createUsersWithArrayInput(body) + + // TODO: test validations + } + + /** + * To test UserApiController.createUsersWithListInput + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun createUsersWithListInputTest() { + val body: kotlin.collections.List = TODO() + val response: ResponseEntity = api.createUsersWithListInput(body) + + // TODO: test validations + } + + /** + * To test UserApiController.deleteUser + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun deleteUserTest() { + val username: kotlin.String = TODO() + val response: ResponseEntity = api.deleteUser(username) + + // TODO: test validations + } + + /** + * To test UserApiController.getUserByName + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun getUserByNameTest() { + val username: kotlin.String = TODO() + val response: ResponseEntity = api.getUserByName(username) + + // TODO: test validations + } + + /** + * To test UserApiController.loginUser + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun loginUserTest() { + val username: kotlin.String = TODO() + val password: kotlin.String = TODO() + val response: ResponseEntity = api.loginUser(username, password) + + // TODO: test validations + } + + /** + * To test UserApiController.logoutUser + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun logoutUserTest() { + val response: ResponseEntity = api.logoutUser() + + // TODO: test validations + } + + /** + * To test UserApiController.updateUser + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun updateUserTest() { + val username: kotlin.String = TODO() + val body: User = TODO() + val response: ResponseEntity = api.updateUser(username, body) + + // TODO: test validations + } +} diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt index a423d367e71..0638b1718f3 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt @@ -24,7 +24,7 @@ data class Category( @get:JsonProperty("id") val id: kotlin.Long? = null, @get:JsonProperty("name") val name: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index bf5b0e47098..f520047d850 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -27,7 +27,7 @@ data class ModelApiResponse( @get:JsonProperty("type") val type: kotlin.String? = null, @get:JsonProperty("message") val message: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt index 8defd87ff6e..4ebe51e765e 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt @@ -38,7 +38,7 @@ data class Order( @get:JsonProperty("status") val status: Order.Status? = null, @get:JsonProperty("complete") val complete: kotlin.Boolean? = false - ) : Serializable{ +) : Serializable { /** * Order Status diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt index b151c43481c..cf9ccf2f4f7 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt @@ -42,7 +42,7 @@ data class Pet( @get:JsonProperty("tags") val tags: kotlin.collections.List? = null, @get:JsonProperty("status") val status: Pet.Status? = null - ) : Serializable{ +) : Serializable { /** * pet status in the store diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt index 4977cb04051..36f84160004 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt @@ -24,7 +24,7 @@ data class Tag( @get:JsonProperty("id") val id: kotlin.Long? = null, @get:JsonProperty("name") val name: kotlin.String? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1 diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt index b6d34aa6f69..b04c9e31259 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt @@ -42,7 +42,7 @@ data class User( @get:JsonProperty("phone") val phone: kotlin.String? = null, @get:JsonProperty("userStatus") val userStatus: kotlin.Int? = null - ) : Serializable{ +) : Serializable { companion object { private const val serialVersionUID: kotlin.Long = 1