From 177b94b1b40cdd3b8f3d4da42ada452b87633f47 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Fri, 12 Sep 2025 15:28:57 +0800 Subject: [PATCH] Add tests for numeric form data (kotlin - jvm-ktor) (#21952) * add tests for numeric form data (kotlin) * remove null check as its done already --- bin/configs/kotlin-jvm-ktor-gson.yaml | 2 +- .../libraries/jvm-ktor/api.mustache | 8 +- .../test/resources/3_0/kotlin/petstore.yaml | 36 ++++++ .../.openapi-generator/FILES | 12 ++ .../petstore/kotlin-jvm-ktor-gson/README.md | 7 ++ .../kotlin-jvm-ktor-gson/docs/Annotation.md | 10 ++ .../docs/AnyOfUserOrPet.md | 29 +++++ .../docs/AnyOfUserOrPetOrArrayString.md | 29 +++++ .../kotlin-jvm-ktor-gson/docs/FakeApi.md | 106 ++++++++++++++++ .../kotlin-jvm-ktor-gson/docs/PetApi.md | 36 ++++-- .../kotlin-jvm-ktor-gson/docs/StoreApi.md | 12 +- .../kotlin-jvm-ktor-gson/docs/User.md | 2 +- .../kotlin-jvm-ktor-gson/docs/UserApi.md | 80 +++++++++---- .../kotlin-jvm-ktor-gson/docs/UserOrPet.md | 29 +++++ .../docs/UserOrPetOrArrayString.md | 29 +++++ .../org/openapitools/client/apis/FakeApi.kt | 113 ++++++++++++++++++ .../org/openapitools/client/apis/PetApi.kt | 18 +-- .../org/openapitools/client/apis/StoreApi.kt | 6 +- .../org/openapitools/client/apis/UserApi.kt | 48 ++++---- .../openapitools/client/models/Annotation.kt | 37 ++++++ .../client/models/AnyOfUserOrPet.kt | 103 ++++++++++++++++ .../models/AnyOfUserOrPetOrArrayString.kt | 103 ++++++++++++++++ .../org/openapitools/client/models/Pet.kt | 1 + .../org/openapitools/client/models/User.kt | 8 +- .../openapitools/client/models/UserOrPet.kt | 103 ++++++++++++++++ .../client/models/UserOrPetOrArrayString.kt | 103 ++++++++++++++++ .../openapitools/client/apis/FakeApiTest.kt | 47 ++++++++ .../client/models/AnnotationTest.kt | 35 ++++++ .../models/AnyOfUserOrPetOrArrayStringTest.kt | 111 +++++++++++++++++ .../client/models/AnyOfUserOrPetTest.kt | 111 +++++++++++++++++ .../models/UserOrPetOrArrayStringTest.kt | 111 +++++++++++++++++ .../client/models/UserOrPetTest.kt | 111 +++++++++++++++++ .../README.md | 1 + .../docs/FakeApi.md | 46 +++++++ .../org/openapitools/client/apis/FakeApi.kt | 17 +++ .../org/openapitools/api/FakeApiController.kt | 17 +++ .../src/main/resources/openapi.yaml | 40 +++++++ 37 files changed, 1629 insertions(+), 88 deletions(-) create mode 100644 samples/client/petstore/kotlin-jvm-ktor-gson/docs/Annotation.md create mode 100644 samples/client/petstore/kotlin-jvm-ktor-gson/docs/AnyOfUserOrPet.md create mode 100644 samples/client/petstore/kotlin-jvm-ktor-gson/docs/AnyOfUserOrPetOrArrayString.md create mode 100644 samples/client/petstore/kotlin-jvm-ktor-gson/docs/FakeApi.md create mode 100644 samples/client/petstore/kotlin-jvm-ktor-gson/docs/UserOrPet.md create mode 100644 samples/client/petstore/kotlin-jvm-ktor-gson/docs/UserOrPetOrArrayString.md create mode 100644 samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt create mode 100644 samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/Annotation.kt create mode 100644 samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/AnyOfUserOrPet.kt create mode 100644 samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/AnyOfUserOrPetOrArrayString.kt create mode 100644 samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/UserOrPet.kt create mode 100644 samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/UserOrPetOrArrayString.kt create mode 100644 samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/apis/FakeApiTest.kt create mode 100644 samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/AnnotationTest.kt create mode 100644 samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/AnyOfUserOrPetOrArrayStringTest.kt create mode 100644 samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/AnyOfUserOrPetTest.kt create mode 100644 samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/UserOrPetOrArrayStringTest.kt create mode 100644 samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/UserOrPetTest.kt diff --git a/bin/configs/kotlin-jvm-ktor-gson.yaml b/bin/configs/kotlin-jvm-ktor-gson.yaml index 6b8bd62f644..4a122905f6c 100644 --- a/bin/configs/kotlin-jvm-ktor-gson.yaml +++ b/bin/configs/kotlin-jvm-ktor-gson.yaml @@ -1,7 +1,7 @@ generatorName: kotlin outputDir: samples/client/petstore/kotlin-jvm-ktor-gson library: jvm-ktor -inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml +inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/petstore.yaml templateDir: modules/openapi-generator/src/main/resources/kotlin-client additionalProperties: artifactId: kotlin-petstore-jvm-ktor-gson diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-ktor/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-ktor/api.mustache index c381f3a3874..03efece88e4 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-ktor/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-ktor/api.mustache @@ -69,10 +69,10 @@ import com.fasterxml.jackson.databind.ObjectMapper {{^isArray}} {{^isString}} {{^isNumber}} - {{{paramName}}}?.apply { append("{{{baseName}}}", {{{paramName}}}?.toString()) } + {{{paramName}}}?.apply { append("{{{baseName}}}", {{{paramName}}}.toString()) } {{/isNumber}} {{#isNumber}} - {{{paramName}}}?.apply { append("{{{baseName}}}", {{{paramName}}}?.toString()) } + {{{paramName}}}?.apply { append("{{{baseName}}}", {{{paramName}}}.toString()) } {{/isNumber}} {{/isString}} {{#isString}} @@ -98,10 +98,10 @@ import com.fasterxml.jackson.databind.ObjectMapper {{^isArray}} {{^isString}} {{^isNumber}} - {{{paramName}}}?.apply { it.append("{{{baseName}}}", {{{paramName}}}?.toString()) } + {{{paramName}}}?.apply { it.append("{{{baseName}}}", {{{paramName}}}.toString()) } {{/isNumber}} {{#isNumber}} - {{{paramName}}}?.apply { it.append("{{{baseName}}}", {{{paramName}}}?.toString()) } + {{{paramName}}}?.apply { it.append("{{{baseName}}}", {{{paramName}}}.toString()) } {{/isNumber}} {{/isString}} {{#isString}} diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore.yaml index 789fe3f0139..401f309bf71 100644 --- a/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin/petstore.yaml @@ -584,6 +584,42 @@ paths: responses: '200': description: OK + put: + tags: + - fake + summary: Updates a pet in the store with form data (number) + description: '' + operationId: updatePetWithFormNumber + 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' + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + name: + description: Updated name of the pet + type: string + status: + description: integer type + type: integer + status2: + description: number type + type: number externalDocs: description: Find out more about Swagger url: 'http://swagger.io' diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/.openapi-generator/FILES b/samples/client/petstore/kotlin-jvm-ktor-gson/.openapi-generator/FILES index dce25d98f09..1b45f7fe9a5 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/.openapi-generator/FILES +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/.openapi-generator/FILES @@ -1,7 +1,11 @@ README.md build.gradle +docs/Annotation.md +docs/AnyOfUserOrPet.md +docs/AnyOfUserOrPetOrArrayString.md docs/ApiResponse.md docs/Category.md +docs/FakeApi.md docs/Order.md docs/Pet.md docs/PetApi.md @@ -9,11 +13,14 @@ docs/StoreApi.md docs/Tag.md docs/User.md docs/UserApi.md +docs/UserOrPet.md +docs/UserOrPetOrArrayString.md gradle/wrapper/gradle-wrapper.jar gradle/wrapper/gradle-wrapper.properties gradlew gradlew.bat settings.gradle +src/main/kotlin/org/openapitools/client/apis/FakeApi.kt src/main/kotlin/org/openapitools/client/apis/PetApi.kt src/main/kotlin/org/openapitools/client/apis/StoreApi.kt src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -27,9 +34,14 @@ src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt src/main/kotlin/org/openapitools/client/infrastructure/HttpResponse.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt +src/main/kotlin/org/openapitools/client/models/Annotation.kt +src/main/kotlin/org/openapitools/client/models/AnyOfUserOrPet.kt +src/main/kotlin/org/openapitools/client/models/AnyOfUserOrPetOrArrayString.kt src/main/kotlin/org/openapitools/client/models/Category.kt src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt src/main/kotlin/org/openapitools/client/models/Order.kt src/main/kotlin/org/openapitools/client/models/Pet.kt src/main/kotlin/org/openapitools/client/models/Tag.kt src/main/kotlin/org/openapitools/client/models/User.kt +src/main/kotlin/org/openapitools/client/models/UserOrPet.kt +src/main/kotlin/org/openapitools/client/models/UserOrPetOrArrayString.kt diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/README.md b/samples/client/petstore/kotlin-jvm-ktor-gson/README.md index 2f187ead26c..8fb371d7312 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/README.md +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/README.md @@ -45,6 +45,8 @@ All URIs are relative to *http://petstore.swagger.io/v2* | Class | Method | HTTP request | Description | | ------------ | ------------- | ------------- | ------------- | +| *FakeApi* | [**annotations**](docs/FakeApi.md#annotations) | **POST** /fake/annotations | annotate | +| *FakeApi* | [**updatePetWithFormNumber**](docs/FakeApi.md#updatepetwithformnumber) | **PUT** /fake/annotations | Updates a pet in the store with form data (number) | | *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 | @@ -70,12 +72,17 @@ All URIs are relative to *http://petstore.swagger.io/v2* ## Documentation for Models + - [org.openapitools.client.models.Annotation](docs/Annotation.md) + - [org.openapitools.client.models.AnyOfUserOrPet](docs/AnyOfUserOrPet.md) + - [org.openapitools.client.models.AnyOfUserOrPetOrArrayString](docs/AnyOfUserOrPetOrArrayString.md) - [org.openapitools.client.models.Category](docs/Category.md) - [org.openapitools.client.models.ModelApiResponse](docs/ModelApiResponse.md) - [org.openapitools.client.models.Order](docs/Order.md) - [org.openapitools.client.models.Pet](docs/Pet.md) - [org.openapitools.client.models.Tag](docs/Tag.md) - [org.openapitools.client.models.User](docs/User.md) + - [org.openapitools.client.models.UserOrPet](docs/UserOrPet.md) + - [org.openapitools.client.models.UserOrPetOrArrayString](docs/UserOrPetOrArrayString.md) diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/Annotation.md b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/Annotation.md new file mode 100644 index 00000000000..5836f295e4c --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/Annotation.md @@ -0,0 +1,10 @@ + +# Annotation + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **id** | [**java.util.UUID**](java.util.UUID.md) | | [optional] | + + + diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/AnyOfUserOrPet.md b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/AnyOfUserOrPet.md new file mode 100644 index 00000000000..dccdda0a1f3 --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/AnyOfUserOrPet.md @@ -0,0 +1,29 @@ + +# AnyOfUserOrPet + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **username** | **kotlin.String** | | | +| **name** | **kotlin.String** | | | +| **photoUrls** | **kotlin.collections.List<kotlin.String>** | | | +| **id** | **kotlin.Long** | | [optional] | +| **firstName** | **kotlin.String** | | [optional] | +| **lastName** | **kotlin.String** | | [optional] | +| **email** | **kotlin.String** | | [optional] | +| **password** | **kotlin.String** | | [optional] | +| **phone** | **kotlin.String** | | [optional] | +| **userStatus** | **kotlin.Int** | User Status | [optional] | +| **category** | [**Category**](Category.md) | | [optional] | +| **tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] | +| **status** | [**inline**](#Status) | pet status in the store | [optional] | + + + +## Enum: status +| Name | Value | +| ---- | ----- | +| status | available, pending, sold | + + + diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/AnyOfUserOrPetOrArrayString.md b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/AnyOfUserOrPetOrArrayString.md new file mode 100644 index 00000000000..7f2bee6c621 --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/AnyOfUserOrPetOrArrayString.md @@ -0,0 +1,29 @@ + +# AnyOfUserOrPetOrArrayString + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **username** | **kotlin.String** | | | +| **name** | **kotlin.String** | | | +| **photoUrls** | **kotlin.collections.List<kotlin.String>** | | | +| **id** | **kotlin.Long** | | [optional] | +| **firstName** | **kotlin.String** | | [optional] | +| **lastName** | **kotlin.String** | | [optional] | +| **email** | **kotlin.String** | | [optional] | +| **password** | **kotlin.String** | | [optional] | +| **phone** | **kotlin.String** | | [optional] | +| **userStatus** | **kotlin.Int** | User Status | [optional] | +| **category** | [**Category**](Category.md) | | [optional] | +| **tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] | +| **status** | [**inline**](#Status) | pet status in the store | [optional] | + + + +## Enum: status +| Name | Value | +| ---- | ----- | +| status | available, pending, sold | + + + diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/FakeApi.md b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/FakeApi.md new file mode 100644 index 00000000000..5d6e47a6f2b --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/FakeApi.md @@ -0,0 +1,106 @@ +# FakeApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**annotations**](FakeApi.md#annotations) | **POST** /fake/annotations | annotate | +| [**updatePetWithFormNumber**](FakeApi.md#updatePetWithFormNumber) | **PUT** /fake/annotations | Updates a pet in the store with form data (number) | + + + +# **annotations** +> annotations(`annotation`) + +annotate + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = FakeApi() +val `annotation` : Annotation = // Annotation | +try { + apiInstance.annotations(`annotation`) +} catch (e: ClientException) { + println("4xx response calling FakeApi#annotations") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling FakeApi#annotations") + e.printStackTrace() +} +``` + +### Parameters +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **`annotation`** | [**Annotation**](Annotation.md)| | | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + + +# **updatePetWithFormNumber** +> updatePetWithFormNumber(petId, name, status, status2) + +Updates a pet in the store with form data (number) + + + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = FakeApi() +val petId : kotlin.Long = 789 // kotlin.Long | ID of pet that needs to be updated +val name : kotlin.String = name_example // kotlin.String | Updated name of the pet +val status : kotlin.Int = 56 // kotlin.Int | integer type +val status2 : java.math.BigDecimal = 8.14 // java.math.BigDecimal | number type +try { + apiInstance.updatePetWithFormNumber(petId, name, status, status2) +} catch (e: ClientException) { + println("4xx response calling FakeApi#updatePetWithFormNumber") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling FakeApi#updatePetWithFormNumber") + e.printStackTrace() +} +``` + +### Parameters +| **petId** | **kotlin.Long**| ID of pet that needs to be updated | | +| **name** | **kotlin.String**| Updated name of the pet | [optional] | +| **status** | **kotlin.Int**| integer type | [optional] | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **status2** | **java.math.BigDecimal**| number type | [optional] | + +### Return type + +null (empty response body) + +### Authorization + + +Configure petstore_auth: + ApiClient.accessToken = "" + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/PetApi.md b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/PetApi.md index 0b928e328e6..0a13a8fa8ce 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/PetApi.md +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/PetApi.md @@ -16,10 +16,12 @@ All URIs are relative to *http://petstore.swagger.io/v2* # **addPet** -> addPet(body) +> Pet addPet(pet) Add a new pet to the store + + ### Example ```kotlin // Import classes: @@ -27,9 +29,10 @@ Add a new pet to the store //import org.openapitools.client.models.* val apiInstance = PetApi() -val body : Pet = // Pet | Pet object that needs to be added to the store +val pet : Pet = // Pet | Pet object that needs to be added to the store try { - apiInstance.addPet(body) + val result : Pet = apiInstance.addPet(pet) + println(result) } catch (e: ClientException) { println("4xx response calling PetApi#addPet") e.printStackTrace() @@ -42,11 +45,11 @@ try { ### Parameters | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | ### Return type -null (empty response body) +[**Pet**](Pet.md) ### Authorization @@ -57,7 +60,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: Not defined + - **Accept**: application/xml, application/json # **deletePet** @@ -65,6 +68,8 @@ Configure petstore_auth: Deletes a pet + + ### Example ```kotlin // Import classes: @@ -253,10 +258,12 @@ Configure api_key: # **updatePet** -> updatePet(body) +> Pet updatePet(pet) Update an existing pet + + ### Example ```kotlin // Import classes: @@ -264,9 +271,10 @@ Update an existing pet //import org.openapitools.client.models.* val apiInstance = PetApi() -val body : Pet = // Pet | Pet object that needs to be added to the store +val pet : Pet = // Pet | Pet object that needs to be added to the store try { - apiInstance.updatePet(body) + val result : Pet = apiInstance.updatePet(pet) + println(result) } catch (e: ClientException) { println("4xx response calling PetApi#updatePet") e.printStackTrace() @@ -279,11 +287,11 @@ try { ### Parameters | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | +| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | | ### Return type -null (empty response body) +[**Pet**](Pet.md) ### Authorization @@ -294,7 +302,7 @@ Configure petstore_auth: ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: Not defined + - **Accept**: application/xml, application/json # **updatePetWithForm** @@ -302,6 +310,8 @@ Configure petstore_auth: Updates a pet in the store with form data + + ### Example ```kotlin // Import classes: @@ -351,6 +361,8 @@ Configure petstore_auth: uploads an image + + ### Example ```kotlin // Import classes: diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/StoreApi.md b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/StoreApi.md index 27694e9e710..aac02408ec7 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/StoreApi.md @@ -149,10 +149,12 @@ No authorization required # **placeOrder** -> Order placeOrder(body) +> Order placeOrder(order) Place an order for a pet + + ### Example ```kotlin // Import classes: @@ -160,9 +162,9 @@ Place an order for a pet //import org.openapitools.client.models.* val apiInstance = StoreApi() -val body : Order = // Order | order placed for purchasing the pet +val order : Order = // Order | order placed for purchasing the pet try { - val result : Order = apiInstance.placeOrder(body) + val result : Order = apiInstance.placeOrder(order) println(result) } catch (e: ClientException) { println("4xx response calling StoreApi#placeOrder") @@ -176,7 +178,7 @@ try { ### Parameters | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **body** | [**Order**](Order.md)| order placed for purchasing the pet | | +| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | ### Return type @@ -188,6 +190,6 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: application/xml, application/json diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/User.md b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/User.md index a9f35788637..29af9690cc4 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/User.md +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/User.md @@ -4,8 +4,8 @@ ## Properties | Name | Type | Description | Notes | | ------------ | ------------- | ------------- | ------------- | +| **username** | **kotlin.String** | | | | **id** | **kotlin.Long** | | [optional] | -| **username** | **kotlin.String** | | [optional] | | **firstName** | **kotlin.String** | | [optional] | | **lastName** | **kotlin.String** | | [optional] | | **email** | **kotlin.String** | | [optional] | diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/UserApi.md b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/UserApi.md index 6a4403972b4..055b9506b4d 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/UserApi.md +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/UserApi.md @@ -16,7 +16,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* # **createUser** -> createUser(body) +> createUser(user) Create user @@ -29,9 +29,9 @@ This can only be done by the logged in user. //import org.openapitools.client.models.* val apiInstance = UserApi() -val body : User = // User | Created user object +val user : User = // User | Created user object try { - apiInstance.createUser(body) + apiInstance.createUser(user) } catch (e: ClientException) { println("4xx response calling UserApi#createUser") e.printStackTrace() @@ -44,7 +44,7 @@ try { ### Parameters | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **body** | [**User**](User.md)| Created user object | | +| **user** | [**User**](User.md)| Created user object | | ### Return type @@ -52,19 +52,24 @@ null (empty response body) ### Authorization -No authorization required + +Configure api_key: + ApiClient.apiKey["api_key"] = "" + ApiClient.apiKeyPrefix["api_key"] = "" ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: Not defined # **createUsersWithArrayInput** -> createUsersWithArrayInput(body) +> createUsersWithArrayInput(user) Creates list of users with given input array + + ### Example ```kotlin // Import classes: @@ -72,9 +77,9 @@ Creates list of users with given input array //import org.openapitools.client.models.* val apiInstance = UserApi() -val body : kotlin.collections.List = // kotlin.collections.List | List of user object +val user : kotlin.collections.List = // kotlin.collections.List | List of user object try { - apiInstance.createUsersWithArrayInput(body) + apiInstance.createUsersWithArrayInput(user) } catch (e: ClientException) { println("4xx response calling UserApi#createUsersWithArrayInput") e.printStackTrace() @@ -87,7 +92,7 @@ try { ### Parameters | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **body** | [**kotlin.collections.List<User>**](User.md)| List of user object | | +| **user** | [**kotlin.collections.List<User>**](User.md)| List of user object | | ### Return type @@ -95,19 +100,24 @@ null (empty response body) ### Authorization -No authorization required + +Configure api_key: + ApiClient.apiKey["api_key"] = "" + ApiClient.apiKeyPrefix["api_key"] = "" ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: Not defined # **createUsersWithListInput** -> createUsersWithListInput(body) +> createUsersWithListInput(user) Creates list of users with given input array + + ### Example ```kotlin // Import classes: @@ -115,9 +125,9 @@ Creates list of users with given input array //import org.openapitools.client.models.* val apiInstance = UserApi() -val body : kotlin.collections.List = // kotlin.collections.List | List of user object +val user : kotlin.collections.List = // kotlin.collections.List | List of user object try { - apiInstance.createUsersWithListInput(body) + apiInstance.createUsersWithListInput(user) } catch (e: ClientException) { println("4xx response calling UserApi#createUsersWithListInput") e.printStackTrace() @@ -130,7 +140,7 @@ try { ### Parameters | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **body** | [**kotlin.collections.List<User>**](User.md)| List of user object | | +| **user** | [**kotlin.collections.List<User>**](User.md)| List of user object | | ### Return type @@ -138,11 +148,14 @@ null (empty response body) ### Authorization -No authorization required + +Configure api_key: + ApiClient.apiKey["api_key"] = "" + ApiClient.apiKeyPrefix["api_key"] = "" ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: Not defined @@ -183,7 +196,10 @@ null (empty response body) ### Authorization -No authorization required + +Configure api_key: + ApiClient.apiKey["api_key"] = "" + ApiClient.apiKeyPrefix["api_key"] = "" ### HTTP request headers @@ -196,6 +212,8 @@ No authorization required Get user by user name + + ### Example ```kotlin // Import classes: @@ -240,6 +258,8 @@ No authorization required Logs user into the system + + ### Example ```kotlin // Import classes: @@ -286,6 +306,8 @@ No authorization required Logs out current logged in user session + + ### Example ```kotlin // Import classes: @@ -313,7 +335,10 @@ null (empty response body) ### Authorization -No authorization required + +Configure api_key: + ApiClient.apiKey["api_key"] = "" + ApiClient.apiKeyPrefix["api_key"] = "" ### HTTP request headers @@ -322,7 +347,7 @@ No authorization required # **updateUser** -> updateUser(username, body) +> updateUser(username, user) Updated user @@ -336,9 +361,9 @@ This can only be done by the logged in user. val apiInstance = UserApi() val username : kotlin.String = username_example // kotlin.String | name that need to be deleted -val body : User = // User | Updated user object +val user : User = // User | Updated user object try { - apiInstance.updateUser(username, body) + apiInstance.updateUser(username, user) } catch (e: ClientException) { println("4xx response calling UserApi#updateUser") e.printStackTrace() @@ -352,7 +377,7 @@ try { | **username** | **kotlin.String**| name that need to be deleted | | | Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- | -| **body** | [**User**](User.md)| Updated user object | | +| **user** | [**User**](User.md)| Updated user object | | ### Return type @@ -360,10 +385,13 @@ null (empty response body) ### Authorization -No authorization required + +Configure api_key: + ApiClient.apiKey["api_key"] = "" + ApiClient.apiKeyPrefix["api_key"] = "" ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: Not defined diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/UserOrPet.md b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/UserOrPet.md new file mode 100644 index 00000000000..5412def1fea --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/UserOrPet.md @@ -0,0 +1,29 @@ + +# UserOrPet + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **username** | **kotlin.String** | | | +| **name** | **kotlin.String** | | | +| **photoUrls** | **kotlin.collections.List<kotlin.String>** | | | +| **id** | **kotlin.Long** | | [optional] | +| **firstName** | **kotlin.String** | | [optional] | +| **lastName** | **kotlin.String** | | [optional] | +| **email** | **kotlin.String** | | [optional] | +| **password** | **kotlin.String** | | [optional] | +| **phone** | **kotlin.String** | | [optional] | +| **userStatus** | **kotlin.Int** | User Status | [optional] | +| **category** | [**Category**](Category.md) | | [optional] | +| **tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] | +| **status** | [**inline**](#Status) | pet status in the store | [optional] | + + + +## Enum: status +| Name | Value | +| ---- | ----- | +| status | available, pending, sold | + + + diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/docs/UserOrPetOrArrayString.md b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/UserOrPetOrArrayString.md new file mode 100644 index 00000000000..97281e826da --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/docs/UserOrPetOrArrayString.md @@ -0,0 +1,29 @@ + +# UserOrPetOrArrayString + +## Properties +| Name | Type | Description | Notes | +| ------------ | ------------- | ------------- | ------------- | +| **username** | **kotlin.String** | | | +| **name** | **kotlin.String** | | | +| **photoUrls** | **kotlin.collections.List<kotlin.String>** | | | +| **id** | **kotlin.Long** | | [optional] | +| **firstName** | **kotlin.String** | | [optional] | +| **lastName** | **kotlin.String** | | [optional] | +| **email** | **kotlin.String** | | [optional] | +| **password** | **kotlin.String** | | [optional] | +| **phone** | **kotlin.String** | | [optional] | +| **userStatus** | **kotlin.Int** | User Status | [optional] | +| **category** | [**Category**](Category.md) | | [optional] | +| **tags** | [**kotlin.collections.List<Tag>**](Tag.md) | | [optional] | +| **status** | [**inline**](#Status) | pet status in the store | [optional] | + + + +## Enum: status +| Name | Value | +| ---- | ----- | +| status | available, pending, sold | + + + diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt new file mode 100644 index 00000000000..bc806e41e6d --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt @@ -0,0 +1,113 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.apis + +import org.openapitools.client.models.Annotation + +import org.openapitools.client.infrastructure.* +import io.ktor.client.HttpClientConfig +import io.ktor.client.request.forms.formData +import io.ktor.client.engine.HttpClientEngine +import io.ktor.http.ParametersBuilder +import com.google.gson.Gson +import com.google.gson.GsonBuilder +import java.text.DateFormat + + open class FakeApi( + baseUrl: String = ApiClient.BASE_URL, + httpClientEngine: HttpClientEngine? = null, + httpClientConfig: ((HttpClientConfig<*>) -> Unit)? = null, + jsonBlock: GsonBuilder.() -> Unit = ApiClient.JSON_DEFAULT, + ) : ApiClient( + baseUrl, + httpClientEngine, + httpClientConfig, + jsonBlock, + ) { + + /** + * POST /fake/annotations + * annotate + * + * @param `annotation` + * @return void + */ + open suspend fun annotations(`annotation`: Annotation): HttpResponse { + + val localVariableAuthNames = listOf() + + val localVariableBody = `annotation` + + val localVariableQuery = mutableMapOf>() + + val localVariableHeaders = mutableMapOf() + + val localVariableConfig = RequestConfig( + RequestMethod.POST, + "/fake/annotations", + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + ) + + return jsonRequest( + localVariableConfig, + localVariableBody, + localVariableAuthNames + ).wrap() + } + + /** + * PUT /fake/annotations + * Updates a pet in the store with form data (number) + * + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet (optional) + * @param status integer type (optional) + * @param status2 number type (optional) + * @return void + */ + open suspend fun updatePetWithFormNumber(petId: kotlin.Long, name: kotlin.String?, status: kotlin.Int?, status2: java.math.BigDecimal?): HttpResponse { + + val localVariableAuthNames = listOf("petstore_auth") + + val localVariableBody = + ParametersBuilder().also { + name?.apply { it.append("name", name) } + status?.apply { it.append("status", status.toString()) } + status2?.apply { it.append("status2", status2.toString()) } + }.build() + + val localVariableQuery = mutableMapOf>() + + val localVariableHeaders = mutableMapOf() + + val localVariableConfig = RequestConfig( + RequestMethod.PUT, + "/fake/annotations".replace("{" + "petId" + "}", "$petId"), + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = true, + ) + + return urlEncodedFormRequest( + localVariableConfig, + localVariableBody, + localVariableAuthNames + ).wrap() + } + + } diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index b26f64edb46..10be7a7bdf0 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -43,14 +43,15 @@ import java.text.DateFormat * POST /pet * Add a new pet to the store * - * @param body Pet object that needs to be added to the store - * @return void + * @param pet Pet object that needs to be added to the store + * @return Pet */ - open suspend fun addPet(body: Pet): HttpResponse { + @Suppress("UNCHECKED_CAST") + open suspend fun addPet(pet: Pet): HttpResponse { val localVariableAuthNames = listOf("petstore_auth") - val localVariableBody = body + val localVariableBody = pet val localVariableQuery = mutableMapOf>() @@ -214,14 +215,15 @@ import java.text.DateFormat * PUT /pet * Update an existing pet * - * @param body Pet object that needs to be added to the store - * @return void + * @param pet Pet object that needs to be added to the store + * @return Pet */ - open suspend fun updatePet(body: Pet): HttpResponse { + @Suppress("UNCHECKED_CAST") + open suspend fun updatePet(pet: Pet): HttpResponse { val localVariableAuthNames = listOf("petstore_auth") - val localVariableBody = body + val localVariableBody = pet val localVariableQuery = mutableMapOf>() diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index 14c4ed787f6..170c9cddd0e 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -142,15 +142,15 @@ import java.text.DateFormat * POST /store/order * Place an order for a pet * - * @param body order placed for purchasing the pet + * @param order order placed for purchasing the pet * @return Order */ @Suppress("UNCHECKED_CAST") - open suspend fun placeOrder(body: Order): HttpResponse { + open suspend fun placeOrder(order: Order): HttpResponse { val localVariableAuthNames = listOf() - val localVariableBody = body + val localVariableBody = order val localVariableQuery = mutableMapOf>() diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index ba8677a47f0..4ca87e86566 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -42,14 +42,14 @@ import java.text.DateFormat * POST /user * Create user * This can only be done by the logged in user. - * @param body Created user object + * @param user Created user object * @return void */ - open suspend fun createUser(body: User): HttpResponse { + open suspend fun createUser(user: User): HttpResponse { - val localVariableAuthNames = listOf() + val localVariableAuthNames = listOf("api_key") - val localVariableBody = body + val localVariableBody = user val localVariableQuery = mutableMapOf>() @@ -60,7 +60,7 @@ import java.text.DateFormat "/user", query = localVariableQuery, headers = localVariableHeaders, - requiresAuthentication = false, + requiresAuthentication = true, ) return jsonRequest( @@ -74,14 +74,14 @@ import java.text.DateFormat * POST /user/createWithArray * Creates list of users with given input array * - * @param body List of user object + * @param user List of user object * @return void */ - open suspend fun createUsersWithArrayInput(body: kotlin.collections.List): HttpResponse { + open suspend fun createUsersWithArrayInput(user: kotlin.collections.List): HttpResponse { - val localVariableAuthNames = listOf() + val localVariableAuthNames = listOf("api_key") - val localVariableBody = body + val localVariableBody = user val localVariableQuery = mutableMapOf>() @@ -92,7 +92,7 @@ import java.text.DateFormat "/user/createWithArray", query = localVariableQuery, headers = localVariableHeaders, - requiresAuthentication = false, + requiresAuthentication = true, ) return jsonRequest( @@ -106,14 +106,14 @@ import java.text.DateFormat * POST /user/createWithList * Creates list of users with given input array * - * @param body List of user object + * @param user List of user object * @return void */ - open suspend fun createUsersWithListInput(body: kotlin.collections.List): HttpResponse { + open suspend fun createUsersWithListInput(user: kotlin.collections.List): HttpResponse { - val localVariableAuthNames = listOf() + val localVariableAuthNames = listOf("api_key") - val localVariableBody = body + val localVariableBody = user val localVariableQuery = mutableMapOf>() @@ -124,7 +124,7 @@ import java.text.DateFormat "/user/createWithList", query = localVariableQuery, headers = localVariableHeaders, - requiresAuthentication = false, + requiresAuthentication = true, ) return jsonRequest( @@ -143,7 +143,7 @@ import java.text.DateFormat */ open suspend fun deleteUser(username: kotlin.String): HttpResponse { - val localVariableAuthNames = listOf() + val localVariableAuthNames = listOf("api_key") val localVariableBody = io.ktor.client.utils.EmptyContent @@ -157,7 +157,7 @@ import java.text.DateFormat "/user/{username}".replace("{" + "username" + "}", "$username"), query = localVariableQuery, headers = localVariableHeaders, - requiresAuthentication = false, + requiresAuthentication = true, ) return request( @@ -246,7 +246,7 @@ import java.text.DateFormat */ open suspend fun logoutUser(): HttpResponse { - val localVariableAuthNames = listOf() + val localVariableAuthNames = listOf("api_key") val localVariableBody = io.ktor.client.utils.EmptyContent @@ -260,7 +260,7 @@ import java.text.DateFormat "/user/logout", query = localVariableQuery, headers = localVariableHeaders, - requiresAuthentication = false, + requiresAuthentication = true, ) return request( @@ -275,14 +275,14 @@ import java.text.DateFormat * Updated user * This can only be done by the logged in user. * @param username name that need to be deleted - * @param body Updated user object + * @param user Updated user object * @return void */ - open suspend fun updateUser(username: kotlin.String, body: User): HttpResponse { + open suspend fun updateUser(username: kotlin.String, user: User): HttpResponse { - val localVariableAuthNames = listOf() + val localVariableAuthNames = listOf("api_key") - val localVariableBody = body + val localVariableBody = user val localVariableQuery = mutableMapOf>() @@ -293,7 +293,7 @@ import java.text.DateFormat "/user/{username}".replace("{" + "username" + "}", "$username"), query = localVariableQuery, headers = localVariableHeaders, - requiresAuthentication = false, + requiresAuthentication = true, ) return jsonRequest( diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/Annotation.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/Annotation.kt new file mode 100644 index 00000000000..a4ed7fb3241 --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/Annotation.kt @@ -0,0 +1,37 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + + +import com.google.gson.annotations.SerializedName + +/** + * + * + * @param id + */ + + +data class Annotation ( + + @SerializedName("id") + val id: java.util.UUID? = null + +) { + + +} + diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/AnyOfUserOrPet.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/AnyOfUserOrPet.kt new file mode 100644 index 00000000000..e8926b4189f --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/AnyOfUserOrPet.kt @@ -0,0 +1,103 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.Category +import org.openapitools.client.models.Pet +import org.openapitools.client.models.Tag +import org.openapitools.client.models.User + +import com.google.gson.annotations.SerializedName + +/** + * + * + * @param username + * @param name + * @param photoUrls + * @param id + * @param firstName + * @param lastName + * @param email + * @param password + * @param phone + * @param userStatus User Status + * @param category + * @param tags + * @param status pet status in the store + */ + + +data class AnyOfUserOrPet ( + + @SerializedName("username") + val username: kotlin.String, + + @SerializedName("name") + val name: kotlin.String, + + @SerializedName("photoUrls") + val photoUrls: kotlin.collections.List, + + @SerializedName("id") + val id: kotlin.Long? = null, + + @SerializedName("firstName") + val firstName: kotlin.String? = null, + + @SerializedName("lastName") + val lastName: kotlin.String? = null, + + @SerializedName("email") + val email: kotlin.String? = null, + + @SerializedName("password") + val password: kotlin.String? = null, + + @SerializedName("phone") + val phone: kotlin.String? = null, + + /* User Status */ + @SerializedName("userStatus") + val userStatus: kotlin.Int? = null, + + @SerializedName("category") + val category: Category? = null, + + @SerializedName("tags") + val tags: kotlin.collections.List? = null, + + /* pet status in the store */ + @SerializedName("status") + @Deprecated(message = "This property is deprecated.") + val status: AnyOfUserOrPet.Status? = null + +) { + + /** + * pet status in the store + * + * Values: available,pending,sold,unknown_default_open_api + */ + enum class Status(val value: kotlin.String) { + @SerializedName(value = "available") available("available"), + @SerializedName(value = "pending") pending("pending"), + @SerializedName(value = "sold") sold("sold"), + @SerializedName(value = "unknown_default_open_api") unknown_default_open_api("unknown_default_open_api"); + } + +} + diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/AnyOfUserOrPetOrArrayString.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/AnyOfUserOrPetOrArrayString.kt new file mode 100644 index 00000000000..51b08e2da2e --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/AnyOfUserOrPetOrArrayString.kt @@ -0,0 +1,103 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.Category +import org.openapitools.client.models.Pet +import org.openapitools.client.models.Tag +import org.openapitools.client.models.User + +import com.google.gson.annotations.SerializedName + +/** + * + * + * @param username + * @param name + * @param photoUrls + * @param id + * @param firstName + * @param lastName + * @param email + * @param password + * @param phone + * @param userStatus User Status + * @param category + * @param tags + * @param status pet status in the store + */ + + +data class AnyOfUserOrPetOrArrayString ( + + @SerializedName("username") + val username: kotlin.String, + + @SerializedName("name") + val name: kotlin.String, + + @SerializedName("photoUrls") + val photoUrls: kotlin.collections.List, + + @SerializedName("id") + val id: kotlin.Long? = null, + + @SerializedName("firstName") + val firstName: kotlin.String? = null, + + @SerializedName("lastName") + val lastName: kotlin.String? = null, + + @SerializedName("email") + val email: kotlin.String? = null, + + @SerializedName("password") + val password: kotlin.String? = null, + + @SerializedName("phone") + val phone: kotlin.String? = null, + + /* User Status */ + @SerializedName("userStatus") + val userStatus: kotlin.Int? = null, + + @SerializedName("category") + val category: Category? = null, + + @SerializedName("tags") + val tags: kotlin.collections.List? = null, + + /* pet status in the store */ + @SerializedName("status") + @Deprecated(message = "This property is deprecated.") + val status: AnyOfUserOrPetOrArrayString.Status? = null + +) { + + /** + * pet status in the store + * + * Values: available,pending,sold,unknown_default_open_api + */ + enum class Status(val value: kotlin.String) { + @SerializedName(value = "available") available("available"), + @SerializedName(value = "pending") pending("pending"), + @SerializedName(value = "sold") sold("sold"), + @SerializedName(value = "unknown_default_open_api") unknown_default_open_api("unknown_default_open_api"); + } + +} + diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/Pet.kt index 47a0509474c..5e71ddf3000 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/Pet.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -51,6 +51,7 @@ data class Pet ( /* pet status in the store */ @SerializedName("status") + @Deprecated(message = "This property is deprecated.") val status: Pet.Status? = null ) { diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/User.kt index 62b3ce81f9b..6e6fd34063f 100644 --- a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/User.kt +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/User.kt @@ -21,8 +21,8 @@ import com.google.gson.annotations.SerializedName /** * A User who is purchasing from the pet store * - * @param id * @param username + * @param id * @param firstName * @param lastName * @param email @@ -34,12 +34,12 @@ import com.google.gson.annotations.SerializedName data class User ( + @SerializedName("username") + val username: kotlin.String, + @SerializedName("id") val id: kotlin.Long? = null, - @SerializedName("username") - val username: kotlin.String? = null, - @SerializedName("firstName") val firstName: kotlin.String? = null, diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/UserOrPet.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/UserOrPet.kt new file mode 100644 index 00000000000..7d1c3e240f3 --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/UserOrPet.kt @@ -0,0 +1,103 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.Category +import org.openapitools.client.models.Pet +import org.openapitools.client.models.Tag +import org.openapitools.client.models.User + +import com.google.gson.annotations.SerializedName + +/** + * + * + * @param username + * @param name + * @param photoUrls + * @param id + * @param firstName + * @param lastName + * @param email + * @param password + * @param phone + * @param userStatus User Status + * @param category + * @param tags + * @param status pet status in the store + */ + + +data class UserOrPet ( + + @SerializedName("username") + val username: kotlin.String, + + @SerializedName("name") + val name: kotlin.String, + + @SerializedName("photoUrls") + val photoUrls: kotlin.collections.List, + + @SerializedName("id") + val id: kotlin.Long? = null, + + @SerializedName("firstName") + val firstName: kotlin.String? = null, + + @SerializedName("lastName") + val lastName: kotlin.String? = null, + + @SerializedName("email") + val email: kotlin.String? = null, + + @SerializedName("password") + val password: kotlin.String? = null, + + @SerializedName("phone") + val phone: kotlin.String? = null, + + /* User Status */ + @SerializedName("userStatus") + val userStatus: kotlin.Int? = null, + + @SerializedName("category") + val category: Category? = null, + + @SerializedName("tags") + val tags: kotlin.collections.List? = null, + + /* pet status in the store */ + @SerializedName("status") + @Deprecated(message = "This property is deprecated.") + val status: UserOrPet.Status? = null + +) { + + /** + * pet status in the store + * + * Values: available,pending,sold,unknown_default_open_api + */ + enum class Status(val value: kotlin.String) { + @SerializedName(value = "available") available("available"), + @SerializedName(value = "pending") pending("pending"), + @SerializedName(value = "sold") sold("sold"), + @SerializedName(value = "unknown_default_open_api") unknown_default_open_api("unknown_default_open_api"); + } + +} + diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/UserOrPetOrArrayString.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/UserOrPetOrArrayString.kt new file mode 100644 index 00000000000..085a1bae4a0 --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/models/UserOrPetOrArrayString.kt @@ -0,0 +1,103 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import org.openapitools.client.models.Category +import org.openapitools.client.models.Pet +import org.openapitools.client.models.Tag +import org.openapitools.client.models.User + +import com.google.gson.annotations.SerializedName + +/** + * + * + * @param username + * @param name + * @param photoUrls + * @param id + * @param firstName + * @param lastName + * @param email + * @param password + * @param phone + * @param userStatus User Status + * @param category + * @param tags + * @param status pet status in the store + */ + + +data class UserOrPetOrArrayString ( + + @SerializedName("username") + val username: kotlin.String, + + @SerializedName("name") + val name: kotlin.String, + + @SerializedName("photoUrls") + val photoUrls: kotlin.collections.List, + + @SerializedName("id") + val id: kotlin.Long? = null, + + @SerializedName("firstName") + val firstName: kotlin.String? = null, + + @SerializedName("lastName") + val lastName: kotlin.String? = null, + + @SerializedName("email") + val email: kotlin.String? = null, + + @SerializedName("password") + val password: kotlin.String? = null, + + @SerializedName("phone") + val phone: kotlin.String? = null, + + /* User Status */ + @SerializedName("userStatus") + val userStatus: kotlin.Int? = null, + + @SerializedName("category") + val category: Category? = null, + + @SerializedName("tags") + val tags: kotlin.collections.List? = null, + + /* pet status in the store */ + @SerializedName("status") + @Deprecated(message = "This property is deprecated.") + val status: UserOrPetOrArrayString.Status? = null + +) { + + /** + * pet status in the store + * + * Values: available,pending,sold,unknown_default_open_api + */ + enum class Status(val value: kotlin.String) { + @SerializedName(value = "available") available("available"), + @SerializedName(value = "pending") pending("pending"), + @SerializedName(value = "sold") sold("sold"), + @SerializedName(value = "unknown_default_open_api") unknown_default_open_api("unknown_default_open_api"); + } + +} + diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/apis/FakeApiTest.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/apis/FakeApiTest.kt new file mode 100644 index 00000000000..05b5f396739 --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/apis/FakeApiTest.kt @@ -0,0 +1,47 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.apis + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.apis.FakeApi +import org.openapitools.client.models.Annotation + +class FakeApiTest : ShouldSpec() { + init { + // uncomment below to create an instance of FakeApi + //val apiInstance = FakeApi() + + // to test annotations + should("test annotations") { + // uncomment below to test annotations + //val `annotation` : Annotation = // Annotation | + //apiInstance.annotations(`annotation`) + } + + // to test updatePetWithFormNumber + should("test updatePetWithFormNumber") { + // uncomment below to test updatePetWithFormNumber + //val petId : kotlin.Long = 789 // kotlin.Long | ID of pet that needs to be updated + //val name : kotlin.String = name_example // kotlin.String | Updated name of the pet + //val status : kotlin.Int = 56 // kotlin.Int | integer type + //val status2 : java.math.BigDecimal = 8.14 // java.math.BigDecimal | number type + //apiInstance.updatePetWithFormNumber(petId, name, status, status2) + } + + } +} diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/AnnotationTest.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/AnnotationTest.kt new file mode 100644 index 00000000000..7110952e150 --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/AnnotationTest.kt @@ -0,0 +1,35 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.Annotation + +class AnnotationTest : ShouldSpec() { + init { + // uncomment below to create an instance of Annotation + //val modelInstance = Annotation() + + // to test the property `id` + should("test id") { + // uncomment below to test the property + //modelInstance.id shouldBe ("TODO") + } + + } +} diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/AnyOfUserOrPetOrArrayStringTest.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/AnyOfUserOrPetOrArrayStringTest.kt new file mode 100644 index 00000000000..76a2fc35450 --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/AnyOfUserOrPetOrArrayStringTest.kt @@ -0,0 +1,111 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.AnyOfUserOrPetOrArrayString +import org.openapitools.client.models.Category +import org.openapitools.client.models.Pet +import org.openapitools.client.models.Tag +import org.openapitools.client.models.User + +class AnyOfUserOrPetOrArrayStringTest : ShouldSpec() { + init { + // uncomment below to create an instance of AnyOfUserOrPetOrArrayString + //val modelInstance = AnyOfUserOrPetOrArrayString() + + // to test the property `username` + should("test username") { + // uncomment below to test the property + //modelInstance.username shouldBe ("TODO") + } + + // to test the property `name` + should("test name") { + // uncomment below to test the property + //modelInstance.name shouldBe ("TODO") + } + + // to test the property `photoUrls` + should("test photoUrls") { + // uncomment below to test the property + //modelInstance.photoUrls shouldBe ("TODO") + } + + // to test the property `id` + should("test id") { + // uncomment below to test the property + //modelInstance.id shouldBe ("TODO") + } + + // to test the property `firstName` + should("test firstName") { + // uncomment below to test the property + //modelInstance.firstName shouldBe ("TODO") + } + + // to test the property `lastName` + should("test lastName") { + // uncomment below to test the property + //modelInstance.lastName shouldBe ("TODO") + } + + // to test the property `email` + should("test email") { + // uncomment below to test the property + //modelInstance.email shouldBe ("TODO") + } + + // to test the property `password` + should("test password") { + // uncomment below to test the property + //modelInstance.password shouldBe ("TODO") + } + + // to test the property `phone` + should("test phone") { + // uncomment below to test the property + //modelInstance.phone shouldBe ("TODO") + } + + // to test the property `userStatus` - User Status + should("test userStatus") { + // uncomment below to test the property + //modelInstance.userStatus shouldBe ("TODO") + } + + // to test the property `category` + should("test category") { + // uncomment below to test the property + //modelInstance.category shouldBe ("TODO") + } + + // to test the property `tags` + should("test tags") { + // uncomment below to test the property + //modelInstance.tags shouldBe ("TODO") + } + + // to test the property `status` - pet status in the store + should("test status") { + // uncomment below to test the property + //modelInstance.status shouldBe ("TODO") + } + + } +} diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/AnyOfUserOrPetTest.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/AnyOfUserOrPetTest.kt new file mode 100644 index 00000000000..cf4d7db0179 --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/AnyOfUserOrPetTest.kt @@ -0,0 +1,111 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.AnyOfUserOrPet +import org.openapitools.client.models.Category +import org.openapitools.client.models.Pet +import org.openapitools.client.models.Tag +import org.openapitools.client.models.User + +class AnyOfUserOrPetTest : ShouldSpec() { + init { + // uncomment below to create an instance of AnyOfUserOrPet + //val modelInstance = AnyOfUserOrPet() + + // to test the property `username` + should("test username") { + // uncomment below to test the property + //modelInstance.username shouldBe ("TODO") + } + + // to test the property `name` + should("test name") { + // uncomment below to test the property + //modelInstance.name shouldBe ("TODO") + } + + // to test the property `photoUrls` + should("test photoUrls") { + // uncomment below to test the property + //modelInstance.photoUrls shouldBe ("TODO") + } + + // to test the property `id` + should("test id") { + // uncomment below to test the property + //modelInstance.id shouldBe ("TODO") + } + + // to test the property `firstName` + should("test firstName") { + // uncomment below to test the property + //modelInstance.firstName shouldBe ("TODO") + } + + // to test the property `lastName` + should("test lastName") { + // uncomment below to test the property + //modelInstance.lastName shouldBe ("TODO") + } + + // to test the property `email` + should("test email") { + // uncomment below to test the property + //modelInstance.email shouldBe ("TODO") + } + + // to test the property `password` + should("test password") { + // uncomment below to test the property + //modelInstance.password shouldBe ("TODO") + } + + // to test the property `phone` + should("test phone") { + // uncomment below to test the property + //modelInstance.phone shouldBe ("TODO") + } + + // to test the property `userStatus` - User Status + should("test userStatus") { + // uncomment below to test the property + //modelInstance.userStatus shouldBe ("TODO") + } + + // to test the property `category` + should("test category") { + // uncomment below to test the property + //modelInstance.category shouldBe ("TODO") + } + + // to test the property `tags` + should("test tags") { + // uncomment below to test the property + //modelInstance.tags shouldBe ("TODO") + } + + // to test the property `status` - pet status in the store + should("test status") { + // uncomment below to test the property + //modelInstance.status shouldBe ("TODO") + } + + } +} diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/UserOrPetOrArrayStringTest.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/UserOrPetOrArrayStringTest.kt new file mode 100644 index 00000000000..f996252e919 --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/UserOrPetOrArrayStringTest.kt @@ -0,0 +1,111 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.UserOrPetOrArrayString +import org.openapitools.client.models.Category +import org.openapitools.client.models.Pet +import org.openapitools.client.models.Tag +import org.openapitools.client.models.User + +class UserOrPetOrArrayStringTest : ShouldSpec() { + init { + // uncomment below to create an instance of UserOrPetOrArrayString + //val modelInstance = UserOrPetOrArrayString() + + // to test the property `username` + should("test username") { + // uncomment below to test the property + //modelInstance.username shouldBe ("TODO") + } + + // to test the property `name` + should("test name") { + // uncomment below to test the property + //modelInstance.name shouldBe ("TODO") + } + + // to test the property `photoUrls` + should("test photoUrls") { + // uncomment below to test the property + //modelInstance.photoUrls shouldBe ("TODO") + } + + // to test the property `id` + should("test id") { + // uncomment below to test the property + //modelInstance.id shouldBe ("TODO") + } + + // to test the property `firstName` + should("test firstName") { + // uncomment below to test the property + //modelInstance.firstName shouldBe ("TODO") + } + + // to test the property `lastName` + should("test lastName") { + // uncomment below to test the property + //modelInstance.lastName shouldBe ("TODO") + } + + // to test the property `email` + should("test email") { + // uncomment below to test the property + //modelInstance.email shouldBe ("TODO") + } + + // to test the property `password` + should("test password") { + // uncomment below to test the property + //modelInstance.password shouldBe ("TODO") + } + + // to test the property `phone` + should("test phone") { + // uncomment below to test the property + //modelInstance.phone shouldBe ("TODO") + } + + // to test the property `userStatus` - User Status + should("test userStatus") { + // uncomment below to test the property + //modelInstance.userStatus shouldBe ("TODO") + } + + // to test the property `category` + should("test category") { + // uncomment below to test the property + //modelInstance.category shouldBe ("TODO") + } + + // to test the property `tags` + should("test tags") { + // uncomment below to test the property + //modelInstance.tags shouldBe ("TODO") + } + + // to test the property `status` - pet status in the store + should("test status") { + // uncomment below to test the property + //modelInstance.status shouldBe ("TODO") + } + + } +} diff --git a/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/UserOrPetTest.kt b/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/UserOrPetTest.kt new file mode 100644 index 00000000000..645e8e5de20 --- /dev/null +++ b/samples/client/petstore/kotlin-jvm-ktor-gson/src/test/kotlin/org/openapitools/client/models/UserOrPetTest.kt @@ -0,0 +1,111 @@ +/** + * + * Please note: + * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * Do not edit this file manually. + * + */ + +@file:Suppress( + "ArrayInDataClass", + "EnumEntryName", + "RemoveRedundantQualifierName", + "UnusedImport" +) + +package org.openapitools.client.models + +import io.kotlintest.shouldBe +import io.kotlintest.specs.ShouldSpec + +import org.openapitools.client.models.UserOrPet +import org.openapitools.client.models.Category +import org.openapitools.client.models.Pet +import org.openapitools.client.models.Tag +import org.openapitools.client.models.User + +class UserOrPetTest : ShouldSpec() { + init { + // uncomment below to create an instance of UserOrPet + //val modelInstance = UserOrPet() + + // to test the property `username` + should("test username") { + // uncomment below to test the property + //modelInstance.username shouldBe ("TODO") + } + + // to test the property `name` + should("test name") { + // uncomment below to test the property + //modelInstance.name shouldBe ("TODO") + } + + // to test the property `photoUrls` + should("test photoUrls") { + // uncomment below to test the property + //modelInstance.photoUrls shouldBe ("TODO") + } + + // to test the property `id` + should("test id") { + // uncomment below to test the property + //modelInstance.id shouldBe ("TODO") + } + + // to test the property `firstName` + should("test firstName") { + // uncomment below to test the property + //modelInstance.firstName shouldBe ("TODO") + } + + // to test the property `lastName` + should("test lastName") { + // uncomment below to test the property + //modelInstance.lastName shouldBe ("TODO") + } + + // to test the property `email` + should("test email") { + // uncomment below to test the property + //modelInstance.email shouldBe ("TODO") + } + + // to test the property `password` + should("test password") { + // uncomment below to test the property + //modelInstance.password shouldBe ("TODO") + } + + // to test the property `phone` + should("test phone") { + // uncomment below to test the property + //modelInstance.phone shouldBe ("TODO") + } + + // to test the property `userStatus` - User Status + should("test userStatus") { + // uncomment below to test the property + //modelInstance.userStatus shouldBe ("TODO") + } + + // to test the property `category` + should("test category") { + // uncomment below to test the property + //modelInstance.category shouldBe ("TODO") + } + + // to test the property `tags` + should("test tags") { + // uncomment below to test the property + //modelInstance.tags shouldBe ("TODO") + } + + // to test the property `status` - pet status in the store + should("test status") { + // uncomment below to test the property + //modelInstance.status shouldBe ("TODO") + } + + } +} diff --git a/samples/client/petstore/kotlin-model-prefix-type-mappings/README.md b/samples/client/petstore/kotlin-model-prefix-type-mappings/README.md index a39d9c63afb..3cb41741a78 100644 --- a/samples/client/petstore/kotlin-model-prefix-type-mappings/README.md +++ b/samples/client/petstore/kotlin-model-prefix-type-mappings/README.md @@ -46,6 +46,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* | Class | Method | HTTP request | Description | | ------------ | ------------- | ------------- | ------------- | | *FakeApi* | [**annotations**](docs/FakeApi.md#annotations) | **POST** fake/annotations | annotate | +| *FakeApi* | [**updatePetWithFormNumber**](docs/FakeApi.md#updatepetwithformnumber) | **PUT** fake/annotations | Updates a pet in the store with form data (number) | | *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 | diff --git a/samples/client/petstore/kotlin-model-prefix-type-mappings/docs/FakeApi.md b/samples/client/petstore/kotlin-model-prefix-type-mappings/docs/FakeApi.md index f66027e7db9..86d58dbcdbf 100644 --- a/samples/client/petstore/kotlin-model-prefix-type-mappings/docs/FakeApi.md +++ b/samples/client/petstore/kotlin-model-prefix-type-mappings/docs/FakeApi.md @@ -5,6 +5,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* | Method | HTTP request | Description | | ------------- | ------------- | ------------- | | [**annotations**](FakeApi.md#annotations) | **POST** fake/annotations | annotate | +| [**updatePetWithFormNumber**](FakeApi.md#updatePetWithFormNumber) | **PUT** fake/annotations | Updates a pet in the store with form data (number) | @@ -44,3 +45,48 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined + +Updates a pet in the store with form data (number) + + + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.* +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiClient = ApiClient() +val webService = apiClient.createWebservice(FakeApi::class.java) +val petId : kotlin.Long = 789 // kotlin.Long | ID of pet that needs to be updated +val name : kotlin.String = name_example // kotlin.String | Updated name of the pet +val status : kotlin.Int = 56 // kotlin.Int | integer type +val status2 : java.math.BigDecimal = 8.14 // java.math.BigDecimal | number type + +launch(Dispatchers.IO) { + webService.updatePetWithFormNumber(petId, name, status, status2) +} +``` + +### Parameters +| **petId** | **kotlin.Long**| ID of pet that needs to be updated | | +| **name** | **kotlin.String**| Updated name of the pet | [optional] | +| **status** | **kotlin.Int**| integer type | [optional] | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **status2** | **java.math.BigDecimal**| number type | [optional] | + +### Return type + +null (empty response body) + +### Authorization + + + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + diff --git a/samples/client/petstore/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt b/samples/client/petstore/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt index 9e7c2535a04..a91226ee152 100644 --- a/samples/client/petstore/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt +++ b/samples/client/petstore/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/apis/FakeApi.kt @@ -22,4 +22,21 @@ interface FakeApi { @POST("fake/annotations") suspend fun annotations(@Body apiAnnotation: ApiAnnotation): Response + /** + * PUT fake/annotations + * Updates a pet in the store with form data (number) + * + * Responses: + * - 405: Invalid input + * + * @param petId ID of pet that needs to be updated + * @param name Updated name of the pet (optional) + * @param status integer type (optional) + * @param status2 number type (optional) + * @return [Unit] + */ + @FormUrlEncoded + @PUT("fake/annotations") + suspend fun updatePetWithFormNumber(@Path("petId") petId: kotlin.Long, @Field("name") name: kotlin.String? = null, @Field("status") status: kotlin.Int? = null, @Field("status2") status2: java.math.BigDecimal? = null): Response + } diff --git a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/FakeApiController.kt b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/FakeApiController.kt index 35d462a6a29..e89b886bd6a 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/FakeApiController.kt +++ b/samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/FakeApiController.kt @@ -48,4 +48,21 @@ class FakeApiController() { fun annotations(@Parameter(description = "", required = true) @Valid @RequestBody `annotation`: Annotation): ResponseEntity { return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) } + + @Operation( + summary = "Updates a pet in the store with form data (number)", + operationId = "updatePetWithFormNumber", + description = """""", + responses = [ + ApiResponse(responseCode = "405", description = "Invalid input") ], + security = [ SecurityRequirement(name = "petstore_auth", scopes = [ "write:pets", "read:pets" ]) ] + ) + @RequestMapping( + method = [RequestMethod.PUT], + value = ["/fake/annotations"], + consumes = ["application/x-www-form-urlencoded"] + ) + fun updatePetWithFormNumber(@Parameter(description = "ID of pet that needs to be updated", required = true) @PathVariable("petId") petId: kotlin.Long,@Parameter(description = "Updated name of the pet") @Valid @RequestParam(value = "name", required = false) name: kotlin.String? ,@Parameter(description = "integer type") @Valid @RequestParam(value = "status", required = false) status: kotlin.Int? ,@Parameter(description = "number type") @Valid @RequestParam(value = "status2", required = false) status2: java.math.BigDecimal? ): ResponseEntity { + return ResponseEntity(HttpStatus.NOT_IMPLEMENTED) + } } diff --git a/samples/server/petstore/kotlin-spring-default/src/main/resources/openapi.yaml b/samples/server/petstore/kotlin-spring-default/src/main/resources/openapi.yaml index c1041c420e3..1d90883560f 100644 --- a/samples/server/petstore/kotlin-spring-default/src/main/resources/openapi.yaml +++ b/samples/server/petstore/kotlin-spring-default/src/main/resources/openapi.yaml @@ -597,6 +597,34 @@ paths: summary: annotate tags: - fake + put: + description: "" + operationId: updatePetWithFormNumber + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: "#/components/schemas/updatePetWithFormNumber_request" + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data (number) + tags: + - fake components: requestBodies: UserArray: @@ -843,6 +871,18 @@ components: format: binary type: string type: object + updatePetWithFormNumber_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: integer type + type: integer + status2: + description: number type + type: number + type: object securitySchemes: petstore_auth: flows: