diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor/build.gradle.kts.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor/build.gradle.kts.mustache index 268c54c5093a..1fa61c071eaf 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor/build.gradle.kts.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor/build.gradle.kts.mustache @@ -7,7 +7,7 @@ version = "{{artifactVersion}}" plugins { kotlin("jvm") version "2.0.20" - id("io.ktor.plugin") version "3.0.2" + application kotlin("plugin.serialization") version "2.0.20" } @@ -23,6 +23,7 @@ repositories { } dependencies { + implementation(platform("io.ktor:ktor-bom:3.0.2")) implementation("ch.qos.logback:logback-classic:$logback_version") {{#hasAuthMethods}} implementation("com.typesafe:config:1.4.1") diff --git a/samples/client/petstore/java/okhttp-gson-3.1/.openapi-generator/FILES b/samples/client/petstore/java/okhttp-gson-3.1/.openapi-generator/FILES index 1db889c4947b..0f5e9fcaaa55 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1/.openapi-generator/FILES +++ b/samples/client/petstore/java/okhttp-gson-3.1/.openapi-generator/FILES @@ -5,12 +5,34 @@ README.md api/openapi.yaml build.gradle build.sbt +docs/AllOfSimpleModel.md +docs/Animal.md +docs/AnyTypeTest.md +docs/ArrayOfSameRef.md +docs/Cat.md docs/Category.md +docs/CircularReference1.md +docs/CircularReference2.md +docs/CircularReference3.md +docs/CodesEnum.md +docs/DefaultApi.md +docs/Dog.md +docs/FakeApi.md +docs/FakeWebhooksSourcesDeletedPostRequest.md +docs/FakeWebhooksSourcesDeletedPostRequestEvent.md docs/ModelApiResponse.md +docs/OneOfStringOrInt.md docs/Order.md docs/Pet.md docs/PetApi.md +docs/RefRefToPathLevelParameterOneofRefToOneofParameter.md +docs/RefToRefParameterAnyofRefToAnyofParameter.md +docs/SelfReferenceAdditionalProperties.md +docs/SelfReferenceAnyOf.md +docs/SelfReferenceOneOf.md +docs/SimpleModelWithArrayProperty.md docs/StoreApi.md +docs/StringOrInt.md docs/Tag.md docs/User.md docs/UserApi.md @@ -36,6 +58,8 @@ src/main/java/org/openapitools/client/ProgressResponseBody.java src/main/java/org/openapitools/client/ServerConfiguration.java src/main/java/org/openapitools/client/ServerVariable.java src/main/java/org/openapitools/client/StringUtil.java +src/main/java/org/openapitools/client/api/DefaultApi.java +src/main/java/org/openapitools/client/api/FakeApi.java src/main/java/org/openapitools/client/api/PetApi.java src/main/java/org/openapitools/client/api/StoreApi.java src/main/java/org/openapitools/client/api/UserApi.java @@ -48,9 +72,29 @@ src/main/java/org/openapitools/client/auth/OAuthFlow.java src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java src/main/java/org/openapitools/client/auth/RetryingOAuth.java src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java +src/main/java/org/openapitools/client/model/AllOfSimpleModel.java +src/main/java/org/openapitools/client/model/Animal.java +src/main/java/org/openapitools/client/model/AnyTypeTest.java +src/main/java/org/openapitools/client/model/ArrayOfSameRef.java +src/main/java/org/openapitools/client/model/Cat.java src/main/java/org/openapitools/client/model/Category.java +src/main/java/org/openapitools/client/model/CircularReference1.java +src/main/java/org/openapitools/client/model/CircularReference2.java +src/main/java/org/openapitools/client/model/CircularReference3.java +src/main/java/org/openapitools/client/model/CodesEnum.java +src/main/java/org/openapitools/client/model/Dog.java +src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequest.java +src/main/java/org/openapitools/client/model/FakeWebhooksSourcesDeletedPostRequestEvent.java src/main/java/org/openapitools/client/model/ModelApiResponse.java +src/main/java/org/openapitools/client/model/OneOfStringOrInt.java src/main/java/org/openapitools/client/model/Order.java src/main/java/org/openapitools/client/model/Pet.java +src/main/java/org/openapitools/client/model/RefRefToPathLevelParameterOneofRefToOneofParameter.java +src/main/java/org/openapitools/client/model/RefToRefParameterAnyofRefToAnyofParameter.java +src/main/java/org/openapitools/client/model/SelfReferenceAdditionalProperties.java +src/main/java/org/openapitools/client/model/SelfReferenceAnyOf.java +src/main/java/org/openapitools/client/model/SelfReferenceOneOf.java +src/main/java/org/openapitools/client/model/SimpleModelWithArrayProperty.java +src/main/java/org/openapitools/client/model/StringOrInt.java src/main/java/org/openapitools/client/model/Tag.java src/main/java/org/openapitools/client/model/User.java diff --git a/samples/client/petstore/java/okhttp-gson-3.1/README.md b/samples/client/petstore/java/okhttp-gson-3.1/README.md index a5b64cc47df3..c61811c10ed3 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1/README.md +++ b/samples/client/petstore/java/okhttp-gson-3.1/README.md @@ -83,26 +83,20 @@ Please follow the [installation](#installation) instruction and execute the foll import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; import org.openapitools.client.model.*; -import org.openapitools.client.api.PetApi; +import org.openapitools.client.api.FakeApi; public class Example { public static void main(String[] args) { ApiClient defaultClient = Configuration.getDefaultApiClient(); defaultClient.setBasePath("http://petstore.swagger.io/v2"); - - // Configure OAuth2 access token for authorization: petstore_auth - OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); - petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - PetApi apiInstance = new PetApi(defaultClient); - Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store + FakeApi apiInstance = new FakeApi(defaultClient); try { - Pet result = apiInstance.addPet(pet); + Object result = apiInstance.fakeInlineSchemaAnyofPath1Get(); System.out.println(result); } catch (ApiException e) { - System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Exception when calling FakeApi#fakeInlineSchemaAnyofPath1Get"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); @@ -119,6 +113,18 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*FakeApi* | [**fakeInlineSchemaAnyofPath1Get**](docs/FakeApi.md#fakeInlineSchemaAnyofPath1Get) | **GET** /fake/inline/schema/anyof/path1 | +*FakeApi* | [**fakeInlineSchemaAnyofPath2Get**](docs/FakeApi.md#fakeInlineSchemaAnyofPath2Get) | **GET** /fake/inline/schema/anyof/path2 | +*FakeApi* | [**fakeInlineSchemaAnyofPath3Get**](docs/FakeApi.md#fakeInlineSchemaAnyofPath3Get) | **GET** /fake/inline/schema/anyof/path3 | +*FakeApi* | [**op1**](docs/FakeApi.md#op1) | **POST** /fake/api/changeowner | op1 +*FakeApi* | [**op2**](docs/FakeApi.md#op2) | **POST** /fake/api/changename | op2 +*FakeApi* | [**op3**](docs/FakeApi.md#op3) | **POST** /fake/api/query/enum | op3 +*FakeApi* | [**refToRefParameter**](docs/FakeApi.md#refToRefParameter) | **GET** /ref/ref_to_parameter | +*FakeApi* | [**refToRefParameterAnyof**](docs/FakeApi.md#refToRefParameterAnyof) | **GET** /ref/ref_to_operation_level_parameter_oneof | +*FakeApi* | [**refToRefParameterOneof**](docs/FakeApi.md#refToRefParameterOneof) | **GET** /ref/ref_to_path_level_parameter_oneof | +*FakeApi* | [**responseNoRef**](docs/FakeApi.md#responseNoRef) | **GET** /no_ref | +*FakeApi* | [**responseRefToNoRef**](docs/FakeApi.md#responseRefToNoRef) | **GET** /ref/no_ref | +*FakeApi* | [**responseRefToRef**](docs/FakeApi.md#responseRefToRef) | **GET** /ref/ref | *PetApi* | [**addPet**](docs/PetApi.md#addPet) | **POST** /pet | Add a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status @@ -143,10 +149,30 @@ Class | Method | HTTP request | Description ## Documentation for Models + - [AllOfSimpleModel](docs/AllOfSimpleModel.md) + - [Animal](docs/Animal.md) + - [AnyTypeTest](docs/AnyTypeTest.md) + - [ArrayOfSameRef](docs/ArrayOfSameRef.md) + - [Cat](docs/Cat.md) - [Category](docs/Category.md) + - [CircularReference1](docs/CircularReference1.md) + - [CircularReference2](docs/CircularReference2.md) + - [CircularReference3](docs/CircularReference3.md) + - [CodesEnum](docs/CodesEnum.md) + - [Dog](docs/Dog.md) + - [FakeWebhooksSourcesDeletedPostRequest](docs/FakeWebhooksSourcesDeletedPostRequest.md) + - [FakeWebhooksSourcesDeletedPostRequestEvent](docs/FakeWebhooksSourcesDeletedPostRequestEvent.md) - [ModelApiResponse](docs/ModelApiResponse.md) + - [OneOfStringOrInt](docs/OneOfStringOrInt.md) - [Order](docs/Order.md) - [Pet](docs/Pet.md) + - [RefRefToPathLevelParameterOneofRefToOneofParameter](docs/RefRefToPathLevelParameterOneofRefToOneofParameter.md) + - [RefToRefParameterAnyofRefToAnyofParameter](docs/RefToRefParameterAnyofRefToAnyofParameter.md) + - [SelfReferenceAdditionalProperties](docs/SelfReferenceAdditionalProperties.md) + - [SelfReferenceAnyOf](docs/SelfReferenceAnyOf.md) + - [SelfReferenceOneOf](docs/SelfReferenceOneOf.md) + - [SimpleModelWithArrayProperty](docs/SimpleModelWithArrayProperty.md) + - [StringOrInt](docs/StringOrInt.md) - [Tag](docs/Tag.md) - [User](docs/User.md) diff --git a/samples/client/petstore/java/okhttp-gson-3.1/api/openapi.yaml b/samples/client/petstore/java/okhttp-gson-3.1/api/openapi.yaml index 5167f861249d..600ba1a18fb9 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1/api/openapi.yaml +++ b/samples/client/petstore/java/okhttp-gson-3.1/api/openapi.yaml @@ -639,7 +639,219 @@ paths: x-content-type: application/json x-accepts: - application/json + /no_ref: + get: + operationId: response_no_ref + responses: + "200": + content: + text/plain: + schema: + type: string + description: required to pass validation + tags: + - fake + x-accepts: + - text/plain + /ref/no_ref: + get: + operationId: response_ref_to_no_ref + responses: + "200": + $ref: '#/components/responses/no_ref' + tags: + - fake + x-accepts: + - text/plain + /ref/ref: + get: + operationId: response_ref_to_ref + responses: + "200": + $ref: '#/components/responses/ref' + tags: + - fake + x-accepts: + - text/plain + /ref/ref_to_parameter: + get: + operationId: ref_to_ref_parameter + parameters: + - $ref: '#/components/parameters/ref_to_uuid' + responses: + "200": + $ref: '#/components/responses/ref' + tags: + - fake + x-accepts: + - text/plain + parameters: + - $ref: '#/components/parameters/ref_to_uuid' + /ref/ref_to_path_level_parameter_oneof: + get: + description: to test $ref to path level parameters + operationId: ref_to_ref_parameter_oneof + parameters: + - $ref: '#/components/parameters/ref_to_oneof' + responses: + "200": + description: Successful Response + tags: + - fake + x-accepts: + - application/json + parameters: + - $ref: '#/components/parameters/ref_to_oneof' + /ref/ref_to_operation_level_parameter_oneof: + get: + description: to test $ref to operation level parameters + operationId: ref_to_ref_parameter_anyof + parameters: + - $ref: '#/components/parameters/ref_to_anyof' + responses: + "200": + description: Successful Response + tags: + - fake + x-accepts: + - application/json + /fake/api/changeowner: + post: + operationId: op1 + parameters: [] + responses: + "201": + content: + application/json: + schema: {} + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: op1 + tags: + - fake + x-accepts: + - application/json + /fake/api/changename: + post: + operationId: op2 + parameters: [] + responses: + "201": + content: + application/json: + schema: {} + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: op2 + tags: + - fake + x-accepts: + - application/json + /fake/api/query/enum: + post: + operationId: op3 + parameters: + - description: query enum test + explode: true + in: query + name: query_enum + required: true + schema: + items: + $ref: '#/components/schemas/CodesEnum' + type: array + style: form + responses: + "200": + description: Successful Response + summary: op3 + tags: + - fake + x-accepts: + - application/json + /fake/inline/schema/anyof/path1: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/myObject' + description: "" + tags: + - fake + x-accepts: + - application/json + /fake/inline/schema/anyof/path2: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/myObject' + description: "" + tags: + - fake + x-accepts: + - application/json + /fake/inline/schema/anyof/path3: + get: + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/myObject' + nullable: true + type: array + description: "" + tags: + - fake + x-accepts: + - application/json components: + parameters: + ref_to_uuid: + description: to test ref to parameter (uuid) + explode: false + in: header + name: ref_to_uuid + required: true + schema: + example: 61864654-6e6b-4152-a62f-795fdd606bc2 + format: uuid + type: string + style: simple + ref_to_oneof: + description: to test ref to parameter (oneof) + explode: false + in: header + name: ref_to_oneof + required: true + schema: + $ref: '#/components/schemas/_ref_ref_to_path_level_parameter_oneof_ref_to_oneof_parameter' + style: simple + ref_to_anyof: + description: to test ref to parameter (anyof) + explode: false + in: header + name: ref_to_anyof + required: true + schema: + $ref: '#/components/schemas/ref_to_ref_parameter_anyof_ref_to_anyof_parameter' + style: simple requestBodies: UserArray: content: @@ -660,6 +872,19 @@ components: $ref: '#/components/schemas/Pet' description: Pet object that needs to be added to the store required: true + responses: + no_ref: + content: + text/plain: + schema: + type: string + description: required to pass validation + ref: + content: + text/plain: + schema: + $ref: '#/components/schemas/simple_text' + description: required to pass validation schemas: Order: description: An order for a pets from the pet store @@ -828,6 +1053,129 @@ components: message: type: string title: An uploaded response + StringOrInt: + anyOf: + - type: string + - format: int32 + type: integer + description: string or int + OneOfStringOrInt: + description: string or int (onefOf) + oneOf: + - type: string + - type: integer + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + breed: + type: string + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + declawed: + type: boolean + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + simple_text: + type: string + any_type_test: + properties: + any_type_property: {} + array_prop: + description: test array in 3.1 spec + items: + type: string + type: array + ref_array_prefix_items: + description: | + An item that was added to the queue. + items: {} + maxItems: 5 + minItems: 3 + type: array + HTTPValidationError: + properties: {} + title: HTTPValidationError + type: object + ArrayPrefixItems: + description: | + An item that was added to the queue. + items: {} + maxItems: 5 + minItems: 3 + type: array + circular_reference_1: + properties: + prop1: + $ref: '#/components/schemas/circular_reference_2' + circular_reference_2: + properties: + prop1: + $ref: '#/components/schemas/circular_reference_3' + circular_reference_3: + properties: + prop1: + $ref: '#/components/schemas/circular_reference_1' + array_of_same_ref: + properties: + arrayFooOne: + items: + $ref: '#/components/schemas/Tag' + type: array + arrayFooTwo: + items: + $ref: '#/components/schemas/Tag' + type: array + arrayFooThree: + items: + $ref: '#/components/schemas/Tag' + type: array + CodesEnum: + enum: + - Code 1 + - Code 2 + - Code 3 + type: string + SimpleModelWithArrayProperty: + properties: + arrayOfStrings: + items: + type: string + type: array + required: + - arrayOfStrings + AllOfSimpleModel: + allOf: + - $ref: '#/components/schemas/SimpleModelWithArrayProperty' + myObject: + type: object + SelfReference: + items: {} + type: array + SelfReferenceOneOf: + oneOf: + - type: string + - type: boolean + SelfReferenceAnyOf: + anyOf: + - type: string + - type: boolean + SelfReferenceAdditionalProperties: + additionalProperties: {} + properties: + dummy: + type: string updatePetWithForm_request: properties: name: @@ -845,6 +1193,36 @@ components: description: file to upload format: binary type: string + _ref_ref_to_path_level_parameter_oneof_ref_to_oneof_parameter: + oneOf: + - type: string + - type: integer + ref_to_ref_parameter_anyof_ref_to_anyof_parameter: + oneOf: + - type: string + - items: + type: string + type: array + _fake_webhooks_sources_deleted_post_request_event: + properties: + event_id: + type: string + required: + - event_id + _fake_webhooks_sources_deleted_post_request: + description: inline schema in webhooks + properties: + event_timestamp: + format: date-time + type: string + event_type: + type: string + event: + $ref: '#/components/schemas/_fake_webhooks_sources_deleted_post_request_event' + required: + - event + - event_timestamp + - event_type securitySchemes: petstore_auth: flows: diff --git a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/JSON.java index f993e935c7aa..70968d44d7c1 100644 --- a/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson-3.1/src/main/java/org/openapitools/client/JSON.java @@ -58,6 +58,35 @@ public class JSON { @SuppressWarnings("unchecked") public static GsonBuilder createGson() { GsonFireBuilder fireBuilder = new GsonFireBuilder() + .registerTypeSelector(org.openapitools.client.model.Animal.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Cat", org.openapitools.client.model.Cat.class); + classByDiscriminatorValue.put("Dog", org.openapitools.client.model.Dog.class); + classByDiscriminatorValue.put("Animal", org.openapitools.client.model.Animal.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }) + .registerTypeSelector(org.openapitools.client.model.Cat.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Cat", org.openapitools.client.model.Cat.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }) + .registerTypeSelector(org.openapitools.client.model.Dog.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Dog", org.openapitools.client.model.Dog.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } + }) ; GsonBuilder builder = fireBuilder.createGsonBuilder(); return builder; @@ -93,10 +122,28 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AllOfSimpleModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.AnyTypeTest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ArrayOfSameRef.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Cat.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Category.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CircularReference1.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CircularReference2.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.CircularReference3.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Dog.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.FakeWebhooksSourcesDeletedPostRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.FakeWebhooksSourcesDeletedPostRequestEvent.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.ModelApiResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.OneOfStringOrInt.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Order.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Pet.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RefRefToPathLevelParameterOneofRefToOneofParameter.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.RefToRefParameterAnyofRefToAnyofParameter.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SelfReferenceAdditionalProperties.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SelfReferenceAnyOf.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SelfReferenceOneOf.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.SimpleModelWithArrayProperty.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.StringOrInt.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.Tag.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.client.model.User.CustomTypeAdapterFactory()); gson = gsonBuilder.create(); diff --git a/samples/server/petstore/kotlin-server-modelMutable/build.gradle b/samples/server/petstore/kotlin-server-modelMutable/build.gradle deleted file mode 100644 index bd883dc22910..000000000000 --- a/samples/server/petstore/kotlin-server-modelMutable/build.gradle +++ /dev/null @@ -1,74 +0,0 @@ -group "org.openapitools" -version "1.0.0" - -wrapper { - gradleVersion = "7.4.2" - distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" -} - -buildscript { - ext.kotlin_version = "1.7.20" - ext.ktor_version = "2.2.1" - ext.shadow_version = "6.1.0" - - repositories { - maven { url "https://repo1.maven.org/maven2" } - maven { url "https://plugins.gradle.org/m2/" } - } - dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version") - classpath("com.github.jengelman.gradle.plugins:shadow:$shadow_version") - } -} - -apply plugin: "java" -apply plugin: "kotlin" -apply plugin: "application" - -mainClassName = "io.ktor.server.netty.DevelopmentEngine" - -// Initialization order with shadow 2.0.1 and Gradle 6.9 is weird. -// See https://github.com/johnrengelman/shadow/issues/336#issuecomment-355402508 -apply plugin: "com.github.johnrengelman.shadow" - -sourceCompatibility = 1.8 - -compileKotlin { - kotlinOptions.jvmTarget = "1.8" -} - -compileTestKotlin { - kotlinOptions.jvmTarget = "1.8" -} - -shadowJar { - baseName = "kotlin-server" - classifier = null - version = null -} - -repositories { - maven { setUrl("https://repo1.maven.org/maven2") } - maven { setUrl("https://dl.bintray.com/kotlin/ktor") } - maven { setUrl("https://dl.bintray.com/kotlin/kotlinx") } -} - -dependencies { - implementation("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version") - implementation("ch.qos.logback:logback-classic:1.2.9") - implementation("com.typesafe:config:1.4.1") - implementation("io.ktor:ktor-server-auth:$ktor_version") - implementation("io.ktor:ktor-client-apache:$ktor_version") - implementation("io.ktor:ktor-server-auto-head-response:$ktor_version") - implementation("io.ktor:ktor-server-default-headers:$ktor_version") - implementation("io.ktor:ktor-server-content-negotiation:$ktor_version") - implementation("io.ktor:ktor-serialization-gson:$ktor_version") - implementation("io.ktor:ktor-server-resources:$ktor_version") - implementation("io.ktor:ktor-server-hsts:$ktor_version") - implementation("io.ktor:ktor-server-compression:$ktor_version") - implementation("io.dropwizard.metrics:metrics-core:4.1.18") - implementation("io.ktor:ktor-server-metrics:$ktor_version") - implementation("io.ktor:ktor-server-netty:$ktor_version") - - testImplementation("junit:junit:4.13.2") -} diff --git a/samples/server/petstore/kotlin-server-modelMutable/build.gradle.kts b/samples/server/petstore/kotlin-server-modelMutable/build.gradle.kts index ac3166e2f3a2..1e91d49feaf6 100644 --- a/samples/server/petstore/kotlin-server-modelMutable/build.gradle.kts +++ b/samples/server/petstore/kotlin-server-modelMutable/build.gradle.kts @@ -7,7 +7,7 @@ version = "1.0.0" plugins { kotlin("jvm") version "2.0.20" - id("io.ktor.plugin") version "3.0.2" + application kotlin("plugin.serialization") version "2.0.20" } @@ -23,6 +23,7 @@ repositories { } dependencies { + implementation(platform("io.ktor:ktor-bom:3.0.2")) implementation("ch.qos.logback:logback-classic:$logback_version") implementation("com.typesafe:config:1.4.1") implementation("io.ktor:ktor-server-auth") diff --git a/samples/server/petstore/kotlin-server/ktor/build.gradle.kts b/samples/server/petstore/kotlin-server/ktor/build.gradle.kts index ac3166e2f3a2..1e91d49feaf6 100644 --- a/samples/server/petstore/kotlin-server/ktor/build.gradle.kts +++ b/samples/server/petstore/kotlin-server/ktor/build.gradle.kts @@ -7,7 +7,7 @@ version = "1.0.0" plugins { kotlin("jvm") version "2.0.20" - id("io.ktor.plugin") version "3.0.2" + application kotlin("plugin.serialization") version "2.0.20" } @@ -23,6 +23,7 @@ repositories { } dependencies { + implementation(platform("io.ktor:ktor-bom:3.0.2")) implementation("ch.qos.logback:logback-classic:$logback_version") implementation("com.typesafe:config:1.4.1") implementation("io.ktor:ktor-server-auth")