diff --git a/.github/workflows/samples-kotlin-client.yaml b/.github/workflows/samples-kotlin-client.yaml index 7ec4a90ece2..8e185879c83 100644 --- a/.github/workflows/samples-kotlin-client.yaml +++ b/.github/workflows/samples-kotlin-client.yaml @@ -65,6 +65,7 @@ jobs: - samples/client/petstore/kotlin-jvm-spring-2-webclient - samples/client/petstore/kotlin-jvm-spring-3-webclient - samples/client/petstore/kotlin-jvm-spring-3-restclient + - samples/client/echo_api/kotlin-jvm-spring-3-restclient - samples/client/petstore/kotlin-spring-cloud - samples/client/petstore/kotlin-name-parameter-mappings - samples/client/others/kotlin-jvm-okhttp-parameter-tests diff --git a/bin/configs/kotlin-jvm-spring-3-restclient-echo-api.yaml b/bin/configs/kotlin-jvm-spring-3-restclient-echo-api.yaml new file mode 100644 index 00000000000..1f9dea0d92c --- /dev/null +++ b/bin/configs/kotlin-jvm-spring-3-restclient-echo-api.yaml @@ -0,0 +1,9 @@ +generatorName: kotlin +outputDir: samples/client/echo_api/kotlin-jvm-spring-3-restclient +library: jvm-spring-restclient +inputSpec: modules/openapi-generator/src/test/resources/3_0/kotlin/echo_api.yaml +templateDir: modules/openapi-generator/src/main/resources/kotlin-client +additionalProperties: + enumUnknownDefaultCase: true + serializationLibrary: jackson + useSpringBoot3: true diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-spring-restclient/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-spring-restclient/api.mustache index 5e28a2fc7e2..549d45e94b8 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-spring-restclient/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-spring-restclient/api.mustache @@ -67,8 +67,10 @@ import {{packageName}}.infrastructure.* @Deprecated(message = "This operation is deprecated.") {{/isDeprecated}} fun {{operationId}}({{#allParams}}{{{paramName}}}: {{#isEnum}}{{#isContainer}}kotlin.collections.List<{{enumName}}{{operationIdCamelCase}}>{{/isContainer}}{{^isContainer}}{{enumName}}{{operationIdCamelCase}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{defaultValue}}}.toDouble(){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}): {{#returnType}}{{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}} { - return {{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}} = {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) - .body!! + val result = {{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}} = {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) + {{#returnType}} + return result.body!! + {{/returnType}} } @Throws(RestClientResponseException::class) diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-spring-webclient/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-spring-webclient/api.mustache index 199bee64460..918be27a2fa 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-spring-webclient/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-spring-webclient/api.mustache @@ -72,7 +72,7 @@ import {{packageName}}.infrastructure.* {{/isDeprecated}} fun {{operationId}}({{#allParams}}{{{paramName}}}: {{#isEnum}}{{#isContainer}}kotlin.collections.List<{{enumName}}{{operationIdCamelCase}}>{{/isContainer}}{{^isContainer}}{{enumName}}{{operationIdCamelCase}}{{/isContainer}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}{{^required}}?{{#defaultValue}} = {{^isNumber}}{{#isEnum}}{{enumName}}{{operationIdCamelCase}}.{{enumDefaultValue}}{{/isEnum}}{{^isEnum}}{{{defaultValue}}}{{/isEnum}}{{/isNumber}}{{#isNumber}}{{{defaultValue}}}.toDouble(){{/isNumber}}{{/defaultValue}}{{^defaultValue}} = null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}): Mono<{{#returnType}}{{{returnType}}}{{#nullableReturnType}}?{{/nullableReturnType}}{{/returnType}}{{^returnType}}Unit{{/returnType}}> { return {{operationId}}WithHttpInfo({{#allParams}}{{{paramName}}} = {{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}) - .map { it.body } + .map { {{#returnType}}it.body{{/returnType}}{{^returnType}}Unit{{/returnType}} } } @Throws(WebClientResponseException::class) diff --git a/modules/openapi-generator/src/test/resources/3_0/kotlin/echo_api.yaml b/modules/openapi-generator/src/test/resources/3_0/kotlin/echo_api.yaml new file mode 100644 index 00000000000..a549fa70a3a --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/kotlin/echo_api.yaml @@ -0,0 +1,812 @@ +# +# Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +openapi: 3.0.3 +info: + title: Echo Server API + description: Echo Server API + contact: + email: team@openapitools.org + license: + name: Apache 2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + version: 0.1.0 +servers: + - url: http://localhost:3000/ +paths: + # Path usually starts with parameter type such as path, query, header, form + # For body/form parameters, path starts with "/echo" so the the echo server + # will response with the same body in the HTTP request. + # + # path parameter tests + /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}: + get: + tags: + - path + summary: Test path parameter(s) + description: Test path parameter(s) + operationId: tests/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} + parameters: + - in: path + name: path_string + required: true + schema: + type: string + - in: path + name: path_integer + required: true + schema: + type: integer + - in: path + name: enum_nonref_string_path + required: true + schema: + type: string + enum: + - success + - failure + - unclassified + - in: path + name: enum_ref_string_path + required: true + schema: + $ref: '#/components/schemas/StringEnumRef' + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string + # form parameter tests + /form/integer/boolean/string: + post: + tags: + - form + summary: Test form parameter(s) + description: Test form parameter(s) + operationId: test/form/integer/boolean/string + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + integer_form: + type: integer + boolean_form: + type: boolean + string_form: + type: string + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string + # form parameter tests for oneOf schema + /form/oneof: + post: + tags: + - form + summary: Test form parameter(s) for oneOf schema + description: Test form parameter(s) for oneOf schema + operationId: test/form/oneof + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + oneOf: + - type: object + properties: + form1: + type: string + form2: + type: integer + - type: object + properties: + form3: + type: string + form4: + type: boolean + - $ref: '#/components/schemas/Tag' + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string + # header parameter tests + /header/integer/boolean/string/enums: + get: + tags: + - header + summary: Test header parameter(s) + description: Test header parameter(s) + operationId: test/header/integer/boolean/string/enums + parameters: + - in: header + name: integer_header + style: form #default + explode: true #default + schema: + type: integer + - in: header + name: boolean_header + style: form #default + explode: true #default + schema: + type: boolean + - in: header + name: string_header + style: form #default + explode: true #default + schema: + type: string + - in: header + name: enum_nonref_string_header + style: form #default + explode: true #default + schema: + type: string + enum: + - success + - failure + - unclassified + - in: header + name: enum_ref_string_header + style: form #default + explode: true #default + schema: + $ref: '#/components/schemas/StringEnumRef' + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string + # query parameter tests + /query/enum_ref_string: + get: + tags: + - query + summary: Test query parameter(s) + description: Test query parameter(s) + operationId: test/enum_ref_string + parameters: + - in: query + name: enum_nonref_string_query + style: form #default + explode: true #default + schema: + type: string + enum: + - success + - failure + - unclassified + - in: query + name: enum_ref_string_query + style: form #default + explode: true #default + schema: + $ref: '#/components/schemas/StringEnumRef' + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string + /query/datetime/date/string: + get: + tags: + - query + summary: Test query parameter(s) + description: Test query parameter(s) + operationId: test/query/datetime/date/string + parameters: + - in: query + name: datetime_query + style: form #default + explode: true #default + schema: + type: string + format: date-time + - in: query + name: date_query + style: form #default + explode: true #default + schema: + type: string + format: date + - in: query + name: string_query + style: form #default + explode: true #default + schema: + type: string + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string + /query/integer/boolean/string: + get: + tags: + - query + summary: Test query parameter(s) + description: Test query parameter(s) + operationId: test/query/integer/boolean/string + parameters: + - in: query + name: integer_query + style: form #default + explode: true #default + schema: + type: integer + - in: query + name: boolean_query + style: form #default + explode: true #default + schema: + type: boolean + - in: query + name: string_query + style: form #default + explode: true #default + schema: + type: string + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string + /query/style_form/explode_true/array_string: + get: + tags: + - query + summary: Test query parameter(s) + description: Test query parameter(s) + operationId: test/query/style_form/explode_true/array_string + parameters: + - in: query + name: query_object + style: form #default + explode: true #default + schema: + type: object + properties: + values: + type: array + items: + type: string + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string + /query/style_form/explode_true/object: + get: + tags: + - query + summary: Test query parameter(s) + description: Test query parameter(s) + operationId: test/query/style_form/explode_true/object + parameters: + - in: query + name: query_object + style: form #default + explode: true #default + schema: + $ref: '#/components/schemas/Pet' + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string +# The following lines are disabled due to missing support for allOf. Enable when support is added. +# /query/style_form/explode_true/object/allOf: +# get: +# tags: +# - query +# summary: Test query parameter(s) +# description: Test query parameter(s) +# operationId: test/query/style_form/explode_true/object/allOf +# parameters: +# - in: query +# name: query_object +# style: form #default +# explode: true #default +# schema: +# $ref: '#/components/schemas/DataQuery' +# responses: +# '200': +# description: Successful operation +# content: +# text/plain: +# schema: +# type: string + /query/style_deepObject/explode_true/object: + get: + tags: + - query + summary: Test query parameter(s) + description: Test query parameter(s) + operationId: test/query/style_deepObject/explode_true/object + parameters: + - in: query + name: query_object + style: deepObject + explode: true #default + schema: + $ref: '#/components/schemas/Pet' + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string +# The following lines are disabled due to missing support for allOf. Enable when support is added. +# /query/style_deepObject/explode_true/object/allOf: +# get: +# tags: +# - query +# summary: Test query parameter(s) +# description: Test query parameter(s) +# operationId: test/query/style_deepObject/explode_true/object/allOf +# parameters: +# - in: query +# name: query_object +# style: deepObject +# explode: true #default +# schema: +# allOf: +# - $ref: '#/components/schemas/Bird' +# - $ref: '#/components/schemas/Category' +# responses: +# '200': +# description: Successful operation +# content: +# text/plain: +# schema: +# type: string + # body parameter tests + /body/application/octetstream/binary: + post: + tags: + - body + summary: Test body parameter(s) + description: Test body parameter(s) + operationId: test/body/application/octetstream/binary + requestBody: + content: + application/octet-stream: + schema: + type: string + format: binary + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string + /echo/body/Pet: + post: + tags: + - body + summary: Test body parameter(s) + description: Test body parameter(s) + operationId: test/echo/body/Pet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + # The following lines are disabled due to missing support for allOf. Enable when support is added. +# /echo/body/allOf/Pet: +# post: +# tags: +# - body +# summary: Test body parameter(s) +# description: Test body parameter(s) +# operationId: test/echo/body/allOf/Pet +# requestBody: +# $ref: '#/components/requestBodies/AllOfPet' +# responses: +# '200': +# description: Successful operation +# content: +# application/json: +# schema: +# $ref: '#/components/schemas/Pet' + /echo/body/Pet/response_string: + post: + tags: + - body + summary: Test empty response body + description: Test empty response body + operationId: test/echo/body/Pet/response_string + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string + /echo/body/Tag/response_string: + post: + tags: + - body + summary: Test empty json (request body) + description: Test empty json (request body) + operationId: test/echo/body/Tag/response_string + requestBody: + $ref: '#/components/requestBodies/Tag' + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string + /echo/body/FreeFormObject/response_string: + post: + tags: + - body + summary: Test free form object + description: Test free form object + operationId: test/echo/body/FreeFormObject/response_string + requestBody: + content: + application/json: + schema: + type: object + description: Free form object + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string + /binary/gif: + post: + tags: + - body + summary: Test binary (gif) response body + description: Test binary (gif) response body + operationId: test/binary/gif + responses: + '200': + description: Successful operation + content: + image/gif: + schema: + type: string + format: binary + # Single binary in multipart mime test + /body/application/octetstream/single_binary: + post: + tags: + - body + summary: Test single binary in multipart mime + description: Test single binary in multipart mime + operationId: test/body/multipart/formdata/single_binary + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + my-file: + type: string + format: binary + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string + # Array of binary in multipart mime tests + /body/application/octetstream/array_of_binary: + post: + tags: + - body + summary: Test array of binary in multipart mime + description: Test array of binary in multipart mime + operationId: test/body/multipart/formdata/array_of_binary + requestBody: + content: + multipart/form-data: + schema: + required: + - files + type: object + properties: + files: + type: array + items: + type: string + format: binary + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string + # To test http basic auth + /auth/http/basic: + post: + tags: + - auth + security: + - http_auth: [] + summary: To test HTTP basic authentication + description: To test HTTP basic authentication + operationId: test/auth/http/basic + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string + # To test http bearer auth + /auth/http/bearer: + post: + tags: + - auth + security: + - http_bearer_auth: [] + summary: To test HTTP bearer authentication + description: To test HTTP bearer authentication + operationId: test/auth/http/bearer + responses: + '200': + description: Successful operation + content: + text/plain: + schema: + type: string +components: + securitySchemes: + http_auth: + type: http + scheme: basic + http_bearer_auth: + type: http + scheme: bearer + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store +# The following lines are disabled due to missing support for allOf. Enable when support is added. +# AllOfPet: +# content: +# application/json: +# schema: +# allOf: +# - $ref: '#/components/schemas/Pet' +# description: Pet object that needs to be added to the store + Tag: + content: + application/json: + schema: + $ref: '#/components/schemas/Tag' + description: Tag object + schemas: + Category: + type: object + properties: + id: + type: integer + format: int64 + example: 1 + name: + type: string + example: Dogs + xml: + name: category + Tag: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: tag + Pet: + required: + - name + - photoUrls + type: object + properties: + id: + type: integer + format: int64 + example: 10 + name: + type: string + example: doggie + category: + $ref: '#/components/schemas/Category' + photoUrls: + type: array + xml: + wrapped: true + items: + type: string + xml: + name: photoUrl + tags: + type: array + xml: + wrapped: true + items: + $ref: '#/components/schemas/Tag' + status: + type: string + description: pet status in the store + enum: + - available + - pending + - sold + xml: + name: pet + StringEnumRef: + type: string + enum: + - success + - failure + - unclassified + DefaultValue: + type: object + description: to test the default value of properties + properties: + array_string_enum_ref_default: + type: array + items: + $ref: '#/components/schemas/StringEnumRef' +# The following lines are disabled due to bug in default values for enums. Enable when bug is fixed. +# default: +# - success +# - failure + array_string_enum_default: + type: array + items: + type: string + enum: + - success + - failure + - unclassified +# The following lines are disabled due to bug in default values for enums. Enable when bug is fixed. +# default: +# - success +# - failure + array_string_default: + type: array + items: + type: string + default: + - failure + - skipped + array_integer_default: + type: array + items: + type: integer + default: + - 1 + - 3 + array_string: + type: array + items: + type: string + array_string_nullable: + nullable: true + type: array + items: + type: string + array_string_extension_nullable: + x-nullable: true + type: array + items: + type: string + string_nullable: + type: string + nullable: true + Bird: + type: object + properties: + size: + type: string + color: + type: string + Query: + type: object + x-parent: true + properties: + id: + type: integer + description: Query + format: int64 + outcomes: + type: array + items: + type: string + enum: + - SUCCESS + - FAILURE + - SKIPPED +# The following lines are disabled due to bug in default values for enums. Enable when bug is fixed. +# default: +# - SUCCESS +# - FAILURE +# The following lines are disabled due to missing support for allOf. Enable when support is added. +# DataQuery: +# allOf: +# - type: object +# properties: +# suffix: +# type: string +# description: test suffix +# text: +# type: string +# description: Some text containing white spaces +# example: "Some text" +# date: +# type: string +# format: date-time +# description: A date +# - $ref: '#/components/schemas/Query' + NumberPropertiesOnly: + type: object + properties: + number: + type: number + float: + type: number + format: float + double: + type: number + format: double + minimum: 0.8 + maximum: 50.2 diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/.openapi-generator-ignore b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/.openapi-generator/FILES b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/.openapi-generator/FILES new file mode 100644 index 00000000000..4d6a5844cce --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/.openapi-generator/FILES @@ -0,0 +1,43 @@ +README.md +build.gradle +docs/AuthApi.md +docs/Bird.md +docs/BodyApi.md +docs/Category.md +docs/DefaultValue.md +docs/FormApi.md +docs/HeaderApi.md +docs/NumberPropertiesOnly.md +docs/PathApi.md +docs/Pet.md +docs/Query.md +docs/QueryApi.md +docs/StringEnumRef.md +docs/Tag.md +docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat +settings.gradle +src/main/kotlin/org/openapitools/client/apis/AuthApi.kt +src/main/kotlin/org/openapitools/client/apis/BodyApi.kt +src/main/kotlin/org/openapitools/client/apis/FormApi.kt +src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt +src/main/kotlin/org/openapitools/client/apis/PathApi.kt +src/main/kotlin/org/openapitools/client/apis/QueryApi.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt +src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt +src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.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/infrastructure/Serializer.kt +src/main/kotlin/org/openapitools/client/models/Bird.kt +src/main/kotlin/org/openapitools/client/models/Category.kt +src/main/kotlin/org/openapitools/client/models/DefaultValue.kt +src/main/kotlin/org/openapitools/client/models/NumberPropertiesOnly.kt +src/main/kotlin/org/openapitools/client/models/Pet.kt +src/main/kotlin/org/openapitools/client/models/Query.kt +src/main/kotlin/org/openapitools/client/models/StringEnumRef.kt +src/main/kotlin/org/openapitools/client/models/Tag.kt +src/main/kotlin/org/openapitools/client/models/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.kt diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/.openapi-generator/VERSION b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/.openapi-generator/VERSION new file mode 100644 index 00000000000..fff4bdd7ab5 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/README.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/README.md new file mode 100644 index 00000000000..6ba004b4f2a --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/README.md @@ -0,0 +1,102 @@ +# org.openapitools.client - Kotlin client library for Echo Server API + +Echo Server API + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. + +- API version: 0.1.0 +- Package version: +- Build package: org.openapitools.codegen.languages.KotlinClientCodegen + +## Requires + +* Kotlin 1.7.21 +* Gradle 7.5 + +## Build + +First, create the gradle wrapper script: + +``` +gradle wrapper +``` + +Then, run: + +``` +./gradlew check assemble +``` + +This runs all tests and packages the library. + +## Features/Implementation Notes + +* Supports JSON inputs/outputs, File inputs, and Form inputs. +* Supports collection formats for query parameters: csv, tsv, ssv, pipes. +* Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions. +* Implementation of ApiClient is intended to reduce method counts, specifically to benefit Android targets. + + +## Documentation for API Endpoints + +All URIs are relative to *http://localhost:3000* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*AuthApi* | [**testAuthHttpBasic**](docs/AuthApi.md#testauthhttpbasic) | **POST** /auth/http/basic | To test HTTP basic authentication +*AuthApi* | [**testAuthHttpBearer**](docs/AuthApi.md#testauthhttpbearer) | **POST** /auth/http/bearer | To test HTTP bearer authentication +*BodyApi* | [**testBinaryGif**](docs/BodyApi.md#testbinarygif) | **POST** /binary/gif | Test binary (gif) response body +*BodyApi* | [**testBodyApplicationOctetstreamBinary**](docs/BodyApi.md#testbodyapplicationoctetstreambinary) | **POST** /body/application/octetstream/binary | Test body parameter(s) +*BodyApi* | [**testBodyMultipartFormdataArrayOfBinary**](docs/BodyApi.md#testbodymultipartformdataarrayofbinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime +*BodyApi* | [**testBodyMultipartFormdataSingleBinary**](docs/BodyApi.md#testbodymultipartformdatasinglebinary) | **POST** /body/application/octetstream/single_binary | Test single binary in multipart mime +*BodyApi* | [**testEchoBodyFreeFormObjectResponseString**](docs/BodyApi.md#testechobodyfreeformobjectresponsestring) | **POST** /echo/body/FreeFormObject/response_string | Test free form object +*BodyApi* | [**testEchoBodyPet**](docs/BodyApi.md#testechobodypet) | **POST** /echo/body/Pet | Test body parameter(s) +*BodyApi* | [**testEchoBodyPetResponseString**](docs/BodyApi.md#testechobodypetresponsestring) | **POST** /echo/body/Pet/response_string | Test empty response body +*BodyApi* | [**testEchoBodyTagResponseString**](docs/BodyApi.md#testechobodytagresponsestring) | **POST** /echo/body/Tag/response_string | Test empty json (request body) +*FormApi* | [**testFormIntegerBooleanString**](docs/FormApi.md#testformintegerbooleanstring) | **POST** /form/integer/boolean/string | Test form parameter(s) +*FormApi* | [**testFormOneof**](docs/FormApi.md#testformoneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema +*HeaderApi* | [**testHeaderIntegerBooleanStringEnums**](docs/HeaderApi.md#testheaderintegerbooleanstringenums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) +*PathApi* | [**testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](docs/PathApi.md#testspathstringpathstringintegerpathintegerenumnonrefstringpathenumrefstringpath) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) +*QueryApi* | [**testEnumRefString**](docs/QueryApi.md#testenumrefstring) | **GET** /query/enum_ref_string | Test query parameter(s) +*QueryApi* | [**testQueryDatetimeDateString**](docs/QueryApi.md#testquerydatetimedatestring) | **GET** /query/datetime/date/string | Test query parameter(s) +*QueryApi* | [**testQueryIntegerBooleanString**](docs/QueryApi.md#testqueryintegerbooleanstring) | **GET** /query/integer/boolean/string | Test query parameter(s) +*QueryApi* | [**testQueryStyleDeepObjectExplodeTrueObject**](docs/QueryApi.md#testquerystyledeepobjectexplodetrueobject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s) +*QueryApi* | [**testQueryStyleFormExplodeTrueArrayString**](docs/QueryApi.md#testquerystyleformexplodetruearraystring) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) +*QueryApi* | [**testQueryStyleFormExplodeTrueObject**](docs/QueryApi.md#testquerystyleformexplodetrueobject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) + + + +## Documentation for Models + + - [org.openapitools.client.models.Bird](docs/Bird.md) + - [org.openapitools.client.models.Category](docs/Category.md) + - [org.openapitools.client.models.DefaultValue](docs/DefaultValue.md) + - [org.openapitools.client.models.NumberPropertiesOnly](docs/NumberPropertiesOnly.md) + - [org.openapitools.client.models.Pet](docs/Pet.md) + - [org.openapitools.client.models.Query](docs/Query.md) + - [org.openapitools.client.models.StringEnumRef](docs/StringEnumRef.md) + - [org.openapitools.client.models.Tag](docs/Tag.md) + - [org.openapitools.client.models.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md) + + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### http_auth + +- **Type**: HTTP basic authentication + + +### http_bearer_auth + +- **Type**: HTTP Bearer Token authentication + + + +## Author + +team@openapitools.org diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/build.gradle b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/build.gradle new file mode 100644 index 00000000000..a650f5ebf2d --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/build.gradle @@ -0,0 +1,68 @@ +group 'org.openapitools' +version '1.0.0' + +wrapper { + gradleVersion = '7.5' + distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip" +} + +buildscript { + ext.kotlin_version = '1.8.10' + ext.spring_boot_version = "3.2.0" + ext.spotless_version = "6.13.0" + + repositories { + maven { url "https://repo1.maven.org/maven2" } + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotless_version" + } +} + +apply plugin: 'kotlin' +apply plugin: 'maven-publish' +apply plugin: 'com.diffplug.spotless' + +repositories { + maven { url "https://repo1.maven.org/maven2" } +} + +// Use spotless plugin to automatically format code, remove unused import, etc +// To apply changes directly to the file, run `gradlew spotlessApply` +// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle +spotless { + // comment out below to run spotless as part of the `check` task + enforceCheck false + + format 'misc', { + // define the files (e.g. '*.gradle', '*.md') to apply `misc` to + target '.gitignore' + + // define the steps to apply to those files + trimTrailingWhitespace() + indentWithSpaces() // Takes an integer argument if you don't like 4 + endWithNewline() + } + kotlin { + ktfmt() + } +} + +test { + useJUnitPlatform() +} + +kotlin { + jvmToolchain { + languageVersion.set(JavaLanguageVersion.of(17)) + } +} +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" + implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.14.3" + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.3" + implementation "org.springframework.boot:spring-boot-starter-web:$spring_boot_version" + testImplementation "io.kotlintest:kotlintest-runner-junit5:3.4.2" +} diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/AuthApi.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/AuthApi.md new file mode 100644 index 00000000000..b7ef4f547bd --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/AuthApi.md @@ -0,0 +1,101 @@ +# AuthApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testAuthHttpBasic**](AuthApi.md#testAuthHttpBasic) | **POST** /auth/http/basic | To test HTTP basic authentication +[**testAuthHttpBearer**](AuthApi.md#testAuthHttpBearer) | **POST** /auth/http/bearer | To test HTTP bearer authentication + + + +# **testAuthHttpBasic** +> kotlin.String testAuthHttpBasic() + +To test HTTP basic authentication + +To test HTTP basic authentication + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = AuthApi() +try { + val result : kotlin.String = apiInstance.testAuthHttpBasic() + println(result) +} catch (e: ClientException) { + println("4xx response calling AuthApi#testAuthHttpBasic") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling AuthApi#testAuthHttpBasic") + e.printStackTrace() +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**kotlin.String** + +### Authorization + + +Configure http_auth: + ApiClient.username = "" + ApiClient.password = "" + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + + +# **testAuthHttpBearer** +> kotlin.String testAuthHttpBearer() + +To test HTTP bearer authentication + +To test HTTP bearer authentication + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = AuthApi() +try { + val result : kotlin.String = apiInstance.testAuthHttpBearer() + println(result) +} catch (e: ClientException) { + println("4xx response calling AuthApi#testAuthHttpBearer") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling AuthApi#testAuthHttpBearer") + e.printStackTrace() +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**kotlin.String** + +### Authorization + + +Configure http_bearer_auth: + ApiClient.accessToken = "" + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/Bird.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/Bird.md new file mode 100644 index 00000000000..878335adf52 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/Bird.md @@ -0,0 +1,11 @@ + +# Bird + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**propertySize** | **kotlin.String** | | [optional] +**color** | **kotlin.String** | | [optional] + + + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/BodyApi.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/BodyApi.md new file mode 100644 index 00000000000..8a02fa98c10 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/BodyApi.md @@ -0,0 +1,388 @@ +# BodyApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testBinaryGif**](BodyApi.md#testBinaryGif) | **POST** /binary/gif | Test binary (gif) response body +[**testBodyApplicationOctetstreamBinary**](BodyApi.md#testBodyApplicationOctetstreamBinary) | **POST** /body/application/octetstream/binary | Test body parameter(s) +[**testBodyMultipartFormdataArrayOfBinary**](BodyApi.md#testBodyMultipartFormdataArrayOfBinary) | **POST** /body/application/octetstream/array_of_binary | Test array of binary in multipart mime +[**testBodyMultipartFormdataSingleBinary**](BodyApi.md#testBodyMultipartFormdataSingleBinary) | **POST** /body/application/octetstream/single_binary | Test single binary in multipart mime +[**testEchoBodyFreeFormObjectResponseString**](BodyApi.md#testEchoBodyFreeFormObjectResponseString) | **POST** /echo/body/FreeFormObject/response_string | Test free form object +[**testEchoBodyPet**](BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) +[**testEchoBodyPetResponseString**](BodyApi.md#testEchoBodyPetResponseString) | **POST** /echo/body/Pet/response_string | Test empty response body +[**testEchoBodyTagResponseString**](BodyApi.md#testEchoBodyTagResponseString) | **POST** /echo/body/Tag/response_string | Test empty json (request body) + + + +# **testBinaryGif** +> java.io.File testBinaryGif() + +Test binary (gif) response body + +Test binary (gif) response body + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = BodyApi() +try { + val result : java.io.File = apiInstance.testBinaryGif() + println(result) +} catch (e: ClientException) { + println("4xx response calling BodyApi#testBinaryGif") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling BodyApi#testBinaryGif") + e.printStackTrace() +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**java.io.File**](java.io.File.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: image/gif + + +# **testBodyApplicationOctetstreamBinary** +> kotlin.String testBodyApplicationOctetstreamBinary(body) + +Test body parameter(s) + +Test body parameter(s) + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = BodyApi() +val body : java.io.File = BINARY_DATA_HERE // java.io.File | +try { + val result : kotlin.String = apiInstance.testBodyApplicationOctetstreamBinary(body) + println(result) +} catch (e: ClientException) { + println("4xx response calling BodyApi#testBodyApplicationOctetstreamBinary") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling BodyApi#testBodyApplicationOctetstreamBinary") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **java.io.File**| | [optional] + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/octet-stream + - **Accept**: text/plain + + +# **testBodyMultipartFormdataArrayOfBinary** +> kotlin.String testBodyMultipartFormdataArrayOfBinary(files) + +Test array of binary in multipart mime + +Test array of binary in multipart mime + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = BodyApi() +val files : kotlin.collections.List = /path/to/file.txt // kotlin.collections.List | +try { + val result : kotlin.String = apiInstance.testBodyMultipartFormdataArrayOfBinary(files) + println(result) +} catch (e: ClientException) { + println("4xx response calling BodyApi#testBodyMultipartFormdataArrayOfBinary") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling BodyApi#testBodyMultipartFormdataArrayOfBinary") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **files** | **kotlin.collections.List<java.io.File>**| | + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: text/plain + + +# **testBodyMultipartFormdataSingleBinary** +> kotlin.String testBodyMultipartFormdataSingleBinary(myFile) + +Test single binary in multipart mime + +Test single binary in multipart mime + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = BodyApi() +val myFile : java.io.File = BINARY_DATA_HERE // java.io.File | +try { + val result : kotlin.String = apiInstance.testBodyMultipartFormdataSingleBinary(myFile) + println(result) +} catch (e: ClientException) { + println("4xx response calling BodyApi#testBodyMultipartFormdataSingleBinary") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling BodyApi#testBodyMultipartFormdataSingleBinary") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **myFile** | **java.io.File**| | [optional] + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: text/plain + + +# **testEchoBodyFreeFormObjectResponseString** +> kotlin.String testEchoBodyFreeFormObjectResponseString(body) + +Test free form object + +Test free form object + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = BodyApi() +val body : kotlin.Any = Object // kotlin.Any | Free form object +try { + val result : kotlin.String = apiInstance.testEchoBodyFreeFormObjectResponseString(body) + println(result) +} catch (e: ClientException) { + println("4xx response calling BodyApi#testEchoBodyFreeFormObjectResponseString") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling BodyApi#testEchoBodyFreeFormObjectResponseString") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **kotlin.Any**| Free form object | [optional] + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: text/plain + + +# **testEchoBodyPet** +> Pet testEchoBodyPet(pet) + +Test body parameter(s) + +Test body parameter(s) + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = BodyApi() +val pet : Pet = // Pet | Pet object that needs to be added to the store +try { + val result : Pet = apiInstance.testEchoBodyPet(pet) + println(result) +} catch (e: ClientException) { + println("4xx response calling BodyApi#testEchoBodyPet") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling BodyApi#testEchoBodyPet") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +# **testEchoBodyPetResponseString** +> kotlin.String testEchoBodyPetResponseString(pet) + +Test empty response body + +Test empty response body + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = BodyApi() +val pet : Pet = // Pet | Pet object that needs to be added to the store +try { + val result : kotlin.String = apiInstance.testEchoBodyPetResponseString(pet) + println(result) +} catch (e: ClientException) { + println("4xx response calling BodyApi#testEchoBodyPetResponseString") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling BodyApi#testEchoBodyPetResponseString") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: text/plain + + +# **testEchoBodyTagResponseString** +> kotlin.String testEchoBodyTagResponseString(tag) + +Test empty json (request body) + +Test empty json (request body) + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = BodyApi() +val tag : Tag = // Tag | Tag object +try { + val result : kotlin.String = apiInstance.testEchoBodyTagResponseString(tag) + println(result) +} catch (e: ClientException) { + println("4xx response calling BodyApi#testEchoBodyTagResponseString") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling BodyApi#testEchoBodyTagResponseString") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tag** | [**Tag**](Tag.md)| Tag object | [optional] + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: text/plain + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/Category.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/Category.md new file mode 100644 index 00000000000..2c28a670fc7 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/Category.md @@ -0,0 +1,11 @@ + +# Category + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **kotlin.Long** | | [optional] +**name** | **kotlin.String** | | [optional] + + + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/DataQuery.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/DataQuery.md new file mode 100644 index 00000000000..33ebce87743 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/DataQuery.md @@ -0,0 +1,12 @@ + +# DataQuery + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**suffix** | **kotlin.String** | test suffix | [optional] +**text** | **kotlin.String** | Some text containing white spaces | [optional] +**date** | [**java.time.OffsetDateTime**](java.time.OffsetDateTime.md) | A date | [optional] + + + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/DefaultValue.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/DefaultValue.md new file mode 100644 index 00000000000..de65ccf8d7c --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/DefaultValue.md @@ -0,0 +1,24 @@ + +# DefaultValue + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayStringEnumRefDefault** | [**kotlin.collections.List<StringEnumRef>**](StringEnumRef.md) | | [optional] +**arrayStringEnumDefault** | [**inline**](#kotlin.collections.List<ArrayStringEnumDefault>) | | [optional] +**arrayStringDefault** | **kotlin.collections.List<kotlin.String>** | | [optional] +**arrayIntegerDefault** | **kotlin.collections.List<kotlin.Int>** | | [optional] +**arrayString** | **kotlin.collections.List<kotlin.String>** | | [optional] +**arrayStringNullable** | **kotlin.collections.List<kotlin.String>** | | [optional] +**arrayStringExtensionNullable** | **kotlin.collections.List<kotlin.String>** | | [optional] +**stringNullable** | **kotlin.String** | | [optional] + + + +## Enum: array_string_enum_default +Name | Value +---- | ----- +arrayStringEnumDefault | success, failure, unclassified + + + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/FormApi.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/FormApi.md new file mode 100644 index 00000000000..0b420b90654 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/FormApi.md @@ -0,0 +1,118 @@ +# FormApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testFormIntegerBooleanString**](FormApi.md#testFormIntegerBooleanString) | **POST** /form/integer/boolean/string | Test form parameter(s) +[**testFormOneof**](FormApi.md#testFormOneof) | **POST** /form/oneof | Test form parameter(s) for oneOf schema + + + +# **testFormIntegerBooleanString** +> kotlin.String testFormIntegerBooleanString(integerForm, booleanForm, stringForm) + +Test form parameter(s) + +Test form parameter(s) + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = FormApi() +val integerForm : kotlin.Int = 56 // kotlin.Int | +val booleanForm : kotlin.Boolean = true // kotlin.Boolean | +val stringForm : kotlin.String = stringForm_example // kotlin.String | +try { + val result : kotlin.String = apiInstance.testFormIntegerBooleanString(integerForm, booleanForm, stringForm) + println(result) +} catch (e: ClientException) { + println("4xx response calling FormApi#testFormIntegerBooleanString") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling FormApi#testFormIntegerBooleanString") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integerForm** | **kotlin.Int**| | [optional] + **booleanForm** | **kotlin.Boolean**| | [optional] + **stringForm** | **kotlin.String**| | [optional] + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: text/plain + + +# **testFormOneof** +> kotlin.String testFormOneof(form1, form2, form3, form4, id, name) + +Test form parameter(s) for oneOf schema + +Test form parameter(s) for oneOf schema + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = FormApi() +val form1 : kotlin.String = form1_example // kotlin.String | +val form2 : kotlin.Int = 56 // kotlin.Int | +val form3 : kotlin.String = form3_example // kotlin.String | +val form4 : kotlin.Boolean = true // kotlin.Boolean | +val id : kotlin.Long = 789 // kotlin.Long | +val name : kotlin.String = name_example // kotlin.String | +try { + val result : kotlin.String = apiInstance.testFormOneof(form1, form2, form3, form4, id, name) + println(result) +} catch (e: ClientException) { + println("4xx response calling FormApi#testFormOneof") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling FormApi#testFormOneof") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **form1** | **kotlin.String**| | [optional] + **form2** | **kotlin.Int**| | [optional] + **form3** | **kotlin.String**| | [optional] + **form4** | **kotlin.Boolean**| | [optional] + **id** | **kotlin.Long**| | [optional] + **name** | **kotlin.String**| | [optional] + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: text/plain + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/HeaderApi.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/HeaderApi.md new file mode 100644 index 00000000000..1d38dda946f --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/HeaderApi.md @@ -0,0 +1,64 @@ +# HeaderApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testHeaderIntegerBooleanStringEnums**](HeaderApi.md#testHeaderIntegerBooleanStringEnums) | **GET** /header/integer/boolean/string/enums | Test header parameter(s) + + + +# **testHeaderIntegerBooleanStringEnums** +> kotlin.String testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader) + +Test header parameter(s) + +Test header parameter(s) + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = HeaderApi() +val integerHeader : kotlin.Int = 56 // kotlin.Int | +val booleanHeader : kotlin.Boolean = true // kotlin.Boolean | +val stringHeader : kotlin.String = stringHeader_example // kotlin.String | +val enumNonrefStringHeader : kotlin.String = enumNonrefStringHeader_example // kotlin.String | +val enumRefStringHeader : StringEnumRef = // StringEnumRef | +try { + val result : kotlin.String = apiInstance.testHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader) + println(result) +} catch (e: ClientException) { + println("4xx response calling HeaderApi#testHeaderIntegerBooleanStringEnums") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling HeaderApi#testHeaderIntegerBooleanStringEnums") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integerHeader** | **kotlin.Int**| | [optional] + **booleanHeader** | **kotlin.Boolean**| | [optional] + **stringHeader** | **kotlin.String**| | [optional] + **enumNonrefStringHeader** | **kotlin.String**| | [optional] [enum: success, failure, unclassified] + **enumRefStringHeader** | [**StringEnumRef**](.md)| | [optional] [enum: success, failure, unclassified] + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/NumberPropertiesOnly.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/NumberPropertiesOnly.md new file mode 100644 index 00000000000..d601af65669 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/NumberPropertiesOnly.md @@ -0,0 +1,12 @@ + +# NumberPropertiesOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**number** | [**java.math.BigDecimal**](java.math.BigDecimal.md) | | [optional] +**float** | **kotlin.Float** | | [optional] +**double** | **kotlin.Double** | | [optional] + + + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/PathApi.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/PathApi.md new file mode 100644 index 00000000000..129553d02c1 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/PathApi.md @@ -0,0 +1,62 @@ +# PathApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath**](PathApi.md#testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath) | **GET** /path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path} | Test path parameter(s) + + + +# **testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath** +> kotlin.String testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath) + +Test path parameter(s) + +Test path parameter(s) + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = PathApi() +val pathString : kotlin.String = pathString_example // kotlin.String | +val pathInteger : kotlin.Int = 56 // kotlin.Int | +val enumNonrefStringPath : kotlin.String = enumNonrefStringPath_example // kotlin.String | +val enumRefStringPath : StringEnumRef = // StringEnumRef | +try { + val result : kotlin.String = apiInstance.testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath) + println(result) +} catch (e: ClientException) { + println("4xx response calling PathApi#testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling PathApi#testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pathString** | **kotlin.String**| | + **pathInteger** | **kotlin.Int**| | + **enumNonrefStringPath** | **kotlin.String**| | [enum: success, failure, unclassified] + **enumRefStringPath** | [**StringEnumRef**](.md)| | [enum: success, failure, unclassified] + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/Pet.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/Pet.md new file mode 100644 index 00000000000..da70fca06e6 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/Pet.md @@ -0,0 +1,22 @@ + +# Pet + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **kotlin.String** | | +**photoUrls** | **kotlin.collections.List<kotlin.String>** | | +**id** | **kotlin.Long** | | [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/echo_api/kotlin-jvm-spring-3-restclient/docs/Query.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/Query.md new file mode 100644 index 00000000000..85d53f6f088 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/Query.md @@ -0,0 +1,18 @@ + +# Query + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **kotlin.Long** | Query | [optional] +**outcomes** | [**inline**](#kotlin.collections.List<Outcomes>) | | [optional] + + + +## Enum: outcomes +Name | Value +---- | ----- +outcomes | SUCCESS, FAILURE, SKIPPED + + + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/QueryApi.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/QueryApi.md new file mode 100644 index 00000000000..443718661d3 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/QueryApi.md @@ -0,0 +1,306 @@ +# QueryApi + +All URIs are relative to *http://localhost:3000* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testEnumRefString**](QueryApi.md#testEnumRefString) | **GET** /query/enum_ref_string | Test query parameter(s) +[**testQueryDatetimeDateString**](QueryApi.md#testQueryDatetimeDateString) | **GET** /query/datetime/date/string | Test query parameter(s) +[**testQueryIntegerBooleanString**](QueryApi.md#testQueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s) +[**testQueryStyleDeepObjectExplodeTrueObject**](QueryApi.md#testQueryStyleDeepObjectExplodeTrueObject) | **GET** /query/style_deepObject/explode_true/object | Test query parameter(s) +[**testQueryStyleFormExplodeTrueArrayString**](QueryApi.md#testQueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) +[**testQueryStyleFormExplodeTrueObject**](QueryApi.md#testQueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) + + + +# **testEnumRefString** +> kotlin.String testEnumRefString(enumNonrefStringQuery, enumRefStringQuery) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = QueryApi() +val enumNonrefStringQuery : kotlin.String = enumNonrefStringQuery_example // kotlin.String | +val enumRefStringQuery : StringEnumRef = // StringEnumRef | +try { + val result : kotlin.String = apiInstance.testEnumRefString(enumNonrefStringQuery, enumRefStringQuery) + println(result) +} catch (e: ClientException) { + println("4xx response calling QueryApi#testEnumRefString") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling QueryApi#testEnumRefString") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumNonrefStringQuery** | **kotlin.String**| | [optional] [enum: success, failure, unclassified] + **enumRefStringQuery** | [**StringEnumRef**](.md)| | [optional] [enum: success, failure, unclassified] + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + + +# **testQueryDatetimeDateString** +> kotlin.String testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = QueryApi() +val datetimeQuery : java.time.OffsetDateTime = 2013-10-20T19:20:30+01:00 // java.time.OffsetDateTime | +val dateQuery : java.time.LocalDate = 2013-10-20 // java.time.LocalDate | +val stringQuery : kotlin.String = stringQuery_example // kotlin.String | +try { + val result : kotlin.String = apiInstance.testQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery) + println(result) +} catch (e: ClientException) { + println("4xx response calling QueryApi#testQueryDatetimeDateString") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling QueryApi#testQueryDatetimeDateString") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **datetimeQuery** | **java.time.OffsetDateTime**| | [optional] + **dateQuery** | **java.time.LocalDate**| | [optional] + **stringQuery** | **kotlin.String**| | [optional] + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + + +# **testQueryIntegerBooleanString** +> kotlin.String testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = QueryApi() +val integerQuery : kotlin.Int = 56 // kotlin.Int | +val booleanQuery : kotlin.Boolean = true // kotlin.Boolean | +val stringQuery : kotlin.String = stringQuery_example // kotlin.String | +try { + val result : kotlin.String = apiInstance.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery) + println(result) +} catch (e: ClientException) { + println("4xx response calling QueryApi#testQueryIntegerBooleanString") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling QueryApi#testQueryIntegerBooleanString") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **integerQuery** | **kotlin.Int**| | [optional] + **booleanQuery** | **kotlin.Boolean**| | [optional] + **stringQuery** | **kotlin.String**| | [optional] + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + + +# **testQueryStyleDeepObjectExplodeTrueObject** +> kotlin.String testQueryStyleDeepObjectExplodeTrueObject(queryObject) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = QueryApi() +val queryObject : Pet = // Pet | +try { + val result : kotlin.String = apiInstance.testQueryStyleDeepObjectExplodeTrueObject(queryObject) + println(result) +} catch (e: ClientException) { + println("4xx response calling QueryApi#testQueryStyleDeepObjectExplodeTrueObject") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling QueryApi#testQueryStyleDeepObjectExplodeTrueObject") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | [**Pet**](.md)| | [optional] + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + + +# **testQueryStyleFormExplodeTrueArrayString** +> kotlin.String testQueryStyleFormExplodeTrueArrayString(queryObject) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = QueryApi() +val queryObject : TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter = // TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter | +try { + val result : kotlin.String = apiInstance.testQueryStyleFormExplodeTrueArrayString(queryObject) + println(result) +} catch (e: ClientException) { + println("4xx response calling QueryApi#testQueryStyleFormExplodeTrueArrayString") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling QueryApi#testQueryStyleFormExplodeTrueArrayString") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | [**TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](.md)| | [optional] + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + + +# **testQueryStyleFormExplodeTrueObject** +> kotlin.String testQueryStyleFormExplodeTrueObject(queryObject) + +Test query parameter(s) + +Test query parameter(s) + +### Example +```kotlin +// Import classes: +//import org.openapitools.client.infrastructure.* +//import org.openapitools.client.models.* + +val apiInstance = QueryApi() +val queryObject : Pet = // Pet | +try { + val result : kotlin.String = apiInstance.testQueryStyleFormExplodeTrueObject(queryObject) + println(result) +} catch (e: ClientException) { + println("4xx response calling QueryApi#testQueryStyleFormExplodeTrueObject") + e.printStackTrace() +} catch (e: ServerException) { + println("5xx response calling QueryApi#testQueryStyleFormExplodeTrueObject") + e.printStackTrace() +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **queryObject** | [**Pet**](.md)| | [optional] + +### Return type + +**kotlin.String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: text/plain + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/StringEnumRef.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/StringEnumRef.md new file mode 100644 index 00000000000..d61e16ef26b --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/StringEnumRef.md @@ -0,0 +1,16 @@ + +# StringEnumRef + +## Enum + + + * `success` (value: `"success"`) + + * `failure` (value: `"failure"`) + + * `unclassified` (value: `"unclassified"`) + + * `unknownDefaultOpenApi` (value: `"unknown_default_open_api"`) + + + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/Tag.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/Tag.md new file mode 100644 index 00000000000..60ce1bcdbad --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/Tag.md @@ -0,0 +1,11 @@ + +# Tag + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **kotlin.Long** | | [optional] +**name** | **kotlin.String** | | [optional] + + + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md new file mode 100644 index 00000000000..d617e4a4420 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md @@ -0,0 +1,13 @@ + +# TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**propertySize** | **kotlin.String** | | [optional] +**color** | **kotlin.String** | | [optional] +**id** | **kotlin.Long** | | [optional] +**name** | **kotlin.String** | | [optional] + + + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md new file mode 100644 index 00000000000..63e23617161 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md @@ -0,0 +1,10 @@ + +# TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**propertyValues** | **kotlin.collections.List<kotlin.String>** | | [optional] + + + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.jar b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000000..c1962a79e29 Binary files /dev/null and b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.properties b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000000..8707e8b5067 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip +networkTimeout=10000 +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradlew b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradlew new file mode 100644 index 00000000000..aeb74cbb43e --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradlew @@ -0,0 +1,245 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradlew.bat b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradlew.bat new file mode 100644 index 00000000000..93e3f59f135 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/settings.gradle b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/settings.gradle new file mode 100644 index 00000000000..854d039d418 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/settings.gradle @@ -0,0 +1,2 @@ + +rootProject.name = 'kotlin-client' diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/AuthApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/AuthApi.kt new file mode 100644 index 00000000000..cc3e26512b0 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/AuthApi.kt @@ -0,0 +1,108 @@ +/** + * + * 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 com.fasterxml.jackson.annotation.JsonProperty + +import org.springframework.web.client.RestClient +import org.springframework.web.client.RestClientResponseException + +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter +import org.springframework.http.ResponseEntity +import org.springframework.http.MediaType + + +import org.openapitools.client.infrastructure.* + +class AuthApi(client: RestClient) : ApiClient(client) { + + constructor(baseUrl: String) : this(RestClient.builder() + .baseUrl(baseUrl) + .messageConverters { it.add(MappingJackson2HttpMessageConverter()) } + .build() + ) + + + @Throws(RestClientResponseException::class) + fun testAuthHttpBasic(): kotlin.String { + val result = testAuthHttpBasicWithHttpInfo() + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testAuthHttpBasicWithHttpInfo(): ResponseEntity { + val localVariableConfig = testAuthHttpBasicRequestConfig() + return request( + localVariableConfig + ) + } + + fun testAuthHttpBasicRequestConfig() : RequestConfig { + val localVariableBody = null + val localVariableQuery = mutableMapOf>() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "text/plain" + + val params = mutableMapOf( + ) + + return RequestConfig( + method = RequestMethod.POST, + path = "/auth/http/basic", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = true, + body = localVariableBody + ) + } + + + @Throws(RestClientResponseException::class) + fun testAuthHttpBearer(): kotlin.String { + val result = testAuthHttpBearerWithHttpInfo() + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testAuthHttpBearerWithHttpInfo(): ResponseEntity { + val localVariableConfig = testAuthHttpBearerRequestConfig() + return request( + localVariableConfig + ) + } + + fun testAuthHttpBearerRequestConfig() : RequestConfig { + val localVariableBody = null + val localVariableQuery = mutableMapOf>() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "text/plain" + + val params = mutableMapOf( + ) + + return RequestConfig( + method = RequestMethod.POST, + path = "/auth/http/bearer", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = true, + body = localVariableBody + ) + } + +} diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/BodyApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/BodyApi.kt new file mode 100644 index 00000000000..44ca769307d --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/BodyApi.kt @@ -0,0 +1,327 @@ +/** + * + * 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 com.fasterxml.jackson.annotation.JsonProperty + +import org.springframework.web.client.RestClient +import org.springframework.web.client.RestClientResponseException + +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter +import org.springframework.http.ResponseEntity +import org.springframework.http.MediaType + + +import org.openapitools.client.models.Pet +import org.openapitools.client.models.Tag +import org.openapitools.client.infrastructure.* + +class BodyApi(client: RestClient) : ApiClient(client) { + + constructor(baseUrl: String) : this(RestClient.builder() + .baseUrl(baseUrl) + .messageConverters { it.add(MappingJackson2HttpMessageConverter()) } + .build() + ) + + + @Throws(RestClientResponseException::class) + fun testBinaryGif(): java.io.File { + val result = testBinaryGifWithHttpInfo() + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testBinaryGifWithHttpInfo(): ResponseEntity { + val localVariableConfig = testBinaryGifRequestConfig() + return request( + localVariableConfig + ) + } + + fun testBinaryGifRequestConfig() : RequestConfig { + val localVariableBody = null + val localVariableQuery = mutableMapOf>() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "image/gif" + + val params = mutableMapOf( + ) + + return RequestConfig( + method = RequestMethod.POST, + path = "/binary/gif", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + @Throws(RestClientResponseException::class) + fun testBodyApplicationOctetstreamBinary(body: java.io.File? = null): kotlin.String { + val result = testBodyApplicationOctetstreamBinaryWithHttpInfo(body = body) + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testBodyApplicationOctetstreamBinaryWithHttpInfo(body: java.io.File? = null): ResponseEntity { + val localVariableConfig = testBodyApplicationOctetstreamBinaryRequestConfig(body = body) + return request( + localVariableConfig + ) + } + + fun testBodyApplicationOctetstreamBinaryRequestConfig(body: java.io.File? = null) : RequestConfig { + val localVariableBody = body + val localVariableQuery = mutableMapOf>() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/octet-stream" + localVariableHeaders["Accept"] = "text/plain" + + val params = mutableMapOf( + ) + + return RequestConfig( + method = RequestMethod.POST, + path = "/body/application/octetstream/binary", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + @Throws(RestClientResponseException::class) + fun testBodyMultipartFormdataArrayOfBinary(files: kotlin.collections.List): kotlin.String { + val result = testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files = files) + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files: kotlin.collections.List): ResponseEntity { + val localVariableConfig = testBodyMultipartFormdataArrayOfBinaryRequestConfig(files = files) + return request>, kotlin.String>( + localVariableConfig + ) + } + + fun testBodyMultipartFormdataArrayOfBinaryRequestConfig(files: kotlin.collections.List) : RequestConfig>> { + val localVariableBody = mapOf( + "files" to PartConfig(body = files, headers = mutableMapOf()),) + val localVariableQuery = mutableMapOf>() + val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") + localVariableHeaders["Accept"] = "text/plain" + + val params = mutableMapOf( + ) + + return RequestConfig( + method = RequestMethod.POST, + path = "/body/application/octetstream/array_of_binary", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + @Throws(RestClientResponseException::class) + fun testBodyMultipartFormdataSingleBinary(myFile: java.io.File? = null): kotlin.String { + val result = testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile = myFile) + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testBodyMultipartFormdataSingleBinaryWithHttpInfo(myFile: java.io.File? = null): ResponseEntity { + val localVariableConfig = testBodyMultipartFormdataSingleBinaryRequestConfig(myFile = myFile) + return request>, kotlin.String>( + localVariableConfig + ) + } + + fun testBodyMultipartFormdataSingleBinaryRequestConfig(myFile: java.io.File? = null) : RequestConfig>> { + val localVariableBody = mapOf( + "my-file" to PartConfig(body = myFile, headers = mutableMapOf()),) + val localVariableQuery = mutableMapOf>() + val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "multipart/form-data") + localVariableHeaders["Accept"] = "text/plain" + + val params = mutableMapOf( + ) + + return RequestConfig( + method = RequestMethod.POST, + path = "/body/application/octetstream/single_binary", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + @Throws(RestClientResponseException::class) + fun testEchoBodyFreeFormObjectResponseString(body: kotlin.Any? = null): kotlin.String { + val result = testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body = body) + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testEchoBodyFreeFormObjectResponseStringWithHttpInfo(body: kotlin.Any? = null): ResponseEntity { + val localVariableConfig = testEchoBodyFreeFormObjectResponseStringRequestConfig(body = body) + return request( + localVariableConfig + ) + } + + fun testEchoBodyFreeFormObjectResponseStringRequestConfig(body: kotlin.Any? = null) : RequestConfig { + val localVariableBody = body + val localVariableQuery = mutableMapOf>() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "text/plain" + + val params = mutableMapOf( + ) + + return RequestConfig( + method = RequestMethod.POST, + path = "/echo/body/FreeFormObject/response_string", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + @Throws(RestClientResponseException::class) + fun testEchoBodyPet(pet: Pet? = null): Pet { + val result = testEchoBodyPetWithHttpInfo(pet = pet) + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testEchoBodyPetWithHttpInfo(pet: Pet? = null): ResponseEntity { + val localVariableConfig = testEchoBodyPetRequestConfig(pet = pet) + return request( + localVariableConfig + ) + } + + fun testEchoBodyPetRequestConfig(pet: Pet? = null) : RequestConfig { + val localVariableBody = pet + val localVariableQuery = mutableMapOf>() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "application/json" + + val params = mutableMapOf( + ) + + return RequestConfig( + method = RequestMethod.POST, + path = "/echo/body/Pet", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + @Throws(RestClientResponseException::class) + fun testEchoBodyPetResponseString(pet: Pet? = null): kotlin.String { + val result = testEchoBodyPetResponseStringWithHttpInfo(pet = pet) + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testEchoBodyPetResponseStringWithHttpInfo(pet: Pet? = null): ResponseEntity { + val localVariableConfig = testEchoBodyPetResponseStringRequestConfig(pet = pet) + return request( + localVariableConfig + ) + } + + fun testEchoBodyPetResponseStringRequestConfig(pet: Pet? = null) : RequestConfig { + val localVariableBody = pet + val localVariableQuery = mutableMapOf>() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "text/plain" + + val params = mutableMapOf( + ) + + return RequestConfig( + method = RequestMethod.POST, + path = "/echo/body/Pet/response_string", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + @Throws(RestClientResponseException::class) + fun testEchoBodyTagResponseString(tag: Tag? = null): kotlin.String { + val result = testEchoBodyTagResponseStringWithHttpInfo(tag = tag) + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testEchoBodyTagResponseStringWithHttpInfo(tag: Tag? = null): ResponseEntity { + val localVariableConfig = testEchoBodyTagResponseStringRequestConfig(tag = tag) + return request( + localVariableConfig + ) + } + + fun testEchoBodyTagResponseStringRequestConfig(tag: Tag? = null) : RequestConfig { + val localVariableBody = tag + val localVariableQuery = mutableMapOf>() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Content-Type"] = "application/json" + localVariableHeaders["Accept"] = "text/plain" + + val params = mutableMapOf( + ) + + return RequestConfig( + method = RequestMethod.POST, + path = "/echo/body/Tag/response_string", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + +} diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/FormApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/FormApi.kt new file mode 100644 index 00000000000..c45ae1a23b6 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/FormApi.kt @@ -0,0 +1,117 @@ +/** + * + * 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 com.fasterxml.jackson.annotation.JsonProperty + +import org.springframework.web.client.RestClient +import org.springframework.web.client.RestClientResponseException + +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter +import org.springframework.http.ResponseEntity +import org.springframework.http.MediaType + + +import org.openapitools.client.infrastructure.* + +class FormApi(client: RestClient) : ApiClient(client) { + + constructor(baseUrl: String) : this(RestClient.builder() + .baseUrl(baseUrl) + .messageConverters { it.add(MappingJackson2HttpMessageConverter()) } + .build() + ) + + + @Throws(RestClientResponseException::class) + fun testFormIntegerBooleanString(integerForm: kotlin.Int? = null, booleanForm: kotlin.Boolean? = null, stringForm: kotlin.String? = null): kotlin.String { + val result = testFormIntegerBooleanStringWithHttpInfo(integerForm = integerForm, booleanForm = booleanForm, stringForm = stringForm) + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testFormIntegerBooleanStringWithHttpInfo(integerForm: kotlin.Int? = null, booleanForm: kotlin.Boolean? = null, stringForm: kotlin.String? = null): ResponseEntity { + val localVariableConfig = testFormIntegerBooleanStringRequestConfig(integerForm = integerForm, booleanForm = booleanForm, stringForm = stringForm) + return request>, kotlin.String>( + localVariableConfig + ) + } + + fun testFormIntegerBooleanStringRequestConfig(integerForm: kotlin.Int? = null, booleanForm: kotlin.Boolean? = null, stringForm: kotlin.String? = null) : RequestConfig>> { + val localVariableBody = mapOf( + "integer_form" to PartConfig(body = integerForm, headers = mutableMapOf()), + "boolean_form" to PartConfig(body = booleanForm, headers = mutableMapOf()), + "string_form" to PartConfig(body = stringForm, headers = mutableMapOf()),) + val localVariableQuery = mutableMapOf>() + val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") + localVariableHeaders["Accept"] = "text/plain" + + val params = mutableMapOf( + ) + + return RequestConfig( + method = RequestMethod.POST, + path = "/form/integer/boolean/string", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + @Throws(RestClientResponseException::class) + fun testFormOneof(form1: kotlin.String? = null, form2: kotlin.Int? = null, form3: kotlin.String? = null, form4: kotlin.Boolean? = null, id: kotlin.Long? = null, name: kotlin.String? = null): kotlin.String { + val result = testFormOneofWithHttpInfo(form1 = form1, form2 = form2, form3 = form3, form4 = form4, id = id, name = name) + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testFormOneofWithHttpInfo(form1: kotlin.String? = null, form2: kotlin.Int? = null, form3: kotlin.String? = null, form4: kotlin.Boolean? = null, id: kotlin.Long? = null, name: kotlin.String? = null): ResponseEntity { + val localVariableConfig = testFormOneofRequestConfig(form1 = form1, form2 = form2, form3 = form3, form4 = form4, id = id, name = name) + return request>, kotlin.String>( + localVariableConfig + ) + } + + fun testFormOneofRequestConfig(form1: kotlin.String? = null, form2: kotlin.Int? = null, form3: kotlin.String? = null, form4: kotlin.Boolean? = null, id: kotlin.Long? = null, name: kotlin.String? = null) : RequestConfig>> { + val localVariableBody = mapOf( + "form1" to PartConfig(body = form1, headers = mutableMapOf()), + "form2" to PartConfig(body = form2, headers = mutableMapOf()), + "form3" to PartConfig(body = form3, headers = mutableMapOf()), + "form4" to PartConfig(body = form4, headers = mutableMapOf()), + "id" to PartConfig(body = id, headers = mutableMapOf()), + "name" to PartConfig(body = name, headers = mutableMapOf()),) + val localVariableQuery = mutableMapOf>() + val localVariableHeaders: MutableMap = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded") + localVariableHeaders["Accept"] = "text/plain" + + val params = mutableMapOf( + ) + + return RequestConfig( + method = RequestMethod.POST, + path = "/form/oneof", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + +} diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt new file mode 100644 index 00000000000..515b383f1a3 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt @@ -0,0 +1,88 @@ +/** + * + * 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 com.fasterxml.jackson.annotation.JsonProperty + +import org.springframework.web.client.RestClient +import org.springframework.web.client.RestClientResponseException + +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter +import org.springframework.http.ResponseEntity +import org.springframework.http.MediaType + + +import org.openapitools.client.models.StringEnumRef +import org.openapitools.client.infrastructure.* + +class HeaderApi(client: RestClient) : ApiClient(client) { + + constructor(baseUrl: String) : this(RestClient.builder() + .baseUrl(baseUrl) + .messageConverters { it.add(MappingJackson2HttpMessageConverter()) } + .build() + ) + + /** + * enum for parameter enumNonrefStringHeader + */ + enum class EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums(val value: kotlin.String) { + @JsonProperty(value = "success") success("success"), + @JsonProperty(value = "failure") failure("failure"), + @JsonProperty(value = "unclassified") unclassified("unclassified"), + } + + + @Throws(RestClientResponseException::class) + fun testHeaderIntegerBooleanStringEnums(integerHeader: kotlin.Int? = null, booleanHeader: kotlin.Boolean? = null, stringHeader: kotlin.String? = null, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums? = null, enumRefStringHeader: StringEnumRef? = null): kotlin.String { + val result = testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader = integerHeader, booleanHeader = booleanHeader, stringHeader = stringHeader, enumNonrefStringHeader = enumNonrefStringHeader, enumRefStringHeader = enumRefStringHeader) + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testHeaderIntegerBooleanStringEnumsWithHttpInfo(integerHeader: kotlin.Int? = null, booleanHeader: kotlin.Boolean? = null, stringHeader: kotlin.String? = null, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums? = null, enumRefStringHeader: StringEnumRef? = null): ResponseEntity { + val localVariableConfig = testHeaderIntegerBooleanStringEnumsRequestConfig(integerHeader = integerHeader, booleanHeader = booleanHeader, stringHeader = stringHeader, enumNonrefStringHeader = enumNonrefStringHeader, enumRefStringHeader = enumRefStringHeader) + return request( + localVariableConfig + ) + } + + fun testHeaderIntegerBooleanStringEnumsRequestConfig(integerHeader: kotlin.Int? = null, booleanHeader: kotlin.Boolean? = null, stringHeader: kotlin.String? = null, enumNonrefStringHeader: EnumNonrefStringHeaderTestHeaderIntegerBooleanStringEnums? = null, enumRefStringHeader: StringEnumRef? = null) : RequestConfig { + val localVariableBody = null + val localVariableQuery = mutableMapOf>() + val localVariableHeaders: MutableMap = mutableMapOf() + integerHeader?.apply { localVariableHeaders["integer_header"] = this.toString() } + booleanHeader?.apply { localVariableHeaders["boolean_header"] = this.toString() } + stringHeader?.apply { localVariableHeaders["string_header"] = this.toString() } + enumNonrefStringHeader?.apply { localVariableHeaders["enum_nonref_string_header"] = this.toString() } + enumRefStringHeader?.apply { localVariableHeaders["enum_ref_string_header"] = this.toString() } + localVariableHeaders["Accept"] = "text/plain" + + val params = mutableMapOf( + ) + + return RequestConfig( + method = RequestMethod.GET, + path = "/header/integer/boolean/string/enums", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + +} diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/PathApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/PathApi.kt new file mode 100644 index 00000000000..2b8592609d4 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/PathApi.kt @@ -0,0 +1,87 @@ +/** + * + * 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 com.fasterxml.jackson.annotation.JsonProperty + +import org.springframework.web.client.RestClient +import org.springframework.web.client.RestClientResponseException + +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter +import org.springframework.http.ResponseEntity +import org.springframework.http.MediaType + + +import org.openapitools.client.models.StringEnumRef +import org.openapitools.client.infrastructure.* + +class PathApi(client: RestClient) : ApiClient(client) { + + constructor(baseUrl: String) : this(RestClient.builder() + .baseUrl(baseUrl) + .messageConverters { it.add(MappingJackson2HttpMessageConverter()) } + .build() + ) + + /** + * enum for parameter enumNonrefStringPath + */ + enum class EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(val value: kotlin.String) { + @JsonProperty(value = "success") success("success"), + @JsonProperty(value = "failure") failure("failure"), + @JsonProperty(value = "unclassified") unclassified("unclassified"), + } + + + @Throws(RestClientResponseException::class) + fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString: kotlin.String, pathInteger: kotlin.Int, enumNonrefStringPath: EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, enumRefStringPath: StringEnumRef): kotlin.String { + val result = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString = pathString, pathInteger = pathInteger, enumNonrefStringPath = enumNonrefStringPath, enumRefStringPath = enumRefStringPath) + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathWithHttpInfo(pathString: kotlin.String, pathInteger: kotlin.Int, enumNonrefStringPath: EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, enumRefStringPath: StringEnumRef): ResponseEntity { + val localVariableConfig = testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestConfig(pathString = pathString, pathInteger = pathInteger, enumNonrefStringPath = enumNonrefStringPath, enumRefStringPath = enumRefStringPath) + return request( + localVariableConfig + ) + } + + fun testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequestConfig(pathString: kotlin.String, pathInteger: kotlin.Int, enumNonrefStringPath: EnumNonrefStringPathTestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath, enumRefStringPath: StringEnumRef) : RequestConfig { + val localVariableBody = null + val localVariableQuery = mutableMapOf>() + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "text/plain" + + val params = mutableMapOf( + "path_string" to pathString, + "path_integer" to pathInteger, + "enum_nonref_string_path" to enumNonrefStringPath.value, + "enum_ref_string_path" to enumRefStringPath, + ) + + return RequestConfig( + method = RequestMethod.GET, + path = "/path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + +} diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt new file mode 100644 index 00000000000..d7e0a175ed3 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt @@ -0,0 +1,305 @@ +/** + * + * 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 com.fasterxml.jackson.annotation.JsonProperty + +import org.springframework.web.client.RestClient +import org.springframework.web.client.RestClientResponseException + +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter +import org.springframework.http.ResponseEntity +import org.springframework.http.MediaType + + +import org.openapitools.client.models.Pet +import org.openapitools.client.models.StringEnumRef +import org.openapitools.client.models.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter +import org.openapitools.client.infrastructure.* + +class QueryApi(client: RestClient) : ApiClient(client) { + + constructor(baseUrl: String) : this(RestClient.builder() + .baseUrl(baseUrl) + .messageConverters { it.add(MappingJackson2HttpMessageConverter()) } + .build() + ) + + /** + * enum for parameter enumNonrefStringQuery + */ + enum class EnumNonrefStringQueryTestEnumRefString(val value: kotlin.String) { + @JsonProperty(value = "success") success("success"), + @JsonProperty(value = "failure") failure("failure"), + @JsonProperty(value = "unclassified") unclassified("unclassified"), + } + + + @Throws(RestClientResponseException::class) + fun testEnumRefString(enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString? = null, enumRefStringQuery: StringEnumRef? = null): kotlin.String { + val result = testEnumRefStringWithHttpInfo(enumNonrefStringQuery = enumNonrefStringQuery, enumRefStringQuery = enumRefStringQuery) + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testEnumRefStringWithHttpInfo(enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString? = null, enumRefStringQuery: StringEnumRef? = null): ResponseEntity { + val localVariableConfig = testEnumRefStringRequestConfig(enumNonrefStringQuery = enumNonrefStringQuery, enumRefStringQuery = enumRefStringQuery) + return request( + localVariableConfig + ) + } + + fun testEnumRefStringRequestConfig(enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString? = null, enumRefStringQuery: StringEnumRef? = null) : RequestConfig { + val localVariableBody = null + val localVariableQuery = mutableMapOf>() + .apply { + if (enumNonrefStringQuery != null) { + put("enum_nonref_string_query", listOf(enumNonrefStringQuery.toString())) + } + if (enumRefStringQuery != null) { + put("enum_ref_string_query", listOf(enumRefStringQuery.toString())) + } + } + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "text/plain" + + val params = mutableMapOf( + ) + + return RequestConfig( + method = RequestMethod.GET, + path = "/query/enum_ref_string", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + @Throws(RestClientResponseException::class) + fun testQueryDatetimeDateString(datetimeQuery: java.time.OffsetDateTime? = null, dateQuery: java.time.LocalDate? = null, stringQuery: kotlin.String? = null): kotlin.String { + val result = testQueryDatetimeDateStringWithHttpInfo(datetimeQuery = datetimeQuery, dateQuery = dateQuery, stringQuery = stringQuery) + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testQueryDatetimeDateStringWithHttpInfo(datetimeQuery: java.time.OffsetDateTime? = null, dateQuery: java.time.LocalDate? = null, stringQuery: kotlin.String? = null): ResponseEntity { + val localVariableConfig = testQueryDatetimeDateStringRequestConfig(datetimeQuery = datetimeQuery, dateQuery = dateQuery, stringQuery = stringQuery) + return request( + localVariableConfig + ) + } + + fun testQueryDatetimeDateStringRequestConfig(datetimeQuery: java.time.OffsetDateTime? = null, dateQuery: java.time.LocalDate? = null, stringQuery: kotlin.String? = null) : RequestConfig { + val localVariableBody = null + val localVariableQuery = mutableMapOf>() + .apply { + if (datetimeQuery != null) { + put("datetime_query", listOf(parseDateToQueryString(datetimeQuery))) + } + if (dateQuery != null) { + put("date_query", listOf(parseDateToQueryString(dateQuery))) + } + if (stringQuery != null) { + put("string_query", listOf(stringQuery.toString())) + } + } + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "text/plain" + + val params = mutableMapOf( + ) + + return RequestConfig( + method = RequestMethod.GET, + path = "/query/datetime/date/string", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + @Throws(RestClientResponseException::class) + fun testQueryIntegerBooleanString(integerQuery: kotlin.Int? = null, booleanQuery: kotlin.Boolean? = null, stringQuery: kotlin.String? = null): kotlin.String { + val result = testQueryIntegerBooleanStringWithHttpInfo(integerQuery = integerQuery, booleanQuery = booleanQuery, stringQuery = stringQuery) + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testQueryIntegerBooleanStringWithHttpInfo(integerQuery: kotlin.Int? = null, booleanQuery: kotlin.Boolean? = null, stringQuery: kotlin.String? = null): ResponseEntity { + val localVariableConfig = testQueryIntegerBooleanStringRequestConfig(integerQuery = integerQuery, booleanQuery = booleanQuery, stringQuery = stringQuery) + return request( + localVariableConfig + ) + } + + fun testQueryIntegerBooleanStringRequestConfig(integerQuery: kotlin.Int? = null, booleanQuery: kotlin.Boolean? = null, stringQuery: kotlin.String? = null) : RequestConfig { + val localVariableBody = null + val localVariableQuery = mutableMapOf>() + .apply { + if (integerQuery != null) { + put("integer_query", listOf(integerQuery.toString())) + } + if (booleanQuery != null) { + put("boolean_query", listOf(booleanQuery.toString())) + } + if (stringQuery != null) { + put("string_query", listOf(stringQuery.toString())) + } + } + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "text/plain" + + val params = mutableMapOf( + ) + + return RequestConfig( + method = RequestMethod.GET, + path = "/query/integer/boolean/string", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + @Throws(RestClientResponseException::class) + fun testQueryStyleDeepObjectExplodeTrueObject(queryObject: Pet? = null): kotlin.String { + val result = testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject = queryObject) + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testQueryStyleDeepObjectExplodeTrueObjectWithHttpInfo(queryObject: Pet? = null): ResponseEntity { + val localVariableConfig = testQueryStyleDeepObjectExplodeTrueObjectRequestConfig(queryObject = queryObject) + return request( + localVariableConfig + ) + } + + fun testQueryStyleDeepObjectExplodeTrueObjectRequestConfig(queryObject: Pet? = null) : RequestConfig { + val localVariableBody = null + val localVariableQuery = mutableMapOf>() + .apply { + if (queryObject != null) { + put("query_object", listOf(queryObject.toString())) + } + } + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "text/plain" + + val params = mutableMapOf( + ) + + return RequestConfig( + method = RequestMethod.GET, + path = "/query/style_deepObject/explode_true/object", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + @Throws(RestClientResponseException::class) + fun testQueryStyleFormExplodeTrueArrayString(queryObject: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? = null): kotlin.String { + val result = testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject = queryObject) + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testQueryStyleFormExplodeTrueArrayStringWithHttpInfo(queryObject: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? = null): ResponseEntity { + val localVariableConfig = testQueryStyleFormExplodeTrueArrayStringRequestConfig(queryObject = queryObject) + return request( + localVariableConfig + ) + } + + fun testQueryStyleFormExplodeTrueArrayStringRequestConfig(queryObject: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter? = null) : RequestConfig { + val localVariableBody = null + val localVariableQuery = mutableMapOf>() + .apply { + if (queryObject != null) { + put("query_object", listOf(queryObject.toString())) + } + } + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "text/plain" + + val params = mutableMapOf( + ) + + return RequestConfig( + method = RequestMethod.GET, + path = "/query/style_form/explode_true/array_string", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + + + @Throws(RestClientResponseException::class) + fun testQueryStyleFormExplodeTrueObject(queryObject: Pet? = null): kotlin.String { + val result = testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject = queryObject) + return result.body!! + } + + @Throws(RestClientResponseException::class) + fun testQueryStyleFormExplodeTrueObjectWithHttpInfo(queryObject: Pet? = null): ResponseEntity { + val localVariableConfig = testQueryStyleFormExplodeTrueObjectRequestConfig(queryObject = queryObject) + return request( + localVariableConfig + ) + } + + fun testQueryStyleFormExplodeTrueObjectRequestConfig(queryObject: Pet? = null) : RequestConfig { + val localVariableBody = null + val localVariableQuery = mutableMapOf>() + .apply { + if (queryObject != null) { + put("query_object", listOf(queryObject.toString())) + } + } + val localVariableHeaders: MutableMap = mutableMapOf() + localVariableHeaders["Accept"] = "text/plain" + + val params = mutableMapOf( + ) + + return RequestConfig( + method = RequestMethod.GET, + path = "/query/style_form/explode_true/object", + params = params, + query = localVariableQuery, + headers = localVariableHeaders, + requiresAuthentication = false, + body = localVariableBody + ) + } + +} diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt new file mode 100644 index 00000000000..a4a4491eac0 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/infrastructure/ApiAbstractions.kt @@ -0,0 +1,23 @@ +package org.openapitools.client.infrastructure + +typealias MultiValueMap = MutableMap> + +fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) { + "csv" -> "," + "tsv" -> "\t" + "pipe" -> "|" + "space" -> " " + else -> "" +} + +val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" } + +fun toMultiValue(items: Array, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter) + = toMultiValue(items.asIterable(), collectionFormat, map) + +fun toMultiValue(items: Iterable, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List { + return when(collectionFormat) { + "multi" -> items.map(map) + else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map)) + } +} diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt new file mode 100644 index 00000000000..64f843ed93b --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/infrastructure/ApiClient.kt @@ -0,0 +1,61 @@ +package org.openapitools.client.infrastructure; + +import org.springframework.core.ParameterizedTypeReference +import org.springframework.http.HttpHeaders +import org.springframework.http.HttpMethod +import org.springframework.http.MediaType +import org.springframework.web.client.RestClient +import org.springframework.http.ResponseEntity +import org.springframework.util.LinkedMultiValueMap + +open class ApiClient(protected val client: RestClient) { + + protected inline fun request(requestConfig: RequestConfig): ResponseEntity { + return prepare(defaults(requestConfig)) + .retrieve() + .toEntity(object : ParameterizedTypeReference() {}) + } + + protected fun prepare(requestConfig: RequestConfig) = + client.method(requestConfig) + .uri(requestConfig) + .headers(requestConfig) + .nullableBody(requestConfig) + + protected fun defaults(requestConfig: RequestConfig) = + requestConfig.apply { + if (body != null && headers[HttpHeaders.CONTENT_TYPE].isNullOrEmpty()) { + headers[HttpHeaders.CONTENT_TYPE] = MediaType.APPLICATION_JSON_VALUE + } + if (headers[HttpHeaders.ACCEPT].isNullOrEmpty()) { + headers[HttpHeaders.ACCEPT] = MediaType.APPLICATION_JSON_VALUE + } + } + + private fun RestClient.method(requestConfig: RequestConfig)= + method(HttpMethod.valueOf(requestConfig.method.name)) + + private fun RestClient.RequestBodyUriSpec.uri(requestConfig: RequestConfig) = + uri { builder -> + builder + .path(requestConfig.path) + .queryParams(LinkedMultiValueMap(requestConfig.query)) + .build(requestConfig.params) + } + + private fun RestClient.RequestBodySpec.headers(requestConfig: RequestConfig) = + apply { requestConfig.headers.forEach { (name, value) -> header(name, value) } } + + private fun RestClient.RequestBodySpec.nullableBody(requestConfig: RequestConfig) = + apply { if (requestConfig.body != null) body(requestConfig.body) } +} + +inline fun parseDateToQueryString(value : T): String { + /* + .replace("\"", "") converts the json object string to an actual string for the query parameter. + The moshi or gson adapter allows a more generic solution instead of trying to use a native + formatter. It also easily allows to provide a simple way to define a custom date format pattern + inside a gson/moshi adapter. + */ + return Serializer.jacksonObjectMapper.writeValueAsString(value).replace("\"", "") + } diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt new file mode 100644 index 00000000000..be00e38fbae --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/infrastructure/PartConfig.kt @@ -0,0 +1,11 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given part of a multi-part request. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class PartConfig( + val headers: MutableMap = mutableMapOf(), + val body: T? = null +) diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt new file mode 100644 index 00000000000..6578b9381b7 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/infrastructure/RequestConfig.kt @@ -0,0 +1,19 @@ +package org.openapitools.client.infrastructure + +/** + * Defines a config object for a given request. + * NOTE: This object doesn't include 'body' because it + * allows for caching of the constructed object + * for many request definitions. + * NOTE: Headers is a Map because rfc2616 defines + * multi-valued headers as csv-only. + */ +data class RequestConfig( + val method: RequestMethod, + val path: String, + val headers: MutableMap = mutableMapOf(), + val params: MutableMap = mutableMapOf(), + val query: MutableMap> = mutableMapOf(), + val requiresAuthentication: Boolean, + val body: T? = null +) diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt new file mode 100644 index 00000000000..beb56f07cdd --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/infrastructure/RequestMethod.kt @@ -0,0 +1,8 @@ +package org.openapitools.client.infrastructure + +/** + * Provides enumerated HTTP verbs + */ +enum class RequestMethod { + GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT +} diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt new file mode 100644 index 00000000000..6a09fd57f30 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt @@ -0,0 +1,16 @@ +package org.openapitools.client.infrastructure + +import com.fasterxml.jackson.databind.DeserializationFeature +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.SerializationFeature +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper + +object Serializer { + @JvmStatic + val jacksonObjectMapper: ObjectMapper = jacksonObjectMapper() + .findAndRegisterModules() + .setSerializationInclusion(JsonInclude.Include.NON_ABSENT) + .configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE, true) + .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false) +} diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Bird.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Bird.kt new file mode 100644 index 00000000000..c63c0366edf --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Bird.kt @@ -0,0 +1,39 @@ +/** + * + * 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.fasterxml.jackson.annotation.JsonEnumDefaultValue +import com.fasterxml.jackson.annotation.JsonProperty + +/** + * + * + * @param propertySize + * @param color + */ + + +data class Bird ( + + @field:JsonProperty("size") + val propertySize: kotlin.String? = null, + + @field:JsonProperty("color") + val color: kotlin.String? = null + +) + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Category.kt new file mode 100644 index 00000000000..e62c174314a --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Category.kt @@ -0,0 +1,39 @@ +/** + * + * 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.fasterxml.jackson.annotation.JsonEnumDefaultValue +import com.fasterxml.jackson.annotation.JsonProperty + +/** + * + * + * @param id + * @param name + */ + + +data class Category ( + + @field:JsonProperty("id") + val id: kotlin.Long? = null, + + @field:JsonProperty("name") + val name: kotlin.String? = null + +) + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/DefaultValue.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/DefaultValue.kt new file mode 100644 index 00000000000..894db93c77e --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/DefaultValue.kt @@ -0,0 +1,77 @@ +/** + * + * 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.StringEnumRef + +import com.fasterxml.jackson.annotation.JsonEnumDefaultValue +import com.fasterxml.jackson.annotation.JsonProperty + +/** + * to test the default value of properties + * + * @param arrayStringEnumRefDefault + * @param arrayStringEnumDefault + * @param arrayStringDefault + * @param arrayIntegerDefault + * @param arrayString + * @param arrayStringNullable + * @param arrayStringExtensionNullable + * @param stringNullable + */ + + +data class DefaultValue ( + + @field:JsonProperty("array_string_enum_ref_default") + val arrayStringEnumRefDefault: kotlin.collections.List? = null, + + @field:JsonProperty("array_string_enum_default") + val arrayStringEnumDefault: kotlin.collections.List? = null, + + @field:JsonProperty("array_string_default") + val arrayStringDefault: kotlin.collections.List? = arrayListOf("failure","skipped"), + + @field:JsonProperty("array_integer_default") + val arrayIntegerDefault: kotlin.collections.List? = arrayListOf(1,3), + + @field:JsonProperty("array_string") + val arrayString: kotlin.collections.List? = null, + + @field:JsonProperty("array_string_nullable") + val arrayStringNullable: kotlin.collections.List? = null, + + @field:JsonProperty("array_string_extension_nullable") + val arrayStringExtensionNullable: kotlin.collections.List? = null, + + @field:JsonProperty("string_nullable") + val stringNullable: kotlin.String? = null + +) { + + /** + * + * + * Values: success,failure,unclassified,unknownDefaultOpenApi + */ + enum class ArrayStringEnumDefault(val value: kotlin.String) { + @JsonProperty(value = "success") success("success"), + @JsonProperty(value = "failure") failure("failure"), + @JsonProperty(value = "unclassified") unclassified("unclassified"), + @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api"); + } +} + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/NumberPropertiesOnly.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/NumberPropertiesOnly.kt new file mode 100644 index 00000000000..0f1c287e41a --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/NumberPropertiesOnly.kt @@ -0,0 +1,43 @@ +/** + * + * 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.fasterxml.jackson.annotation.JsonEnumDefaultValue +import com.fasterxml.jackson.annotation.JsonProperty + +/** + * + * + * @param number + * @param float + * @param double + */ + + +data class NumberPropertiesOnly ( + + @field:JsonProperty("number") + val number: java.math.BigDecimal? = null, + + @field:JsonProperty("float") + val float: kotlin.Float? = null, + + @field:JsonProperty("double") + val double: kotlin.Double? = null + +) + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Pet.kt new file mode 100644 index 00000000000..355a8d07b56 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Pet.kt @@ -0,0 +1,71 @@ +/** + * + * 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.Tag + +import com.fasterxml.jackson.annotation.JsonEnumDefaultValue +import com.fasterxml.jackson.annotation.JsonProperty + +/** + * + * + * @param name + * @param photoUrls + * @param id + * @param category + * @param tags + * @param status pet status in the store + */ + + +data class Pet ( + + @field:JsonProperty("name") + val name: kotlin.String, + + @field:JsonProperty("photoUrls") + val photoUrls: kotlin.collections.List, + + @field:JsonProperty("id") + val id: kotlin.Long? = null, + + @field:JsonProperty("category") + val category: Category? = null, + + @field:JsonProperty("tags") + val tags: kotlin.collections.List? = null, + + /* pet status in the store */ + @field:JsonProperty("status") + val status: Pet.Status? = null + +) { + + /** + * pet status in the store + * + * Values: available,pending,sold,unknownDefaultOpenApi + */ + enum class Status(val value: kotlin.String) { + @JsonProperty(value = "available") available("available"), + @JsonProperty(value = "pending") pending("pending"), + @JsonProperty(value = "sold") sold("sold"), + @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api"); + } +} + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Query.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Query.kt new file mode 100644 index 00000000000..679fc593962 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Query.kt @@ -0,0 +1,53 @@ +/** + * + * 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.fasterxml.jackson.annotation.JsonEnumDefaultValue +import com.fasterxml.jackson.annotation.JsonProperty + +/** + * + * + * @param id Query + * @param outcomes + */ + + +data class Query ( + + /* Query */ + @field:JsonProperty("id") + val id: kotlin.Long? = null, + + @field:JsonProperty("outcomes") + val outcomes: kotlin.collections.List? = null + +) { + + /** + * + * + * Values: sUCCESS,fAILURE,sKIPPED,unknownDefaultOpenApi + */ + enum class Outcomes(val value: kotlin.String) { + @JsonProperty(value = "SUCCESS") sUCCESS("SUCCESS"), + @JsonProperty(value = "FAILURE") fAILURE("FAILURE"), + @JsonProperty(value = "SKIPPED") sKIPPED("SKIPPED"), + @JsonProperty(value = "unknown_default_open_api") @JsonEnumDefaultValue unknownDefaultOpenApi("unknown_default_open_api"); + } +} + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/StringEnumRef.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/StringEnumRef.kt new file mode 100644 index 00000000000..e85cc978ab6 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/StringEnumRef.kt @@ -0,0 +1,67 @@ +/** + * + * 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.fasterxml.jackson.annotation.JsonProperty + +/** + * + * + * Values: success,failure,unclassified,unknownDefaultOpenApi + */ + +enum class StringEnumRef(val value: kotlin.String) { + + @JsonProperty(value = "success") + success("success"), + + @JsonProperty(value = "failure") + failure("failure"), + + @JsonProperty(value = "unclassified") + unclassified("unclassified"), + + @JsonProperty(value = "unknown_default_open_api") + unknownDefaultOpenApi("unknown_default_open_api"); + + /** + * Override [toString()] to avoid using the enum variable name as the value, and instead use + * the actual value defined in the API spec file. + * + * This solves a problem when the variable name and its value are different, and ensures that + * the client sends the correct enum values to the server always. + */ + override fun toString(): kotlin.String = value + + companion object { + /** + * Converts the provided [data] to a [String] on success, null otherwise. + */ + fun encode(data: kotlin.Any?): kotlin.String? = if (data is StringEnumRef) "$data" else null + + /** + * Returns a valid [StringEnumRef] for [data], null otherwise. + */ + fun decode(data: kotlin.Any?): StringEnumRef? = data?.let { + val normalizedData = "$it".lowercase() + values().firstOrNull { value -> + it == value || normalizedData == "$value".lowercase() + } + } + } +} + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Tag.kt new file mode 100644 index 00000000000..36d7c43ee87 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/Tag.kt @@ -0,0 +1,39 @@ +/** + * + * 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.fasterxml.jackson.annotation.JsonEnumDefaultValue +import com.fasterxml.jackson.annotation.JsonProperty + +/** + * + * + * @param id + * @param name + */ + + +data class Tag ( + + @field:JsonProperty("id") + val id: kotlin.Long? = null, + + @field:JsonProperty("name") + val name: kotlin.String? = null + +) + diff --git a/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.kt b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.kt new file mode 100644 index 00000000000..cb6010f5d40 --- /dev/null +++ b/samples/client/echo_api/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/models/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.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 com.fasterxml.jackson.annotation.JsonEnumDefaultValue +import com.fasterxml.jackson.annotation.JsonProperty + +/** + * + * + * @param propertyValues + */ + + +data class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter ( + + @field:JsonProperty("values") + val propertyValues: kotlin.collections.List? = null + +) + diff --git a/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 25416732825..50d8b7332bd 100644 --- a/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -82,7 +82,7 @@ class PetApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null): Mono { return deletePetWithHttpInfo(petId = petId, apiKey = apiKey) - .map { it.body } + .map { Unit } } @Throws(WebClientResponseException::class) @@ -279,7 +279,7 @@ class PetApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null): Mono { return updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status) - .map { it.body } + .map { Unit } } @Throws(WebClientResponseException::class) diff --git a/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index c4431bade12..c5302caaf0a 100644 --- a/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -44,7 +44,7 @@ class StoreApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun deleteOrder(orderId: kotlin.String): Mono { return deleteOrderWithHttpInfo(orderId = orderId) - .map { it.body } + .map { Unit } } @Throws(WebClientResponseException::class) diff --git a/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 17caea45e59..c589c574c1b 100644 --- a/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-2-webclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -44,7 +44,7 @@ class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun createUser(user: User): Mono { return createUserWithHttpInfo(user = user) - .map { it.body } + .map { Unit } } @Throws(WebClientResponseException::class) @@ -79,7 +79,7 @@ class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun createUsersWithArrayInput(user: kotlin.collections.List): Mono { return createUsersWithArrayInputWithHttpInfo(user = user) - .map { it.body } + .map { Unit } } @Throws(WebClientResponseException::class) @@ -114,7 +114,7 @@ class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun createUsersWithListInput(user: kotlin.collections.List): Mono { return createUsersWithListInputWithHttpInfo(user = user) - .map { it.body } + .map { Unit } } @Throws(WebClientResponseException::class) @@ -149,7 +149,7 @@ class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun deleteUser(username: kotlin.String): Mono { return deleteUserWithHttpInfo(username = username) - .map { it.body } + .map { Unit } } @Throws(WebClientResponseException::class) @@ -259,7 +259,7 @@ class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun logoutUser(): Mono { return logoutUserWithHttpInfo() - .map { it.body } + .map { Unit } } @Throws(WebClientResponseException::class) @@ -293,7 +293,7 @@ class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun updateUser(username: kotlin.String, user: User): Mono { return updateUserWithHttpInfo(username = username, user = user) - .map { it.body } + .map { Unit } } @Throws(WebClientResponseException::class) diff --git a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 6764aa89175..f1548da94e5 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -40,8 +40,8 @@ class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun addPet(pet: Pet): Pet { - return addPetWithHttpInfo(pet = pet) - .body!! + val result = addPetWithHttpInfo(pet = pet) + return result.body!! } @Throws(RestClientResponseException::class) @@ -77,8 +77,7 @@ class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null): Unit { - return deletePetWithHttpInfo(petId = petId, apiKey = apiKey) - .body!! + val result = deletePetWithHttpInfo(petId = petId, apiKey = apiKey) } @Throws(RestClientResponseException::class) @@ -122,8 +121,8 @@ class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun findPetsByStatus(status: kotlin.collections.List): kotlin.collections.List { - return findPetsByStatusWithHttpInfo(status = status) - .body!! + val result = findPetsByStatusWithHttpInfo(status = status) + return result.body!! } @Throws(RestClientResponseException::class) @@ -161,8 +160,8 @@ class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) @Deprecated(message = "This operation is deprecated.") fun findPetsByTags(tags: kotlin.collections.List): kotlin.collections.List { - return findPetsByTagsWithHttpInfo(tags = tags) - .body!! + val result = findPetsByTagsWithHttpInfo(tags = tags) + return result.body!! } @Throws(RestClientResponseException::class) @@ -201,8 +200,8 @@ class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun getPetById(petId: kotlin.Long): Pet { - return getPetByIdWithHttpInfo(petId = petId) - .body!! + val result = getPetByIdWithHttpInfo(petId = petId) + return result.body!! } @Throws(RestClientResponseException::class) @@ -237,8 +236,8 @@ class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun updatePet(pet: Pet): Pet { - return updatePetWithHttpInfo(pet = pet) - .body!! + val result = updatePetWithHttpInfo(pet = pet) + return result.body!! } @Throws(RestClientResponseException::class) @@ -274,8 +273,7 @@ class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null): Unit { - return updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status) - .body!! + val result = updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status) } @Throws(RestClientResponseException::class) @@ -311,8 +309,8 @@ class PetApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String? = null, file: java.io.File? = null): ModelApiResponse { - return uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) - .body!! + val result = uploadFileWithHttpInfo(petId = petId, additionalMetadata = additionalMetadata, file = file) + return result.body!! } @Throws(RestClientResponseException::class) diff --git a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index db6575d3f11..e16a1593944 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -39,8 +39,7 @@ class StoreApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun deleteOrder(orderId: kotlin.String): Unit { - return deleteOrderWithHttpInfo(orderId = orderId) - .body!! + val result = deleteOrderWithHttpInfo(orderId = orderId) } @Throws(RestClientResponseException::class) @@ -74,8 +73,8 @@ class StoreApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun getInventory(): kotlin.collections.Map { - return getInventoryWithHttpInfo() - .body!! + val result = getInventoryWithHttpInfo() + return result.body!! } @Throws(RestClientResponseException::class) @@ -109,8 +108,8 @@ class StoreApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun getOrderById(orderId: kotlin.Long): Order { - return getOrderByIdWithHttpInfo(orderId = orderId) - .body!! + val result = getOrderByIdWithHttpInfo(orderId = orderId) + return result.body!! } @Throws(RestClientResponseException::class) @@ -145,8 +144,8 @@ class StoreApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun placeOrder(order: Order): Order { - return placeOrderWithHttpInfo(order = order) - .body!! + val result = placeOrderWithHttpInfo(order = order) + return result.body!! } @Throws(RestClientResponseException::class) diff --git a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index ee57ffe0861..caa0f6729b6 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-3-restclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -39,8 +39,7 @@ class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun createUser(user: User): Unit { - return createUserWithHttpInfo(user = user) - .body!! + val result = createUserWithHttpInfo(user = user) } @Throws(RestClientResponseException::class) @@ -74,8 +73,7 @@ class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun createUsersWithArrayInput(user: kotlin.collections.List): Unit { - return createUsersWithArrayInputWithHttpInfo(user = user) - .body!! + val result = createUsersWithArrayInputWithHttpInfo(user = user) } @Throws(RestClientResponseException::class) @@ -109,8 +107,7 @@ class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun createUsersWithListInput(user: kotlin.collections.List): Unit { - return createUsersWithListInputWithHttpInfo(user = user) - .body!! + val result = createUsersWithListInputWithHttpInfo(user = user) } @Throws(RestClientResponseException::class) @@ -144,8 +141,7 @@ class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun deleteUser(username: kotlin.String): Unit { - return deleteUserWithHttpInfo(username = username) - .body!! + val result = deleteUserWithHttpInfo(username = username) } @Throws(RestClientResponseException::class) @@ -179,8 +175,8 @@ class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun getUserByName(username: kotlin.String): User { - return getUserByNameWithHttpInfo(username = username) - .body!! + val result = getUserByNameWithHttpInfo(username = username) + return result.body!! } @Throws(RestClientResponseException::class) @@ -215,8 +211,8 @@ class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String { - return loginUserWithHttpInfo(username = username, password = password) - .body!! + val result = loginUserWithHttpInfo(username = username, password = password) + return result.body!! } @Throws(RestClientResponseException::class) @@ -254,8 +250,7 @@ class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun logoutUser(): Unit { - return logoutUserWithHttpInfo() - .body!! + val result = logoutUserWithHttpInfo() } @Throws(RestClientResponseException::class) @@ -288,8 +283,7 @@ class UserApi(client: RestClient) : ApiClient(client) { @Throws(RestClientResponseException::class) fun updateUser(username: kotlin.String, user: User): Unit { - return updateUserWithHttpInfo(username = username, user = user) - .body!! + val result = updateUserWithHttpInfo(username = username, user = user) } @Throws(RestClientResponseException::class) diff --git a/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 25416732825..50d8b7332bd 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -82,7 +82,7 @@ class PetApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun deletePet(petId: kotlin.Long, apiKey: kotlin.String? = null): Mono { return deletePetWithHttpInfo(petId = petId, apiKey = apiKey) - .map { it.body } + .map { Unit } } @Throws(WebClientResponseException::class) @@ -279,7 +279,7 @@ class PetApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String? = null, status: kotlin.String? = null): Mono { return updatePetWithFormWithHttpInfo(petId = petId, name = name, status = status) - .map { it.body } + .map { Unit } } @Throws(WebClientResponseException::class) diff --git a/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt index c4431bade12..c5302caaf0a 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt @@ -44,7 +44,7 @@ class StoreApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun deleteOrder(orderId: kotlin.String): Mono { return deleteOrderWithHttpInfo(orderId = orderId) - .map { it.body } + .map { Unit } } @Throws(WebClientResponseException::class) diff --git a/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt index 17caea45e59..c589c574c1b 100644 --- a/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt +++ b/samples/client/petstore/kotlin-jvm-spring-3-webclient/src/main/kotlin/org/openapitools/client/apis/UserApi.kt @@ -44,7 +44,7 @@ class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun createUser(user: User): Mono { return createUserWithHttpInfo(user = user) - .map { it.body } + .map { Unit } } @Throws(WebClientResponseException::class) @@ -79,7 +79,7 @@ class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun createUsersWithArrayInput(user: kotlin.collections.List): Mono { return createUsersWithArrayInputWithHttpInfo(user = user) - .map { it.body } + .map { Unit } } @Throws(WebClientResponseException::class) @@ -114,7 +114,7 @@ class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun createUsersWithListInput(user: kotlin.collections.List): Mono { return createUsersWithListInputWithHttpInfo(user = user) - .map { it.body } + .map { Unit } } @Throws(WebClientResponseException::class) @@ -149,7 +149,7 @@ class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun deleteUser(username: kotlin.String): Mono { return deleteUserWithHttpInfo(username = username) - .map { it.body } + .map { Unit } } @Throws(WebClientResponseException::class) @@ -259,7 +259,7 @@ class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun logoutUser(): Mono { return logoutUserWithHttpInfo() - .map { it.body } + .map { Unit } } @Throws(WebClientResponseException::class) @@ -293,7 +293,7 @@ class UserApi(client: WebClient) : ApiClient(client) { @Throws(WebClientResponseException::class) fun updateUser(username: kotlin.String, user: User): Mono { return updateUserWithHttpInfo(username = username, user = user) - .map { it.body } + .map { Unit } } @Throws(WebClientResponseException::class)