diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java
index ed5418ab4a3e54e9ca5785c70d00f7a8fdc740fb..12a5387da6e21928b63422d268041717c778d23d 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java
@@ -602,7 +602,11 @@ public class GoClientCodegen extends AbstractGoCodegen {
         } else if (codegenModel.isEnum) {
             Map<String, Object> allowableValues = codegenModel.allowableValues;
             List<Object> values = (List<Object>) allowableValues.get("values");
-            return goImportAlias + "." + model + "(\"" + String.valueOf(values.get(0)) + "\")";
+            String example = String.valueOf(values.get(0));
+            if (codegenModel.isString) {
+                example = "\"" + example + "\"";
+            }
+            return goImportAlias + "." + model + "(" + example + ")";
         } else if (codegenModel.oneOf != null && !codegenModel.oneOf.isEmpty()) {
             String subModel = (String) codegenModel.oneOf.toArray()[0];
             String oneOf = constructExampleCode(modelMaps.get(subModel), modelMaps, processedModelMap).substring(1);
diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
index 4b984814471c88692a98e81d6f9ab34fc9230c52..431dd54b0310360c08e87692e38f60f3f0053203 100644
--- a/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
+++ b/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
@@ -846,6 +846,26 @@ paths:
             schema:
               $ref: '#/components/schemas/OuterNumber'
         description: Input number as post body
+  /fake/property/enum-int:
+    post:
+      tags:
+        - fake
+      description: Test serialization of enum (int) properties with examples
+      operationId: fakePropertyEnumIntegerSerialize
+      responses:
+        '200':
+          description: Output enum (int)
+          content:
+            '*/*':
+              schema:
+                $ref: '#/components/schemas/OuterObjectWithEnumProperty'
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/OuterObjectWithEnumProperty'
+        description: Input enum (int) as post body
   /fake/outer/string:
     post:
       tags:
@@ -1691,6 +1711,7 @@ components:
       - 0
       - 1
       - 2
+      example: 2
     OuterEnumDefaultValue:
       type: string
       enum:
@@ -1812,3 +1833,12 @@ components:
       additionalProperties:
         type: object
         nullable: true
+    OuterObjectWithEnumProperty:
+      type: object
+      example:
+        value: 2
+      required:
+        - value
+      properties:
+        value:
+          $ref: '#/components/schemas/OuterEnumInteger'
\ No newline at end of file
diff --git a/samples/client/petstore/csharp/OpenAPIClient/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient/.openapi-generator/FILES
index 84bc4947446412c3104ff3477a80110bac4f65af..5354a2e17d7064b05e9b440f0ff32ab8a51bcdb6 100644
--- a/samples/client/petstore/csharp/OpenAPIClient/.openapi-generator/FILES
+++ b/samples/client/petstore/csharp/OpenAPIClient/.openapi-generator/FILES
@@ -45,6 +45,7 @@ docs/OuterEnum.md
 docs/OuterEnumDefaultValue.md
 docs/OuterEnumInteger.md
 docs/OuterEnumIntegerDefaultValue.md
+docs/OuterObjectWithEnumProperty.md
 docs/Pet.md
 docs/PetApi.md
 docs/ReadOnlyFirst.md
@@ -56,6 +57,7 @@ docs/User.md
 docs/UserApi.md
 git_push.sh
 mono_nunit_test.sh
+src/Org.OpenAPITools.Test/Model/OuterObjectWithEnumPropertyTests.cs
 src/Org.OpenAPITools.Test/packages.config
 src/Org.OpenAPITools/Api/AnotherFakeApi.cs
 src/Org.OpenAPITools/Api/DefaultApi.cs
@@ -110,6 +112,7 @@ src/Org.OpenAPITools/Model/OuterEnum.cs
 src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs
 src/Org.OpenAPITools/Model/OuterEnumInteger.cs
 src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs
+src/Org.OpenAPITools/Model/OuterObjectWithEnumProperty.cs
 src/Org.OpenAPITools/Model/Pet.cs
 src/Org.OpenAPITools/Model/ReadOnlyFirst.cs
 src/Org.OpenAPITools/Model/Return.cs
diff --git a/samples/client/petstore/csharp/OpenAPIClient/README.md b/samples/client/petstore/csharp/OpenAPIClient/README.md
index b99f1f79d97c3a2345d8034d049676945b26ad5f..f33c01b2a43ddc47e399c82f5f953ce81f962d29 100644
--- a/samples/client/petstore/csharp/OpenAPIClient/README.md
+++ b/samples/client/petstore/csharp/OpenAPIClient/README.md
@@ -113,6 +113,7 @@ Class | Method | HTTP request | Description
 *FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | 
 *FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | 
 *FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | 
+*FakeApi* | [**FakePropertyEnumIntegerSerialize**](docs/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | 
 *FakeApi* | [**TestBodyWithFileSchema**](docs/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | 
 *FakeApi* | [**TestBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | 
 *FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model
@@ -185,6 +186,7 @@ Class | Method | HTTP request | Description
  - [Model.OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md)
  - [Model.OuterEnumInteger](docs/OuterEnumInteger.md)
  - [Model.OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
+ - [Model.OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md)
  - [Model.Pet](docs/Pet.md)
  - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md)
  - [Model.Return](docs/Return.md)
diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient/docs/FakeApi.md
index 38ab478e715b2d8d45eae51e83cec80365bb2bfc..b60a61bae4b5fcdf0872da82b946d4e3cf107aa1 100644
--- a/samples/client/petstore/csharp/OpenAPIClient/docs/FakeApi.md
+++ b/samples/client/petstore/csharp/OpenAPIClient/docs/FakeApi.md
@@ -10,6 +10,7 @@ Method | HTTP request | Description
 [**FakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | 
 [**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | 
 [**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | 
+[**FakePropertyEnumIntegerSerialize**](FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | 
 [**TestBodyWithFileSchema**](FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | 
 [**TestBodyWithQueryParams**](FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | 
 [**TestClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \&quot;client\&quot; model
@@ -464,6 +465,80 @@ No authorization required
 [[Back to README]](../README.md)
 
 
+## FakePropertyEnumIntegerSerialize
+
+> OuterObjectWithEnumProperty FakePropertyEnumIntegerSerialize (OuterObjectWithEnumProperty outerObjectWithEnumProperty)
+
+
+
+Test serialization of enum (int) properties with examples
+
+### Example
+
+```csharp
+using System.Collections.Generic;
+using System.Diagnostics;
+using Org.OpenAPITools.Api;
+using Org.OpenAPITools.Client;
+using Org.OpenAPITools.Model;
+
+namespace Example
+{
+    public class FakePropertyEnumIntegerSerializeExample
+    {
+        public static void Main()
+        {
+            Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
+            var apiInstance = new FakeApi(Configuration.Default);
+            var outerObjectWithEnumProperty = new OuterObjectWithEnumProperty(); // OuterObjectWithEnumProperty | Input enum (int) as post body
+
+            try
+            {
+                OuterObjectWithEnumProperty result = apiInstance.FakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty);
+                Debug.WriteLine(result);
+            }
+            catch (ApiException e)
+            {
+                Debug.Print("Exception when calling FakeApi.FakePropertyEnumIntegerSerialize: " + e.Message );
+                Debug.Print("Status Code: "+ e.ErrorCode);
+                Debug.Print(e.StackTrace);
+            }
+        }
+    }
+}
+```
+
+### Parameters
+
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **outerObjectWithEnumProperty** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | 
+
+### Return type
+
+[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: application/json
+- **Accept**: */*
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+| **200** | Output enum (int) |  -  |
+
+[[Back to top]](#)
+[[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
+
 ## TestBodyWithFileSchema
 
 > void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass)
diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/OuterObjectWithEnumProperty.md b/samples/client/petstore/csharp/OpenAPIClient/docs/OuterObjectWithEnumProperty.md
new file mode 100644
index 0000000000000000000000000000000000000000..b97e65b97bea906f8d08cdb91f27f84f8b4089cb
--- /dev/null
+++ b/samples/client/petstore/csharp/OpenAPIClient/docs/OuterObjectWithEnumProperty.md
@@ -0,0 +1,13 @@
+
+# Org.OpenAPITools.Model.OuterObjectWithEnumProperty
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Value** | **OuterEnumInteger** |  | 
+
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to README]](../README.md)
+
diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OuterObjectWithEnumPropertyTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OuterObjectWithEnumPropertyTests.cs
new file mode 100644
index 0000000000000000000000000000000000000000..1c683cd900bf31793ad0f6483b651cd9edaeea87
--- /dev/null
+++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OuterObjectWithEnumPropertyTests.cs
@@ -0,0 +1,79 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * 
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+
+using NUnit.Framework;
+
+using System;
+using System.Linq;
+using System.IO;
+using System.Collections.Generic;
+using Org.OpenAPITools.Api;
+using Org.OpenAPITools.Model;
+using Org.OpenAPITools.Client;
+using System.Reflection;
+using Newtonsoft.Json;
+
+namespace Org.OpenAPITools.Test
+{
+    /// <summary>
+    ///  Class for testing OuterObjectWithEnumProperty
+    /// </summary>
+    /// <remarks>
+    /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
+    /// Please update the test case below to test the model.
+    /// </remarks>
+    public class OuterObjectWithEnumPropertyTests
+    {
+        // TODO uncomment below to declare an instance variable for OuterObjectWithEnumProperty
+        //private OuterObjectWithEnumProperty instance;
+
+        /// <summary>
+        /// Setup before each test
+        /// </summary>
+        [SetUp]
+        public void Init()
+        {
+            // TODO uncomment below to create an instance of OuterObjectWithEnumProperty
+            //instance = new OuterObjectWithEnumProperty();
+        }
+
+        /// <summary>
+        /// Clean up after each test
+        /// </summary>
+        [TearDown]
+        public void Cleanup()
+        {
+
+        }
+
+        /// <summary>
+        /// Test an instance of OuterObjectWithEnumProperty
+        /// </summary>
+        [Test]
+        public void OuterObjectWithEnumPropertyInstanceTest()
+        {
+            // TODO uncomment below to test "IsInstanceOf" OuterObjectWithEnumProperty
+            //Assert.IsInstanceOf(typeof(OuterObjectWithEnumProperty), instance);
+        }
+
+
+        /// <summary>
+        /// Test the property 'Value'
+        /// </summary>
+        [Test]
+        public void ValueTest()
+        {
+            // TODO unit test for the property 'Value'
+        }
+
+    }
+
+}
diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs
index a48c0d43bb30e4d744888c2523042993e4208509..6161aa33d32d9741b7496d63fd16cb78e110b418 100644
--- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs
+++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs
@@ -157,6 +157,27 @@ namespace Org.OpenAPITools.Api
         /// 
         /// </summary>
         /// <remarks>
+        /// Test serialization of enum (int) properties with examples
+        /// </remarks>
+        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
+        /// <param name="outerObjectWithEnumProperty">Input enum (int) as post body</param>
+        /// <returns>OuterObjectWithEnumProperty</returns>
+        OuterObjectWithEnumProperty FakePropertyEnumIntegerSerialize (OuterObjectWithEnumProperty outerObjectWithEnumProperty);
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <remarks>
+        /// Test serialization of enum (int) properties with examples
+        /// </remarks>
+        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
+        /// <param name="outerObjectWithEnumProperty">Input enum (int) as post body</param>
+        /// <returns>ApiResponse of OuterObjectWithEnumProperty</returns>
+        ApiResponse<OuterObjectWithEnumProperty> FakePropertyEnumIntegerSerializeWithHttpInfo (OuterObjectWithEnumProperty outerObjectWithEnumProperty);
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <remarks>
         /// For this test, the body for this request much reference a schema named &#x60;File&#x60;.
         /// </remarks>
         /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
@@ -550,6 +571,29 @@ namespace Org.OpenAPITools.Api
         /// 
         /// </summary>
         /// <remarks>
+        /// Test serialization of enum (int) properties with examples
+        /// </remarks>
+        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
+        /// <param name="outerObjectWithEnumProperty">Input enum (int) as post body</param>
+        /// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
+        /// <returns>Task of OuterObjectWithEnumProperty</returns>
+        System.Threading.Tasks.Task<OuterObjectWithEnumProperty> FakePropertyEnumIntegerSerializeAsync (OuterObjectWithEnumProperty outerObjectWithEnumProperty, CancellationToken cancellationToken = default(CancellationToken));
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <remarks>
+        /// Test serialization of enum (int) properties with examples
+        /// </remarks>
+        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
+        /// <param name="outerObjectWithEnumProperty">Input enum (int) as post body</param>
+        /// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
+        /// <returns>Task of ApiResponse (OuterObjectWithEnumProperty)</returns>
+        System.Threading.Tasks.Task<ApiResponse<OuterObjectWithEnumProperty>> FakePropertyEnumIntegerSerializeWithHttpInfoAsync (OuterObjectWithEnumProperty outerObjectWithEnumProperty, CancellationToken cancellationToken = default(CancellationToken));
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <remarks>
         /// For this test, the body for this request much reference a schema named &#x60;File&#x60;.
         /// </remarks>
         /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
@@ -1792,6 +1836,157 @@ namespace Org.OpenAPITools.Api
                 (string) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string)));
         }
 
+        /// <summary>
+        ///  Test serialization of enum (int) properties with examples
+        /// </summary>
+        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
+        /// <param name="outerObjectWithEnumProperty">Input enum (int) as post body</param>
+        /// <returns>OuterObjectWithEnumProperty</returns>
+        public OuterObjectWithEnumProperty FakePropertyEnumIntegerSerialize (OuterObjectWithEnumProperty outerObjectWithEnumProperty)
+        {
+             ApiResponse<OuterObjectWithEnumProperty> localVarResponse = FakePropertyEnumIntegerSerializeWithHttpInfo(outerObjectWithEnumProperty);
+             return localVarResponse.Data;
+        }
+
+        /// <summary>
+        ///  Test serialization of enum (int) properties with examples
+        /// </summary>
+        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
+        /// <param name="outerObjectWithEnumProperty">Input enum (int) as post body</param>
+        /// <returns>ApiResponse of OuterObjectWithEnumProperty</returns>
+        public ApiResponse<OuterObjectWithEnumProperty> FakePropertyEnumIntegerSerializeWithHttpInfo (OuterObjectWithEnumProperty outerObjectWithEnumProperty)
+        {
+            // verify the required parameter 'outerObjectWithEnumProperty' is set
+            if (outerObjectWithEnumProperty == null)
+                throw new ApiException(400, "Missing required parameter 'outerObjectWithEnumProperty' when calling FakeApi->FakePropertyEnumIntegerSerialize");
+
+            var localVarPath = "/fake/property/enum-int";
+            var localVarPathParams = new Dictionary<String, String>();
+            var localVarQueryParams = new List<KeyValuePair<String, String>>();
+            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
+            var localVarFormParams = new Dictionary<String, String>();
+            var localVarFileParams = new Dictionary<String, FileParameter>();
+            Object localVarPostBody = null;
+
+            // to determine the Content-Type header
+            String[] localVarHttpContentTypes = new String[] {
+                "application/json"
+            };
+            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
+
+            // to determine the Accept header
+            String[] localVarHttpHeaderAccepts = new String[] {
+                "*/*"
+            };
+            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
+            if (localVarHttpHeaderAccept != null)
+                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
+
+            if (outerObjectWithEnumProperty != null && outerObjectWithEnumProperty.GetType() != typeof(byte[]))
+            {
+                localVarPostBody = this.Configuration.ApiClient.Serialize(outerObjectWithEnumProperty); // http body (model) parameter
+            }
+            else
+            {
+                localVarPostBody = outerObjectWithEnumProperty; // byte array
+            }
+
+
+            // make the HTTP request
+            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
+                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
+                localVarPathParams, localVarHttpContentType);
+
+            int localVarStatusCode = (int) localVarResponse.StatusCode;
+
+            if (ExceptionFactory != null)
+            {
+                Exception exception = ExceptionFactory("FakePropertyEnumIntegerSerialize", localVarResponse);
+                if (exception != null) throw exception;
+            }
+
+            return new ApiResponse<OuterObjectWithEnumProperty>(localVarStatusCode,
+                localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
+                (OuterObjectWithEnumProperty) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterObjectWithEnumProperty)));
+        }
+
+        /// <summary>
+        ///  Test serialization of enum (int) properties with examples
+        /// </summary>
+        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
+        /// <param name="outerObjectWithEnumProperty">Input enum (int) as post body</param>
+        /// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
+        /// <returns>Task of OuterObjectWithEnumProperty</returns>
+        public async System.Threading.Tasks.Task<OuterObjectWithEnumProperty> FakePropertyEnumIntegerSerializeAsync (OuterObjectWithEnumProperty outerObjectWithEnumProperty, CancellationToken cancellationToken = default(CancellationToken))
+        {
+             ApiResponse<OuterObjectWithEnumProperty> localVarResponse = await FakePropertyEnumIntegerSerializeWithHttpInfoAsync(outerObjectWithEnumProperty, cancellationToken);
+             return localVarResponse.Data;
+
+        }
+
+        /// <summary>
+        ///  Test serialization of enum (int) properties with examples
+        /// </summary>
+        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
+        /// <param name="outerObjectWithEnumProperty">Input enum (int) as post body</param>
+        /// <param name="cancellationToken">Cancellation Token to cancel request (optional) </param>
+        /// <returns>Task of ApiResponse (OuterObjectWithEnumProperty)</returns>
+        public async System.Threading.Tasks.Task<ApiResponse<OuterObjectWithEnumProperty>> FakePropertyEnumIntegerSerializeWithHttpInfoAsync (OuterObjectWithEnumProperty outerObjectWithEnumProperty, CancellationToken cancellationToken = default(CancellationToken))
+        {
+            // verify the required parameter 'outerObjectWithEnumProperty' is set
+            if (outerObjectWithEnumProperty == null)
+                throw new ApiException(400, "Missing required parameter 'outerObjectWithEnumProperty' when calling FakeApi->FakePropertyEnumIntegerSerialize");
+
+            var localVarPath = "/fake/property/enum-int";
+            var localVarPathParams = new Dictionary<String, String>();
+            var localVarQueryParams = new List<KeyValuePair<String, String>>();
+            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
+            var localVarFormParams = new Dictionary<String, String>();
+            var localVarFileParams = new Dictionary<String, FileParameter>();
+            Object localVarPostBody = null;
+
+            // to determine the Content-Type header
+            String[] localVarHttpContentTypes = new String[] {
+                "application/json"
+            };
+            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
+
+            // to determine the Accept header
+            String[] localVarHttpHeaderAccepts = new String[] {
+                "*/*"
+            };
+            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
+            if (localVarHttpHeaderAccept != null)
+                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
+
+            if (outerObjectWithEnumProperty != null && outerObjectWithEnumProperty.GetType() != typeof(byte[]))
+            {
+                localVarPostBody = this.Configuration.ApiClient.Serialize(outerObjectWithEnumProperty); // http body (model) parameter
+            }
+            else
+            {
+                localVarPostBody = outerObjectWithEnumProperty; // byte array
+            }
+
+
+            // make the HTTP request
+            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
+                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
+                localVarPathParams, localVarHttpContentType, cancellationToken);
+
+            int localVarStatusCode = (int) localVarResponse.StatusCode;
+
+            if (ExceptionFactory != null)
+            {
+                Exception exception = ExceptionFactory("FakePropertyEnumIntegerSerialize", localVarResponse);
+                if (exception != null) throw exception;
+            }
+
+            return new ApiResponse<OuterObjectWithEnumProperty>(localVarStatusCode,
+                localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
+                (OuterObjectWithEnumProperty) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterObjectWithEnumProperty)));
+        }
+
         /// <summary>
         ///  For this test, the body for this request much reference a schema named &#x60;File&#x60;.
         /// </summary>
diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/OuterObjectWithEnumProperty.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/OuterObjectWithEnumProperty.cs
new file mode 100644
index 0000000000000000000000000000000000000000..a7db86a7ba2437646c29c4b888cbe7cbf5edb1de
--- /dev/null
+++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/OuterObjectWithEnumProperty.cs
@@ -0,0 +1,138 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * 
+ * Generated by: https://github.com/openapitools/openapi-generator.git
+ */
+
+using System;
+using System.Linq;
+using System.IO;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Runtime.Serialization;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+using System.ComponentModel.DataAnnotations;
+using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter;
+
+namespace Org.OpenAPITools.Model
+{
+    /// <summary>
+    /// OuterObjectWithEnumProperty
+    /// </summary>
+    [DataContract]
+    public partial class OuterObjectWithEnumProperty :  IEquatable<OuterObjectWithEnumProperty>, IValidatableObject
+    {
+        /// <summary>
+        /// Gets or Sets Value
+        /// </summary>
+        [DataMember(Name="value", EmitDefaultValue=true)]
+        public OuterEnumInteger Value { get; set; }
+        /// <summary>
+        /// Initializes a new instance of the <see cref="OuterObjectWithEnumProperty" /> class.
+        /// </summary>
+        [JsonConstructorAttribute]
+        protected OuterObjectWithEnumProperty() { }
+        /// <summary>
+        /// Initializes a new instance of the <see cref="OuterObjectWithEnumProperty" /> class.
+        /// </summary>
+        /// <param name="value">value (required).</param>
+        public OuterObjectWithEnumProperty(OuterEnumInteger value = default(OuterEnumInteger))
+        {
+            // to ensure "value" is required (not null)
+            if (value == null)
+            {
+                throw new InvalidDataException("value is a required property for OuterObjectWithEnumProperty and cannot be null");
+            }
+            else
+            {
+                this.Value = value;
+            }
+
+        }
+
+
+        /// <summary>
+        /// Returns the string presentation of the object
+        /// </summary>
+        /// <returns>String presentation of the object</returns>
+        public override string ToString()
+        {
+            var sb = new StringBuilder();
+            sb.Append("class OuterObjectWithEnumProperty {\n");
+            sb.Append("  Value: ").Append(Value).Append("\n");
+            sb.Append("}\n");
+            return sb.ToString();
+        }
+
+        /// <summary>
+        /// Returns the JSON string presentation of the object
+        /// </summary>
+        /// <returns>JSON string presentation of the object</returns>
+        public virtual string ToJson()
+        {
+            return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
+        }
+
+        /// <summary>
+        /// Returns true if objects are equal
+        /// </summary>
+        /// <param name="input">Object to be compared</param>
+        /// <returns>Boolean</returns>
+        public override bool Equals(object input)
+        {
+            return this.Equals(input as OuterObjectWithEnumProperty);
+        }
+
+        /// <summary>
+        /// Returns true if OuterObjectWithEnumProperty instances are equal
+        /// </summary>
+        /// <param name="input">Instance of OuterObjectWithEnumProperty to be compared</param>
+        /// <returns>Boolean</returns>
+        public bool Equals(OuterObjectWithEnumProperty input)
+        {
+            if (input == null)
+                return false;
+
+            return 
+                (
+                    this.Value == input.Value ||
+                    (this.Value != null &&
+                    this.Value.Equals(input.Value))
+                );
+        }
+
+        /// <summary>
+        /// Gets the hash code
+        /// </summary>
+        /// <returns>Hash code</returns>
+        public override int GetHashCode()
+        {
+            unchecked // Overflow is fine, just wrap
+            {
+                int hashCode = 41;
+                if (this.Value != null)
+                    hashCode = hashCode * 59 + this.Value.GetHashCode();
+                return hashCode;
+            }
+        }
+
+        /// <summary>
+        /// To validate all properties of the instance
+        /// </summary>
+        /// <param name="validationContext">Validation context</param>
+        /// <returns>Validation Result</returns>
+        IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
+        {
+            yield break;
+        }
+    }
+
+}
diff --git a/samples/client/petstore/elixir/.openapi-generator/FILES b/samples/client/petstore/elixir/.openapi-generator/FILES
index a7de9eecd584d08a7ba30d2a5e64d077c638e3bc..cbdb6e35ee98ed808f6ca4430874adfd161cf9b2 100644
--- a/samples/client/petstore/elixir/.openapi-generator/FILES
+++ b/samples/client/petstore/elixir/.openapi-generator/FILES
@@ -48,6 +48,7 @@ lib/openapi_petstore/model/outer_enum.ex
 lib/openapi_petstore/model/outer_enum_default_value.ex
 lib/openapi_petstore/model/outer_enum_integer.ex
 lib/openapi_petstore/model/outer_enum_integer_default_value.ex
+lib/openapi_petstore/model/outer_object_with_enum_property.ex
 lib/openapi_petstore/model/pet.ex
 lib/openapi_petstore/model/read_only_first.ex
 lib/openapi_petstore/model/return.ex
diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex b/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex
index b0f0c05e573de3cdb9d8fa48f0b7fe728460f006..7d05057b3a62f0468de5e57ec0624695003bde6c 100644
--- a/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex
+++ b/samples/client/petstore/elixir/lib/openapi_petstore/api/fake.ex
@@ -188,6 +188,32 @@ defmodule OpenapiPetstore.Api.Fake do
     ])
   end
 
+  @doc """
+  Test serialization of enum (int) properties with examples
+
+  ## Parameters
+
+  - connection (OpenapiPetstore.Connection): Connection to server
+  - outer_object_with_enum_property (OuterObjectWithEnumProperty): Input enum (int) as post body
+  - opts (KeywordList): [optional] Optional parameters
+  ## Returns
+
+  {:ok, OpenapiPetstore.Model.OuterObjectWithEnumProperty.t} on success
+  {:error, Tesla.Env.t} on failure
+  """
+  @spec fake_property_enum_integer_serialize(Tesla.Env.client, OpenapiPetstore.Model.OuterObjectWithEnumProperty.t, keyword()) :: {:ok, OpenapiPetstore.Model.OuterObjectWithEnumProperty.t} | {:error, Tesla.Env.t}
+  def fake_property_enum_integer_serialize(connection, outer_object_with_enum_property, _opts \\ []) do
+    %{}
+    |> method(:post)
+    |> url("/fake/property/enum-int")
+    |> add_param(:body, :body, outer_object_with_enum_property)
+    |> Enum.into([])
+    |> (&Connection.request(connection, &1)).()
+    |> evaluate_response([
+      { 200, %OpenapiPetstore.Model.OuterObjectWithEnumProperty{}}
+    ])
+  end
+
   @doc """
   For this test, the body for this request much reference a schema named `File`.
 
diff --git a/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_object_with_enum_property.ex b/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_object_with_enum_property.ex
new file mode 100644
index 0000000000000000000000000000000000000000..2eed9a6dfa4c826a6dd99f2ecd0fa549caf7a944
--- /dev/null
+++ b/samples/client/petstore/elixir/lib/openapi_petstore/model/outer_object_with_enum_property.ex
@@ -0,0 +1,27 @@
+# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+# https://openapi-generator.tech
+# Do not edit the class manually.
+
+defmodule OpenapiPetstore.Model.OuterObjectWithEnumProperty do
+  @moduledoc """
+  
+  """
+
+  @derive [Poison.Encoder]
+  defstruct [
+    :"value"
+  ]
+
+  @type t :: %__MODULE__{
+    :"value" => OpenapiPetstore.Model.OuterEnumInteger.t
+  }
+end
+
+defimpl Poison.Decoder, for: OpenapiPetstore.Model.OuterObjectWithEnumProperty do
+  import OpenapiPetstore.Deserializer
+  def decode(value, options) do
+    value
+    |> deserialize(:"value", :struct, OpenapiPetstore.Model.OuterEnumInteger, options)
+  end
+end
+
diff --git a/samples/client/petstore/groovy/bin/main/org/openapitools/api/ApiUtils.groovy b/samples/client/petstore/groovy/bin/main/org/openapitools/api/ApiUtils.groovy
new file mode 100644
index 0000000000000000000000000000000000000000..c1fe94b1027ce8cff0bac2be325ce361323ef7d2
--- /dev/null
+++ b/samples/client/petstore/groovy/bin/main/org/openapitools/api/ApiUtils.groovy
@@ -0,0 +1,54 @@
+package org.openapitools.api
+
+import static groovyx.net.http.HttpBuilder.configure
+import static java.net.URI.create
+
+class ApiUtils {
+
+    void invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType, method, container, type)  {
+        def (url, uriPath) = buildUrlAndUriPath(basePath, versionPath, resourcePath)
+        println "url=$url uriPath=$uriPath"
+        def http = configure {
+            request.uri = url
+            request.uri.path = uriPath
+        }
+        .invokeMethod(String.valueOf(method).toLowerCase()) {
+            request.uri.query = queryParams
+            request.headers = headerParams
+            if (bodyParams != null) {
+                request.body = bodyParams
+            }
+            request.contentType = contentType
+
+            response.success { resp, json ->
+                if (type != null) {
+                    onSuccess(parse(json, container, type))
+                }
+            }
+            response.failure { resp ->
+                onFailure(resp.statusCode, resp.message)
+            }
+        }
+
+    }
+
+    private static def buildUrlAndUriPath(basePath, versionPath, resourcePath) {
+        // HTTPBuilder expects to get as its constructor parameter an URL,
+        // without any other additions like path, therefore we need to cut the path
+        // from the basePath as it is represented by swagger APIs
+        // we use java.net.URI to manipulate the basePath
+        // then the uriPath will hold the rest of the path
+        URI baseUri =  create(basePath)
+        def pathOnly = baseUri.getPath()
+        [basePath-pathOnly, pathOnly+versionPath+resourcePath]
+    }
+
+    private def parse(object, container, clazz) {
+        if (container == "array") {
+            return object.collect {parse(it, "", clazz)}
+        }   else {
+            return clazz.newInstance(object)
+        }
+    }
+
+}
diff --git a/samples/client/petstore/groovy/bin/main/org/openapitools/api/PetApi.groovy b/samples/client/petstore/groovy/bin/main/org/openapitools/api/PetApi.groovy
new file mode 100644
index 0000000000000000000000000000000000000000..d448cfd544eaea504497940e5eef332fb4e43fb3
--- /dev/null
+++ b/samples/client/petstore/groovy/bin/main/org/openapitools/api/PetApi.groovy
@@ -0,0 +1,225 @@
+package org.openapitools.api;
+
+import org.openapitools.api.ApiUtils
+import org.openapitools.model.ModelApiResponse
+import org.openapitools.model.Pet
+
+class PetApi {
+    String basePath = "http://petstore.swagger.io/v2"
+    String versionPath = ""
+    ApiUtils apiUtils = new ApiUtils();
+
+    def addPet ( Pet pet, Closure onSuccess, Closure onFailure)  {
+        String resourcePath = "/pet"
+
+        // params
+        def queryParams = [:]
+        def headerParams = [:]
+        def bodyParams
+        def contentType
+
+        // verify required params are set
+        if (pet == null) {
+            throw new RuntimeException("missing required params pet")
+        }
+
+
+
+        contentType = 'application/json';
+        bodyParams = pet
+
+
+        apiUtils.invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType,
+                    "POST", "",
+                    Pet.class )
+
+    }
+
+    def deletePet ( Long petId, String apiKey, Closure onSuccess, Closure onFailure)  {
+        String resourcePath = "/pet/${petId}"
+
+        // params
+        def queryParams = [:]
+        def headerParams = [:]
+        def bodyParams
+        def contentType
+
+        // verify required params are set
+        if (petId == null) {
+            throw new RuntimeException("missing required params petId")
+        }
+
+
+        if (apiKey != null) {
+            headerParams.put("api_key", apiKey)
+        }
+
+
+
+        apiUtils.invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType,
+                    "DELETE", "",
+                    null )
+
+    }
+
+    def findPetsByStatus ( List<String> status, Closure onSuccess, Closure onFailure)  {
+        String resourcePath = "/pet/findByStatus"
+
+        // params
+        def queryParams = [:]
+        def headerParams = [:]
+        def bodyParams
+        def contentType
+
+        // verify required params are set
+        if (status == null) {
+            throw new RuntimeException("missing required params status")
+        }
+
+        if (status != null) {
+            queryParams.put("status", status)
+        }
+
+
+
+
+        apiUtils.invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType,
+                    "GET", "array",
+                    Pet.class )
+
+    }
+
+    def findPetsByTags ( List<String> tags, Closure onSuccess, Closure onFailure)  {
+        String resourcePath = "/pet/findByTags"
+
+        // params
+        def queryParams = [:]
+        def headerParams = [:]
+        def bodyParams
+        def contentType
+
+        // verify required params are set
+        if (tags == null) {
+            throw new RuntimeException("missing required params tags")
+        }
+
+        if (tags != null) {
+            queryParams.put("tags", tags)
+        }
+
+
+
+
+        apiUtils.invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType,
+                    "GET", "array",
+                    Pet.class )
+
+    }
+
+    def getPetById ( Long petId, Closure onSuccess, Closure onFailure)  {
+        String resourcePath = "/pet/${petId}"
+
+        // params
+        def queryParams = [:]
+        def headerParams = [:]
+        def bodyParams
+        def contentType
+
+        // verify required params are set
+        if (petId == null) {
+            throw new RuntimeException("missing required params petId")
+        }
+
+
+
+
+
+        apiUtils.invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType,
+                    "GET", "",
+                    Pet.class )
+
+    }
+
+    def updatePet ( Pet pet, Closure onSuccess, Closure onFailure)  {
+        String resourcePath = "/pet"
+
+        // params
+        def queryParams = [:]
+        def headerParams = [:]
+        def bodyParams
+        def contentType
+
+        // verify required params are set
+        if (pet == null) {
+            throw new RuntimeException("missing required params pet")
+        }
+
+
+
+        contentType = 'application/json';
+        bodyParams = pet
+
+
+        apiUtils.invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType,
+                    "PUT", "",
+                    Pet.class )
+
+    }
+
+    def updatePetWithForm ( Long petId, String name, String status, Closure onSuccess, Closure onFailure)  {
+        String resourcePath = "/pet/${petId}"
+
+        // params
+        def queryParams = [:]
+        def headerParams = [:]
+        def bodyParams
+        def contentType
+
+        // verify required params are set
+        if (petId == null) {
+            throw new RuntimeException("missing required params petId")
+        }
+
+
+
+
+        contentType = 'application/x-www-form-urlencoded';
+        bodyParams = [:]
+        bodyParams.put("name", name)
+        bodyParams.put("status", status)
+
+        apiUtils.invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType,
+                    "POST", "",
+                    null )
+
+    }
+
+    def uploadFile ( Long petId, String additionalMetadata, File file, Closure onSuccess, Closure onFailure)  {
+        String resourcePath = "/pet/${petId}/uploadImage"
+
+        // params
+        def queryParams = [:]
+        def headerParams = [:]
+        def bodyParams
+        def contentType
+
+        // verify required params are set
+        if (petId == null) {
+            throw new RuntimeException("missing required params petId")
+        }
+
+
+
+
+        contentType = 'multipart/form-data';
+        bodyParams = [:]
+        bodyParams.put("additionalMetadata", additionalMetadata)
+        bodyParams.put("file", file)
+
+        apiUtils.invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType,
+                    "POST", "",
+                    ModelApiResponse.class )
+
+    }
+
+}
diff --git a/samples/client/petstore/groovy/bin/main/org/openapitools/api/StoreApi.groovy b/samples/client/petstore/groovy/bin/main/org/openapitools/api/StoreApi.groovy
new file mode 100644
index 0000000000000000000000000000000000000000..319a6ddcaf88e3cc6ee52cc0a77dbae22914ddd0
--- /dev/null
+++ b/samples/client/petstore/groovy/bin/main/org/openapitools/api/StoreApi.groovy
@@ -0,0 +1,105 @@
+package org.openapitools.api;
+
+import org.openapitools.api.ApiUtils
+import org.openapitools.model.Order
+
+class StoreApi {
+    String basePath = "http://petstore.swagger.io/v2"
+    String versionPath = ""
+    ApiUtils apiUtils = new ApiUtils();
+
+    def deleteOrder ( String orderId, Closure onSuccess, Closure onFailure)  {
+        String resourcePath = "/store/order/${orderId}"
+
+        // params
+        def queryParams = [:]
+        def headerParams = [:]
+        def bodyParams
+        def contentType
+
+        // verify required params are set
+        if (orderId == null) {
+            throw new RuntimeException("missing required params orderId")
+        }
+
+
+
+
+
+        apiUtils.invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType,
+                    "DELETE", "",
+                    null )
+
+    }
+
+    def getInventory ( Closure onSuccess, Closure onFailure)  {
+        String resourcePath = "/store/inventory"
+
+        // params
+        def queryParams = [:]
+        def headerParams = [:]
+        def bodyParams
+        def contentType
+
+
+
+
+
+
+        apiUtils.invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType,
+                    "GET", "map",
+                    Integer.class )
+
+    }
+
+    def getOrderById ( Long orderId, Closure onSuccess, Closure onFailure)  {
+        String resourcePath = "/store/order/${orderId}"
+
+        // params
+        def queryParams = [:]
+        def headerParams = [:]
+        def bodyParams
+        def contentType
+
+        // verify required params are set
+        if (orderId == null) {
+            throw new RuntimeException("missing required params orderId")
+        }
+
+
+
+
+
+        apiUtils.invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType,
+                    "GET", "",
+                    Order.class )
+
+    }
+
+    def placeOrder ( Order order, Closure onSuccess, Closure onFailure)  {
+        String resourcePath = "/store/order"
+
+        // params
+        def queryParams = [:]
+        def headerParams = [:]
+        def bodyParams
+        def contentType
+
+        // verify required params are set
+        if (order == null) {
+            throw new RuntimeException("missing required params order")
+        }
+
+
+
+        contentType = 'application/json';
+        bodyParams = order
+
+
+        apiUtils.invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType,
+                    "POST", "",
+                    Order.class )
+
+    }
+
+}
diff --git a/samples/client/petstore/groovy/bin/main/org/openapitools/api/UserApi.groovy b/samples/client/petstore/groovy/bin/main/org/openapitools/api/UserApi.groovy
new file mode 100644
index 0000000000000000000000000000000000000000..82be73e27bcb675e3b2c8ae29a8411b23cfdc0fc
--- /dev/null
+++ b/samples/client/petstore/groovy/bin/main/org/openapitools/api/UserApi.groovy
@@ -0,0 +1,222 @@
+package org.openapitools.api;
+
+import org.openapitools.api.ApiUtils
+import java.util.List
+import org.openapitools.model.User
+
+class UserApi {
+    String basePath = "http://petstore.swagger.io/v2"
+    String versionPath = ""
+    ApiUtils apiUtils = new ApiUtils();
+
+    def createUser ( User user, Closure onSuccess, Closure onFailure)  {
+        String resourcePath = "/user"
+
+        // params
+        def queryParams = [:]
+        def headerParams = [:]
+        def bodyParams
+        def contentType
+
+        // verify required params are set
+        if (user == null) {
+            throw new RuntimeException("missing required params user")
+        }
+
+
+
+        contentType = 'application/json';
+        bodyParams = user
+
+
+        apiUtils.invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType,
+                    "POST", "",
+                    null )
+
+    }
+
+    def createUsersWithArrayInput ( List<User> user, Closure onSuccess, Closure onFailure)  {
+        String resourcePath = "/user/createWithArray"
+
+        // params
+        def queryParams = [:]
+        def headerParams = [:]
+        def bodyParams
+        def contentType
+
+        // verify required params are set
+        if (user == null) {
+            throw new RuntimeException("missing required params user")
+        }
+
+
+
+        contentType = 'application/json';
+        bodyParams = user
+
+
+        apiUtils.invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType,
+                    "POST", "",
+                    null )
+
+    }
+
+    def createUsersWithListInput ( List<User> user, Closure onSuccess, Closure onFailure)  {
+        String resourcePath = "/user/createWithList"
+
+        // params
+        def queryParams = [:]
+        def headerParams = [:]
+        def bodyParams
+        def contentType
+
+        // verify required params are set
+        if (user == null) {
+            throw new RuntimeException("missing required params user")
+        }
+
+
+
+        contentType = 'application/json';
+        bodyParams = user
+
+
+        apiUtils.invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType,
+                    "POST", "",
+                    null )
+
+    }
+
+    def deleteUser ( String username, Closure onSuccess, Closure onFailure)  {
+        String resourcePath = "/user/${username}"
+
+        // params
+        def queryParams = [:]
+        def headerParams = [:]
+        def bodyParams
+        def contentType
+
+        // verify required params are set
+        if (username == null) {
+            throw new RuntimeException("missing required params username")
+        }
+
+
+
+
+
+        apiUtils.invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType,
+                    "DELETE", "",
+                    null )
+
+    }
+
+    def getUserByName ( String username, Closure onSuccess, Closure onFailure)  {
+        String resourcePath = "/user/${username}"
+
+        // params
+        def queryParams = [:]
+        def headerParams = [:]
+        def bodyParams
+        def contentType
+
+        // verify required params are set
+        if (username == null) {
+            throw new RuntimeException("missing required params username")
+        }
+
+
+
+
+
+        apiUtils.invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType,
+                    "GET", "",
+                    User.class )
+
+    }
+
+    def loginUser ( String username, String password, Closure onSuccess, Closure onFailure)  {
+        String resourcePath = "/user/login"
+
+        // params
+        def queryParams = [:]
+        def headerParams = [:]
+        def bodyParams
+        def contentType
+
+        // verify required params are set
+        if (username == null) {
+            throw new RuntimeException("missing required params username")
+        }
+        // verify required params are set
+        if (password == null) {
+            throw new RuntimeException("missing required params password")
+        }
+
+        if (username != null) {
+            queryParams.put("username", username)
+        }
+        if (password != null) {
+            queryParams.put("password", password)
+        }
+
+
+
+
+        apiUtils.invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType,
+                    "GET", "",
+                    String.class )
+
+    }
+
+    def logoutUser ( Closure onSuccess, Closure onFailure)  {
+        String resourcePath = "/user/logout"
+
+        // params
+        def queryParams = [:]
+        def headerParams = [:]
+        def bodyParams
+        def contentType
+
+
+
+
+
+
+        apiUtils.invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType,
+                    "GET", "",
+                    null )
+
+    }
+
+    def updateUser ( String username, User user, Closure onSuccess, Closure onFailure)  {
+        String resourcePath = "/user/${username}"
+
+        // params
+        def queryParams = [:]
+        def headerParams = [:]
+        def bodyParams
+        def contentType
+
+        // verify required params are set
+        if (username == null) {
+            throw new RuntimeException("missing required params username")
+        }
+        // verify required params are set
+        if (user == null) {
+            throw new RuntimeException("missing required params user")
+        }
+
+
+
+        contentType = 'application/json';
+        bodyParams = user
+
+
+        apiUtils.invokeApi(onSuccess, onFailure, basePath, versionPath, resourcePath, queryParams, headerParams, bodyParams, contentType,
+                    "PUT", "",
+                    null )
+
+    }
+
+}
diff --git a/samples/client/petstore/groovy/bin/main/org/openapitools/model/Category.groovy b/samples/client/petstore/groovy/bin/main/org/openapitools/model/Category.groovy
new file mode 100644
index 0000000000000000000000000000000000000000..d8ccf48a82aa1a8373579c52b9885eac6c82e541
--- /dev/null
+++ b/samples/client/petstore/groovy/bin/main/org/openapitools/model/Category.groovy
@@ -0,0 +1,13 @@
+package org.openapitools.model;
+
+import groovy.transform.Canonical
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@Canonical
+class Category {
+    
+    Long id
+    
+    String name
+}
diff --git a/samples/client/petstore/groovy/bin/main/org/openapitools/model/ModelApiResponse.groovy b/samples/client/petstore/groovy/bin/main/org/openapitools/model/ModelApiResponse.groovy
new file mode 100644
index 0000000000000000000000000000000000000000..468841ffff37571a63a3c24e7205d5a932968d8b
--- /dev/null
+++ b/samples/client/petstore/groovy/bin/main/org/openapitools/model/ModelApiResponse.groovy
@@ -0,0 +1,15 @@
+package org.openapitools.model;
+
+import groovy.transform.Canonical
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@Canonical
+class ModelApiResponse {
+    
+    Integer code
+    
+    String type
+    
+    String message
+}
diff --git a/samples/client/petstore/groovy/bin/main/org/openapitools/model/Order.groovy b/samples/client/petstore/groovy/bin/main/org/openapitools/model/Order.groovy
new file mode 100644
index 0000000000000000000000000000000000000000..d9e02f8a6cc889849bd2541ea73d21fa4da0022d
--- /dev/null
+++ b/samples/client/petstore/groovy/bin/main/org/openapitools/model/Order.groovy
@@ -0,0 +1,21 @@
+package org.openapitools.model;
+
+import groovy.transform.Canonical
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@Canonical
+class Order {
+    
+    Long id
+    
+    Long petId
+    
+    Integer quantity
+    
+    Date shipDate
+    /* Order Status */
+    String status
+    
+    Boolean complete = false
+}
diff --git a/samples/client/petstore/groovy/bin/main/org/openapitools/model/Pet.groovy b/samples/client/petstore/groovy/bin/main/org/openapitools/model/Pet.groovy
new file mode 100644
index 0000000000000000000000000000000000000000..630c015aaa4ea9bc7d478af653d2e74c2dbd3c05
--- /dev/null
+++ b/samples/client/petstore/groovy/bin/main/org/openapitools/model/Pet.groovy
@@ -0,0 +1,25 @@
+package org.openapitools.model;
+
+import groovy.transform.Canonical
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.util.ArrayList;
+import java.util.List;
+import org.openapitools.model.Category;
+import org.openapitools.model.Tag;
+
+@Canonical
+class Pet {
+    
+    Long id
+    
+    Category category
+    
+    String name
+    
+    List<String> photoUrls = new ArrayList<String>()
+    
+    List<Tag> tags = new ArrayList<Tag>()
+    /* pet status in the store */
+    String status
+}
diff --git a/samples/client/petstore/groovy/bin/main/org/openapitools/model/Tag.groovy b/samples/client/petstore/groovy/bin/main/org/openapitools/model/Tag.groovy
new file mode 100644
index 0000000000000000000000000000000000000000..a704bc5ffef0e2ca38792933d2cde1f70df8a67f
--- /dev/null
+++ b/samples/client/petstore/groovy/bin/main/org/openapitools/model/Tag.groovy
@@ -0,0 +1,13 @@
+package org.openapitools.model;
+
+import groovy.transform.Canonical
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@Canonical
+class Tag {
+    
+    Long id
+    
+    String name
+}
diff --git a/samples/client/petstore/groovy/bin/main/org/openapitools/model/User.groovy b/samples/client/petstore/groovy/bin/main/org/openapitools/model/User.groovy
new file mode 100644
index 0000000000000000000000000000000000000000..a6f850e8754330ef99005579016258794f75ba09
--- /dev/null
+++ b/samples/client/petstore/groovy/bin/main/org/openapitools/model/User.groovy
@@ -0,0 +1,25 @@
+package org.openapitools.model;
+
+import groovy.transform.Canonical
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@Canonical
+class User {
+    
+    Long id
+    
+    String username
+    
+    String firstName
+    
+    String lastName
+    
+    String email
+    
+    String password
+    
+    String phone
+    /* User Status */
+    Integer userStatus
+}
diff --git a/samples/client/petstore/javascript-es6/.openapi-generator/FILES b/samples/client/petstore/javascript-es6/.openapi-generator/FILES
index 85edf0d171731cd6ef81de4d9eae99c2213c562b..4e51f824bd2befd758901fc2148feb2735690c33 100644
--- a/samples/client/petstore/javascript-es6/.openapi-generator/FILES
+++ b/samples/client/petstore/javascript-es6/.openapi-generator/FILES
@@ -44,6 +44,7 @@ docs/OuterEnum.md
 docs/OuterEnumDefaultValue.md
 docs/OuterEnumInteger.md
 docs/OuterEnumIntegerDefaultValue.md
+docs/OuterObjectWithEnumProperty.md
 docs/Pet.md
 docs/PetApi.md
 docs/ReadOnlyFirst.md
@@ -102,8 +103,10 @@ src/model/OuterEnum.js
 src/model/OuterEnumDefaultValue.js
 src/model/OuterEnumInteger.js
 src/model/OuterEnumIntegerDefaultValue.js
+src/model/OuterObjectWithEnumProperty.js
 src/model/Pet.js
 src/model/ReadOnlyFirst.js
 src/model/SpecialModelName.js
 src/model/Tag.js
 src/model/User.js
+test/model/OuterObjectWithEnumProperty.spec.js
diff --git a/samples/client/petstore/javascript-es6/README.md b/samples/client/petstore/javascript-es6/README.md
index 3855805f70f12d5c0187d304924668323bf1040d..8a7692d62c6fb14a635142d9c220b1313a0ed283 100644
--- a/samples/client/petstore/javascript-es6/README.md
+++ b/samples/client/petstore/javascript-es6/README.md
@@ -128,6 +128,7 @@ Class | Method | HTTP request | Description
 *OpenApiPetstore.FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | 
 *OpenApiPetstore.FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | 
 *OpenApiPetstore.FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | 
+*OpenApiPetstore.FakeApi* | [**fakePropertyEnumIntegerSerialize**](docs/FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | 
 *OpenApiPetstore.FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | 
 *OpenApiPetstore.FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | 
 *OpenApiPetstore.FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model
@@ -201,6 +202,7 @@ Class | Method | HTTP request | Description
  - [OpenApiPetstore.OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md)
  - [OpenApiPetstore.OuterEnumInteger](docs/OuterEnumInteger.md)
  - [OpenApiPetstore.OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
+ - [OpenApiPetstore.OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md)
  - [OpenApiPetstore.Pet](docs/Pet.md)
  - [OpenApiPetstore.ReadOnlyFirst](docs/ReadOnlyFirst.md)
  - [OpenApiPetstore.SpecialModelName](docs/SpecialModelName.md)
diff --git a/samples/client/petstore/javascript-es6/docs/FakeApi.md b/samples/client/petstore/javascript-es6/docs/FakeApi.md
index 23f6e3456ba6bacbadba09e28fe60b4fce9db8bd..6c95603b146a437a23930f8229d83ecd68c4ac68 100644
--- a/samples/client/petstore/javascript-es6/docs/FakeApi.md
+++ b/samples/client/petstore/javascript-es6/docs/FakeApi.md
@@ -10,6 +10,7 @@ Method | HTTP request | Description
 [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | 
 [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | 
 [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | 
+[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | 
 [**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | 
 [**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | 
 [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model
@@ -299,6 +300,51 @@ No authorization required
 - **Accept**: */*
 
 
+## fakePropertyEnumIntegerSerialize
+
+> OuterObjectWithEnumProperty fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty)
+
+
+
+Test serialization of enum (int) properties with examples
+
+### Example
+
+```javascript
+import OpenApiPetstore from 'open_api_petstore';
+
+let apiInstance = new OpenApiPetstore.FakeApi();
+let outerObjectWithEnumProperty = new OpenApiPetstore.OuterObjectWithEnumProperty(); // OuterObjectWithEnumProperty | Input enum (int) as post body
+apiInstance.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty, (error, data, response) => {
+  if (error) {
+    console.error(error);
+  } else {
+    console.log('API called successfully. Returned data: ' + data);
+  }
+});
+```
+
+### Parameters
+
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **outerObjectWithEnumProperty** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | 
+
+### Return type
+
+[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: application/json
+- **Accept**: */*
+
+
 ## testBodyWithFileSchema
 
 > testBodyWithFileSchema(fileSchemaTestClass)
diff --git a/samples/client/petstore/javascript-es6/docs/OuterObjectWithEnumProperty.md b/samples/client/petstore/javascript-es6/docs/OuterObjectWithEnumProperty.md
new file mode 100644
index 0000000000000000000000000000000000000000..a16331e63a6f89e8fdd1455fbc789503a9488fa3
--- /dev/null
+++ b/samples/client/petstore/javascript-es6/docs/OuterObjectWithEnumProperty.md
@@ -0,0 +1,9 @@
+# OpenApiPetstore.OuterObjectWithEnumProperty
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**value** | [**OuterEnumInteger**](OuterEnumInteger.md) |  | 
+
+
diff --git a/samples/client/petstore/javascript-es6/src/api/FakeApi.js b/samples/client/petstore/javascript-es6/src/api/FakeApi.js
index bfb8488e1bdb2466dcee2cb5bfd2a6150ff0b743..918fbdb03cc5ba65a599eb1263364ff14957e494 100644
--- a/samples/client/petstore/javascript-es6/src/api/FakeApi.js
+++ b/samples/client/petstore/javascript-es6/src/api/FakeApi.js
@@ -17,6 +17,7 @@ import Client from '../model/Client';
 import FileSchemaTestClass from '../model/FileSchemaTestClass';
 import HealthCheckResult from '../model/HealthCheckResult';
 import OuterComposite from '../model/OuterComposite';
+import OuterObjectWithEnumProperty from '../model/OuterObjectWithEnumProperty';
 import Pet from '../model/Pet';
 import User from '../model/User';
 
@@ -277,6 +278,47 @@ export default class FakeApi {
       );
     }
 
+    /**
+     * Callback function to receive the result of the fakePropertyEnumIntegerSerialize operation.
+     * @callback module:api/FakeApi~fakePropertyEnumIntegerSerializeCallback
+     * @param {String} error Error message, if any.
+     * @param {module:model/OuterObjectWithEnumProperty} data The data returned by the service call.
+     * @param {String} response The complete HTTP response.
+     */
+
+    /**
+     * Test serialization of enum (int) properties with examples
+     * @param {module:model/OuterObjectWithEnumProperty} outerObjectWithEnumProperty Input enum (int) as post body
+     * @param {module:api/FakeApi~fakePropertyEnumIntegerSerializeCallback} callback The callback function, accepting three arguments: error, data, response
+     * data is of type: {@link module:model/OuterObjectWithEnumProperty}
+     */
+    fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty, callback) {
+      let postBody = outerObjectWithEnumProperty;
+      // verify the required parameter 'outerObjectWithEnumProperty' is set
+      if (outerObjectWithEnumProperty === undefined || outerObjectWithEnumProperty === null) {
+        throw new Error("Missing the required parameter 'outerObjectWithEnumProperty' when calling fakePropertyEnumIntegerSerialize");
+      }
+
+      let pathParams = {
+      };
+      let queryParams = {
+      };
+      let headerParams = {
+      };
+      let formParams = {
+      };
+
+      let authNames = [];
+      let contentTypes = ['application/json'];
+      let accepts = ['*/*'];
+      let returnType = OuterObjectWithEnumProperty;
+      return this.apiClient.callApi(
+        '/fake/property/enum-int', 'POST',
+        pathParams, queryParams, headerParams, formParams, postBody,
+        authNames, contentTypes, accepts, returnType, null, callback
+      );
+    }
+
     /**
      * Callback function to receive the result of the testBodyWithFileSchema operation.
      * @callback module:api/FakeApi~testBodyWithFileSchemaCallback
diff --git a/samples/client/petstore/javascript-es6/src/index.js b/samples/client/petstore/javascript-es6/src/index.js
index 33321542c648be945807bed0f4ea816e10f96891..81125db48aca966c4ea1451b3fe9ef883a7689e6 100644
--- a/samples/client/petstore/javascript-es6/src/index.js
+++ b/samples/client/petstore/javascript-es6/src/index.js
@@ -51,6 +51,7 @@ import OuterEnum from './model/OuterEnum';
 import OuterEnumDefaultValue from './model/OuterEnumDefaultValue';
 import OuterEnumInteger from './model/OuterEnumInteger';
 import OuterEnumIntegerDefaultValue from './model/OuterEnumIntegerDefaultValue';
+import OuterObjectWithEnumProperty from './model/OuterObjectWithEnumProperty';
 import Pet from './model/Pet';
 import ReadOnlyFirst from './model/ReadOnlyFirst';
 import SpecialModelName from './model/SpecialModelName';
@@ -331,6 +332,12 @@ export {
      */
     OuterEnumIntegerDefaultValue,
 
+    /**
+     * The OuterObjectWithEnumProperty model constructor.
+     * @property {module:model/OuterObjectWithEnumProperty}
+     */
+    OuterObjectWithEnumProperty,
+
     /**
      * The Pet model constructor.
      * @property {module:model/Pet}
diff --git a/samples/client/petstore/javascript-es6/src/model/OuterObjectWithEnumProperty.js b/samples/client/petstore/javascript-es6/src/model/OuterObjectWithEnumProperty.js
new file mode 100644
index 0000000000000000000000000000000000000000..d2ef0e043715077c33763e8115443928c9cd90e7
--- /dev/null
+++ b/samples/client/petstore/javascript-es6/src/model/OuterObjectWithEnumProperty.js
@@ -0,0 +1,74 @@
+/**
+ * OpenAPI Petstore
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * 
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ *
+ */
+
+import ApiClient from '../ApiClient';
+import OuterEnumInteger from './OuterEnumInteger';
+
+/**
+ * The OuterObjectWithEnumProperty model module.
+ * @module model/OuterObjectWithEnumProperty
+ * @version 1.0.0
+ */
+class OuterObjectWithEnumProperty {
+    /**
+     * Constructs a new <code>OuterObjectWithEnumProperty</code>.
+     * @alias module:model/OuterObjectWithEnumProperty
+     * @param value {module:model/OuterEnumInteger} 
+     */
+    constructor(value) { 
+        
+        OuterObjectWithEnumProperty.initialize(this, value);
+    }
+
+    /**
+     * Initializes the fields of this object.
+     * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
+     * Only for internal use.
+     */
+    static initialize(obj, value) { 
+        obj['value'] = value;
+    }
+
+    /**
+     * Constructs a <code>OuterObjectWithEnumProperty</code> from a plain JavaScript object, optionally creating a new instance.
+     * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
+     * @param {Object} data The plain JavaScript object bearing properties of interest.
+     * @param {module:model/OuterObjectWithEnumProperty} obj Optional instance to populate.
+     * @return {module:model/OuterObjectWithEnumProperty} The populated <code>OuterObjectWithEnumProperty</code> instance.
+     */
+    static constructFromObject(data, obj) {
+        if (data) {
+            obj = obj || new OuterObjectWithEnumProperty();
+
+            if (data.hasOwnProperty('value')) {
+                obj['value'] = OuterEnumInteger.constructFromObject(data['value']);
+            }
+        }
+        return obj;
+    }
+
+
+}
+
+/**
+ * @member {module:model/OuterEnumInteger} value
+ */
+OuterObjectWithEnumProperty.prototype['value'] = undefined;
+
+
+
+
+
+
+export default OuterObjectWithEnumProperty;
+
diff --git a/samples/client/petstore/javascript-es6/test/model/OuterObjectWithEnumProperty.spec.js b/samples/client/petstore/javascript-es6/test/model/OuterObjectWithEnumProperty.spec.js
new file mode 100644
index 0000000000000000000000000000000000000000..ea94c61358eb7076c66620d849e131700a8e11b7
--- /dev/null
+++ b/samples/client/petstore/javascript-es6/test/model/OuterObjectWithEnumProperty.spec.js
@@ -0,0 +1,65 @@
+/**
+ * OpenAPI Petstore
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * 
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ *
+ */
+
+(function(root, factory) {
+  if (typeof define === 'function' && define.amd) {
+    // AMD.
+    define(['expect.js', process.cwd()+'/src/index'], factory);
+  } else if (typeof module === 'object' && module.exports) {
+    // CommonJS-like environments that support module.exports, like Node.
+    factory(require('expect.js'), require(process.cwd()+'/src/index'));
+  } else {
+    // Browser globals (root is window)
+    factory(root.expect, root.OpenApiPetstore);
+  }
+}(this, function(expect, OpenApiPetstore) {
+  'use strict';
+
+  var instance;
+
+  beforeEach(function() {
+    instance = new OpenApiPetstore.OuterObjectWithEnumProperty();
+  });
+
+  var getProperty = function(object, getter, property) {
+    // Use getter method if present; otherwise, get the property directly.
+    if (typeof object[getter] === 'function')
+      return object[getter]();
+    else
+      return object[property];
+  }
+
+  var setProperty = function(object, setter, property, value) {
+    // Use setter method if present; otherwise, set the property directly.
+    if (typeof object[setter] === 'function')
+      object[setter](value);
+    else
+      object[property] = value;
+  }
+
+  describe('OuterObjectWithEnumProperty', function() {
+    it('should create an instance of OuterObjectWithEnumProperty', function() {
+      // uncomment below and update the code to test OuterObjectWithEnumProperty
+      //var instane = new OpenApiPetstore.OuterObjectWithEnumProperty();
+      //expect(instance).to.be.a(OpenApiPetstore.OuterObjectWithEnumProperty);
+    });
+
+    it('should have the property value (base name: "value")', function() {
+      // uncomment below and update the code to test the property value
+      //var instance = new OpenApiPetstore.OuterObjectWithEnumProperty();
+      //expect(instance).to.be();
+    });
+
+  });
+
+}));
diff --git a/samples/client/petstore/javascript-promise-es6/.openapi-generator/FILES b/samples/client/petstore/javascript-promise-es6/.openapi-generator/FILES
index 85edf0d171731cd6ef81de4d9eae99c2213c562b..4e51f824bd2befd758901fc2148feb2735690c33 100644
--- a/samples/client/petstore/javascript-promise-es6/.openapi-generator/FILES
+++ b/samples/client/petstore/javascript-promise-es6/.openapi-generator/FILES
@@ -44,6 +44,7 @@ docs/OuterEnum.md
 docs/OuterEnumDefaultValue.md
 docs/OuterEnumInteger.md
 docs/OuterEnumIntegerDefaultValue.md
+docs/OuterObjectWithEnumProperty.md
 docs/Pet.md
 docs/PetApi.md
 docs/ReadOnlyFirst.md
@@ -102,8 +103,10 @@ src/model/OuterEnum.js
 src/model/OuterEnumDefaultValue.js
 src/model/OuterEnumInteger.js
 src/model/OuterEnumIntegerDefaultValue.js
+src/model/OuterObjectWithEnumProperty.js
 src/model/Pet.js
 src/model/ReadOnlyFirst.js
 src/model/SpecialModelName.js
 src/model/Tag.js
 src/model/User.js
+test/model/OuterObjectWithEnumProperty.spec.js
diff --git a/samples/client/petstore/javascript-promise-es6/README.md b/samples/client/petstore/javascript-promise-es6/README.md
index 2f487810d00670e472f651b5c8aef7464edbae5b..cf03725bb4d000beb9b0be2a0f852cc2f18a1315 100644
--- a/samples/client/petstore/javascript-promise-es6/README.md
+++ b/samples/client/petstore/javascript-promise-es6/README.md
@@ -126,6 +126,7 @@ Class | Method | HTTP request | Description
 *OpenApiPetstore.FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | 
 *OpenApiPetstore.FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | 
 *OpenApiPetstore.FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | 
+*OpenApiPetstore.FakeApi* | [**fakePropertyEnumIntegerSerialize**](docs/FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | 
 *OpenApiPetstore.FakeApi* | [**testBodyWithFileSchema**](docs/FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | 
 *OpenApiPetstore.FakeApi* | [**testBodyWithQueryParams**](docs/FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | 
 *OpenApiPetstore.FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model
@@ -199,6 +200,7 @@ Class | Method | HTTP request | Description
  - [OpenApiPetstore.OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md)
  - [OpenApiPetstore.OuterEnumInteger](docs/OuterEnumInteger.md)
  - [OpenApiPetstore.OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
+ - [OpenApiPetstore.OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md)
  - [OpenApiPetstore.Pet](docs/Pet.md)
  - [OpenApiPetstore.ReadOnlyFirst](docs/ReadOnlyFirst.md)
  - [OpenApiPetstore.SpecialModelName](docs/SpecialModelName.md)
diff --git a/samples/client/petstore/javascript-promise-es6/docs/FakeApi.md b/samples/client/petstore/javascript-promise-es6/docs/FakeApi.md
index c910944599f8f815a89ac33103fef7a8cbaae619..8c7d92f4eb5b7509fb0bb334893948280bf87a2f 100644
--- a/samples/client/petstore/javascript-promise-es6/docs/FakeApi.md
+++ b/samples/client/petstore/javascript-promise-es6/docs/FakeApi.md
@@ -10,6 +10,7 @@ Method | HTTP request | Description
 [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | 
 [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | 
 [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | 
+[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | 
 [**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | 
 [**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | 
 [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model
@@ -293,6 +294,50 @@ No authorization required
 - **Accept**: */*
 
 
+## fakePropertyEnumIntegerSerialize
+
+> OuterObjectWithEnumProperty fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty)
+
+
+
+Test serialization of enum (int) properties with examples
+
+### Example
+
+```javascript
+import OpenApiPetstore from 'open_api_petstore';
+
+let apiInstance = new OpenApiPetstore.FakeApi();
+let outerObjectWithEnumProperty = new OpenApiPetstore.OuterObjectWithEnumProperty(); // OuterObjectWithEnumProperty | Input enum (int) as post body
+apiInstance.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty).then((data) => {
+  console.log('API called successfully. Returned data: ' + data);
+}, (error) => {
+  console.error(error);
+});
+
+```
+
+### Parameters
+
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **outerObjectWithEnumProperty** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | 
+
+### Return type
+
+[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: application/json
+- **Accept**: */*
+
+
 ## testBodyWithFileSchema
 
 > testBodyWithFileSchema(fileSchemaTestClass)
diff --git a/samples/client/petstore/javascript-promise-es6/docs/OuterObjectWithEnumProperty.md b/samples/client/petstore/javascript-promise-es6/docs/OuterObjectWithEnumProperty.md
new file mode 100644
index 0000000000000000000000000000000000000000..a16331e63a6f89e8fdd1455fbc789503a9488fa3
--- /dev/null
+++ b/samples/client/petstore/javascript-promise-es6/docs/OuterObjectWithEnumProperty.md
@@ -0,0 +1,9 @@
+# OpenApiPetstore.OuterObjectWithEnumProperty
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**value** | [**OuterEnumInteger**](OuterEnumInteger.md) |  | 
+
+
diff --git a/samples/client/petstore/javascript-promise-es6/src/api/FakeApi.js b/samples/client/petstore/javascript-promise-es6/src/api/FakeApi.js
index 60668b32a9afb8616eb69b4a6d8a808f681a7b56..d636b0eca256e6c779ec911d72f37284b94a0d4a 100644
--- a/samples/client/petstore/javascript-promise-es6/src/api/FakeApi.js
+++ b/samples/client/petstore/javascript-promise-es6/src/api/FakeApi.js
@@ -17,6 +17,7 @@ import Client from '../model/Client';
 import FileSchemaTestClass from '../model/FileSchemaTestClass';
 import HealthCheckResult from '../model/HealthCheckResult';
 import OuterComposite from '../model/OuterComposite';
+import OuterObjectWithEnumProperty from '../model/OuterObjectWithEnumProperty';
 import Pet from '../model/Pet';
 import User from '../model/User';
 
@@ -309,6 +310,51 @@ export default class FakeApi {
     }
 
 
+    /**
+     * Test serialization of enum (int) properties with examples
+     * @param {module:model/OuterObjectWithEnumProperty} outerObjectWithEnumProperty Input enum (int) as post body
+     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OuterObjectWithEnumProperty} and HTTP response
+     */
+    fakePropertyEnumIntegerSerializeWithHttpInfo(outerObjectWithEnumProperty) {
+      let postBody = outerObjectWithEnumProperty;
+      // verify the required parameter 'outerObjectWithEnumProperty' is set
+      if (outerObjectWithEnumProperty === undefined || outerObjectWithEnumProperty === null) {
+        throw new Error("Missing the required parameter 'outerObjectWithEnumProperty' when calling fakePropertyEnumIntegerSerialize");
+      }
+
+      let pathParams = {
+      };
+      let queryParams = {
+      };
+      let headerParams = {
+      };
+      let formParams = {
+      };
+
+      let authNames = [];
+      let contentTypes = ['application/json'];
+      let accepts = ['*/*'];
+      let returnType = OuterObjectWithEnumProperty;
+      return this.apiClient.callApi(
+        '/fake/property/enum-int', 'POST',
+        pathParams, queryParams, headerParams, formParams, postBody,
+        authNames, contentTypes, accepts, returnType, null
+      );
+    }
+
+    /**
+     * Test serialization of enum (int) properties with examples
+     * @param {module:model/OuterObjectWithEnumProperty} outerObjectWithEnumProperty Input enum (int) as post body
+     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OuterObjectWithEnumProperty}
+     */
+    fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty) {
+      return this.fakePropertyEnumIntegerSerializeWithHttpInfo(outerObjectWithEnumProperty)
+        .then(function(response_and_data) {
+          return response_and_data.data;
+        });
+    }
+
+
     /**
      * For this test, the body for this request much reference a schema named `File`.
      * @param {module:model/FileSchemaTestClass} fileSchemaTestClass 
diff --git a/samples/client/petstore/javascript-promise-es6/src/index.js b/samples/client/petstore/javascript-promise-es6/src/index.js
index 33321542c648be945807bed0f4ea816e10f96891..81125db48aca966c4ea1451b3fe9ef883a7689e6 100644
--- a/samples/client/petstore/javascript-promise-es6/src/index.js
+++ b/samples/client/petstore/javascript-promise-es6/src/index.js
@@ -51,6 +51,7 @@ import OuterEnum from './model/OuterEnum';
 import OuterEnumDefaultValue from './model/OuterEnumDefaultValue';
 import OuterEnumInteger from './model/OuterEnumInteger';
 import OuterEnumIntegerDefaultValue from './model/OuterEnumIntegerDefaultValue';
+import OuterObjectWithEnumProperty from './model/OuterObjectWithEnumProperty';
 import Pet from './model/Pet';
 import ReadOnlyFirst from './model/ReadOnlyFirst';
 import SpecialModelName from './model/SpecialModelName';
@@ -331,6 +332,12 @@ export {
      */
     OuterEnumIntegerDefaultValue,
 
+    /**
+     * The OuterObjectWithEnumProperty model constructor.
+     * @property {module:model/OuterObjectWithEnumProperty}
+     */
+    OuterObjectWithEnumProperty,
+
     /**
      * The Pet model constructor.
      * @property {module:model/Pet}
diff --git a/samples/client/petstore/javascript-promise-es6/src/model/OuterObjectWithEnumProperty.js b/samples/client/petstore/javascript-promise-es6/src/model/OuterObjectWithEnumProperty.js
new file mode 100644
index 0000000000000000000000000000000000000000..d2ef0e043715077c33763e8115443928c9cd90e7
--- /dev/null
+++ b/samples/client/petstore/javascript-promise-es6/src/model/OuterObjectWithEnumProperty.js
@@ -0,0 +1,74 @@
+/**
+ * OpenAPI Petstore
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * 
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ *
+ */
+
+import ApiClient from '../ApiClient';
+import OuterEnumInteger from './OuterEnumInteger';
+
+/**
+ * The OuterObjectWithEnumProperty model module.
+ * @module model/OuterObjectWithEnumProperty
+ * @version 1.0.0
+ */
+class OuterObjectWithEnumProperty {
+    /**
+     * Constructs a new <code>OuterObjectWithEnumProperty</code>.
+     * @alias module:model/OuterObjectWithEnumProperty
+     * @param value {module:model/OuterEnumInteger} 
+     */
+    constructor(value) { 
+        
+        OuterObjectWithEnumProperty.initialize(this, value);
+    }
+
+    /**
+     * Initializes the fields of this object.
+     * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
+     * Only for internal use.
+     */
+    static initialize(obj, value) { 
+        obj['value'] = value;
+    }
+
+    /**
+     * Constructs a <code>OuterObjectWithEnumProperty</code> from a plain JavaScript object, optionally creating a new instance.
+     * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
+     * @param {Object} data The plain JavaScript object bearing properties of interest.
+     * @param {module:model/OuterObjectWithEnumProperty} obj Optional instance to populate.
+     * @return {module:model/OuterObjectWithEnumProperty} The populated <code>OuterObjectWithEnumProperty</code> instance.
+     */
+    static constructFromObject(data, obj) {
+        if (data) {
+            obj = obj || new OuterObjectWithEnumProperty();
+
+            if (data.hasOwnProperty('value')) {
+                obj['value'] = OuterEnumInteger.constructFromObject(data['value']);
+            }
+        }
+        return obj;
+    }
+
+
+}
+
+/**
+ * @member {module:model/OuterEnumInteger} value
+ */
+OuterObjectWithEnumProperty.prototype['value'] = undefined;
+
+
+
+
+
+
+export default OuterObjectWithEnumProperty;
+
diff --git a/samples/client/petstore/javascript-promise-es6/test/model/OuterObjectWithEnumProperty.spec.js b/samples/client/petstore/javascript-promise-es6/test/model/OuterObjectWithEnumProperty.spec.js
new file mode 100644
index 0000000000000000000000000000000000000000..ea94c61358eb7076c66620d849e131700a8e11b7
--- /dev/null
+++ b/samples/client/petstore/javascript-promise-es6/test/model/OuterObjectWithEnumProperty.spec.js
@@ -0,0 +1,65 @@
+/**
+ * OpenAPI Petstore
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * 
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ *
+ */
+
+(function(root, factory) {
+  if (typeof define === 'function' && define.amd) {
+    // AMD.
+    define(['expect.js', process.cwd()+'/src/index'], factory);
+  } else if (typeof module === 'object' && module.exports) {
+    // CommonJS-like environments that support module.exports, like Node.
+    factory(require('expect.js'), require(process.cwd()+'/src/index'));
+  } else {
+    // Browser globals (root is window)
+    factory(root.expect, root.OpenApiPetstore);
+  }
+}(this, function(expect, OpenApiPetstore) {
+  'use strict';
+
+  var instance;
+
+  beforeEach(function() {
+    instance = new OpenApiPetstore.OuterObjectWithEnumProperty();
+  });
+
+  var getProperty = function(object, getter, property) {
+    // Use getter method if present; otherwise, get the property directly.
+    if (typeof object[getter] === 'function')
+      return object[getter]();
+    else
+      return object[property];
+  }
+
+  var setProperty = function(object, setter, property, value) {
+    // Use setter method if present; otherwise, set the property directly.
+    if (typeof object[setter] === 'function')
+      object[setter](value);
+    else
+      object[property] = value;
+  }
+
+  describe('OuterObjectWithEnumProperty', function() {
+    it('should create an instance of OuterObjectWithEnumProperty', function() {
+      // uncomment below and update the code to test OuterObjectWithEnumProperty
+      //var instane = new OpenApiPetstore.OuterObjectWithEnumProperty();
+      //expect(instance).to.be.a(OpenApiPetstore.OuterObjectWithEnumProperty);
+    });
+
+    it('should have the property value (base name: "value")', function() {
+      // uncomment below and update the code to test the property value
+      //var instance = new OpenApiPetstore.OuterObjectWithEnumProperty();
+      //expect(instance).to.be();
+    });
+
+  });
+
+}));
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/PetApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..c8b93b33bf6f60435de09774f61ab084f7fafd04
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/PetApi.kt
@@ -0,0 +1,492 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.ApiResponse
+import org.openapitools.client.models.Pet
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Add a new pet to the store
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun addPet(body: Pet) : Unit {
+        val localVariableConfig = addPetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation addPet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun addPetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Deletes a pet
+    * 
+    * @param petId Pet id to delete 
+    * @param apiKey  (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
+        val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deletePet
+    *
+    * @param petId Pet id to delete 
+    * @param apiKey  (optional)
+    * @return RequestConfig
+    */
+    fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by status
+    * Multiple status values can be provided with comma separated strings
+    * @param status Status values that need to be considered for filter 
+    * @return kotlin.collections.List<Pet>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
+        val localVariableConfig = findPetsByStatusRequestConfig(status = status)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByStatus
+    *
+    * @param status Status values that need to be considered for filter 
+    * @return RequestConfig
+    */
+    fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("status", toMultiValue(status.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByStatus",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by tags
+    * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+    * @param tags Tags to filter by 
+    * @return kotlin.collections.List<Pet>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
+        val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByTags
+    *
+    * @param tags Tags to filter by 
+    * @return RequestConfig
+    */
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("tags", toMultiValue(tags.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByTags",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find pet by ID
+    * Returns a single pet
+    * @param petId ID of pet to return 
+    * @return Pet
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getPetById(petId: kotlin.Long) : Pet {
+        val localVariableConfig = getPetByIdRequestConfig(petId = petId)
+
+        val localVarResponse = request<Pet>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Pet
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getPetById
+    *
+    * @param petId ID of pet to return 
+    * @return RequestConfig
+    */
+    fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Update an existing pet
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updatePet(body: Pet) : Unit {
+        val localVariableConfig = updatePetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun updatePetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updates a pet in the store with form data
+    * 
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
+        val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePetWithForm
+    *
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return RequestConfig
+    */
+    fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * uploads an image
+    * 
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return ApiResponse
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
+        val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
+
+        val localVarResponse = request<ApiResponse>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation uploadFile
+    *
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return RequestConfig
+    */
+    fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/StoreApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..215ed63420c9d538efe258fcc1244627caa4b8e1
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/StoreApi.kt
@@ -0,0 +1,253 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.Order
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Delete purchase order by ID
+    * For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
+    * @param orderId ID of the order that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deleteOrder(orderId: kotlin.String) : Unit {
+        val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteOrder
+    *
+    * @param orderId ID of the order that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Returns pet inventories by status
+    * Returns a map of status codes to quantities
+    * @return kotlin.collections.Map<kotlin.String, kotlin.Int>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
+        val localVariableConfig = getInventoryRequestConfig()
+
+        val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map<kotlin.String, kotlin.Int>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getInventory
+    *
+    * @return RequestConfig
+    */
+    fun getInventoryRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/inventory",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find purchase order by ID
+    * For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
+    * @param orderId ID of pet that needs to be fetched 
+    * @return Order
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getOrderById(orderId: kotlin.Long) : Order {
+        val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getOrderById
+    *
+    * @param orderId ID of pet that needs to be fetched 
+    * @return RequestConfig
+    */
+    fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Place an order for a pet
+    * 
+    * @param body order placed for purchasing the pet 
+    * @return Order
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun placeOrder(body: Order) : Order {
+        val localVariableConfig = placeOrderRequestConfig(body = body)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation placeOrder
+    *
+    * @param body order placed for purchasing the pet 
+    * @return RequestConfig
+    */
+    fun placeOrderRequestConfig(body: Order) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/store/order",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/UserApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..53748b934636efed3e534dcce15de3d659631c0e
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/apis/UserApi.kt
@@ -0,0 +1,476 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.User
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Create user
+    * This can only be done by the logged in user.
+    * @param body Created user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUser(body: User) : Unit {
+        val localVariableConfig = createUserRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUser
+    *
+    * @param body Created user object 
+    * @return RequestConfig
+    */
+    fun createUserRequestConfig(body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithArrayInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithArray",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithListInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithList",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Delete user
+    * This can only be done by the logged in user.
+    * @param username The name that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deleteUser(username: kotlin.String) : Unit {
+        val localVariableConfig = deleteUserRequestConfig(username = username)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteUser
+    *
+    * @param username The name that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Get user by user name
+    * 
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return User
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getUserByName(username: kotlin.String) : User {
+        val localVariableConfig = getUserByNameRequestConfig(username = username)
+
+        val localVarResponse = request<User>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as User
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getUserByName
+    *
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return RequestConfig
+    */
+    fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs user into the system
+    * 
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return kotlin.String
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
+        val localVariableConfig = loginUserRequestConfig(username = username, password = password)
+
+        val localVarResponse = request<kotlin.String>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation loginUser
+    *
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return RequestConfig
+    */
+    fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("username", listOf(username.toString()))
+                put("password", listOf(password.toString()))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/login",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs out current logged in user session
+    * 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun logoutUser() : Unit {
+        val localVariableConfig = logoutUserRequestConfig()
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation logoutUser
+    *
+    * @return RequestConfig
+    */
+    fun logoutUserRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/logout",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updated user
+    * This can only be done by the logged in user.
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updateUser(username: kotlin.String, body: User) : Unit {
+        val localVariableConfig = updateUserRequestConfig(username = username, body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updateUser
+    *
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return RequestConfig
+    */
+    fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ef7a8f1e1a625f7efdbea17077de86da8e09f805
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
@@ -0,0 +1,23 @@
+package org.openapitools.client.infrastructure
+
+typealias MultiValueMap = MutableMap<String,List<String>>
+
+fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
+    "csv" -> ","
+    "tsv" -> "\t"
+    "pipe" -> "|"
+    "space" -> " "
+    else -> ""
+}
+
+val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
+
+fun <T : Any?> toMultiValue(items: Array<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter)
+        = toMultiValue(items.asIterable(), collectionFormat, map)
+
+fun <T : Any?> toMultiValue(items: Iterable<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String> {
+    return when(collectionFormat) {
+        "multi" -> items.map(map)
+        else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map))
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
new file mode 100644
index 0000000000000000000000000000000000000000..bcbb1cf862732a87a37224fa6806a98a8776c94f
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
@@ -0,0 +1,251 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Credentials
+import okhttp3.OkHttpClient
+import okhttp3.RequestBody
+import okhttp3.RequestBody.Companion.asRequestBody
+import okhttp3.RequestBody.Companion.toRequestBody
+import okhttp3.FormBody
+import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
+import okhttp3.ResponseBody
+import okhttp3.MediaType.Companion.toMediaTypeOrNull
+import okhttp3.Request
+import okhttp3.Headers
+import okhttp3.MultipartBody
+import java.io.File
+import java.net.URLConnection
+import java.util.Date
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.LocalTime
+import java.time.OffsetDateTime
+import java.time.OffsetTime
+
+open class ApiClient(val baseUrl: String) {
+    companion object {
+        protected const val ContentType = "Content-Type"
+        protected const val Accept = "Accept"
+        protected const val Authorization = "Authorization"
+        protected const val JsonMediaType = "application/json"
+        protected const val FormDataMediaType = "multipart/form-data"
+        protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded"
+        protected const val XmlMediaType = "application/xml"
+
+        val apiKey: MutableMap<String, String> = mutableMapOf()
+        val apiKeyPrefix: MutableMap<String, String> = mutableMapOf()
+        var username: String? = null
+        var password: String? = null
+        var accessToken: String? = null
+
+        @JvmStatic
+        val client: OkHttpClient by lazy {
+            builder.build()
+        }
+
+        @JvmStatic
+        val builder: OkHttpClient.Builder = OkHttpClient.Builder()
+    }
+
+    /**
+     * Guess Content-Type header from the given file (defaults to "application/octet-stream").
+     *
+     * @param file The given file
+     * @return The guessed Content-Type
+     */
+    protected fun guessContentTypeFromFile(file: File): String {
+        val contentType = URLConnection.guessContentTypeFromName(file.name)
+        return contentType ?: "application/octet-stream"
+    }
+
+    protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
+        when {
+            content is File -> content.asRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == FormDataMediaType -> {
+                MultipartBody.Builder()
+                    .setType(MultipartBody.FORM)
+                    .apply {
+                        // content's type *must* be Map<String, Any?>
+                        @Suppress("UNCHECKED_CAST")
+                        (content as Map<String, Any?>).forEach { (key, value) ->
+                            if (value is File) {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\"; filename=\"${value.name}\""
+                                )
+                                val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull()
+                                addPart(partHeaders, value.asRequestBody(fileMediaType))
+                            } else {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\""
+                                )
+                                addPart(
+                                    partHeaders,
+                                    parameterToString(value).toRequestBody(null)
+                                )
+                            }
+                        }
+                    }.build()
+            }
+            mediaType == FormUrlEncMediaType -> {
+                FormBody.Builder().apply {
+                    // content's type *must* be Map<String, Any?>
+                    @Suppress("UNCHECKED_CAST")
+                    (content as Map<String, Any?>).forEach { (key, value) ->
+                        add(key, parameterToString(value))
+                    }
+                }.build()
+            }
+            mediaType == JsonMediaType -> Serializer.gson.toJson(content, T::class.java).toRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
+            // TODO: this should be extended with other serializers
+            else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.")
+        }
+
+    protected inline fun <reified T: Any?> responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? {
+        if(body == null) {
+            return null
+        }
+        val bodyContent = body.string()
+        if (bodyContent.isEmpty()) {
+            return null
+        }
+        return when(mediaType) {
+            JsonMediaType -> Serializer.gson.fromJson(bodyContent, T::class.java)
+            else ->  throw UnsupportedOperationException("responseBody currently only supports JSON body.")
+        }
+    }
+
+    protected fun updateAuthParams(requestConfig: RequestConfig) {
+        if (requestConfig.headers["api_key"].isNullOrEmpty()) {
+            if (apiKey["api_key"] != null) {
+                if (apiKeyPrefix["api_key"] != null) {
+                    requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!
+                } else {
+                    requestConfig.headers["api_key"] = apiKey["api_key"]!!
+                }
+            }
+        }
+        if (requestConfig.headers[Authorization].isNullOrEmpty()) {
+            accessToken?.let { accessToken ->
+                requestConfig.headers[Authorization] = "Bearer $accessToken "
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
+        val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
+
+        // take authMethod from operation
+        updateAuthParams(requestConfig)
+
+        val url = httpUrl.newBuilder()
+            .addPathSegments(requestConfig.path.trimStart('/'))
+            .apply {
+                requestConfig.query.forEach { query ->
+                    query.value.forEach { queryValue ->
+                        addQueryParameter(query.key, queryValue)
+                    }
+                }
+            }.build()
+
+        // take content-type/accept from spec or set to default (application/json) if not defined
+        if (requestConfig.headers[ContentType].isNullOrEmpty()) {
+            requestConfig.headers[ContentType] = JsonMediaType
+        }
+        if (requestConfig.headers[Accept].isNullOrEmpty()) {
+            requestConfig.headers[Accept] = JsonMediaType
+        }
+        val headers = requestConfig.headers
+
+        if(headers[ContentType] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Content-Type header. This is required.")
+        }
+
+        if(headers[Accept] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Accept header. This is required.")
+        }
+
+        // TODO: support multiple contentType options here.
+        val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
+
+        val request = when (requestConfig.method) {
+            RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
+            RequestMethod.GET -> Request.Builder().url(url)
+            RequestMethod.HEAD -> Request.Builder().url(url).head()
+            RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
+            RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
+            RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
+            RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
+        }.apply {
+            headers.forEach { header -> addHeader(header.key, header.value) }
+        }.build()
+
+        val response = client.newCall(request).execute()
+        val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
+
+        // TODO: handle specific mapping types. e.g. Map<int, Class<?>>
+        when {
+            response.isRedirect -> return Redirection(
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isInformational -> return Informational(
+                    response.message,
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isSuccessful -> return Success(
+                    responseBody(response.body, accept),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isClientError -> return ClientError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            else -> return ServerError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+        }
+    }
+
+    protected fun parameterToString(value: Any?): String {
+        when (value) {
+            null -> {
+                return ""
+            }
+            is Array<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is Iterable<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
+                return parseDateToQueryString<Any>(value)
+            }
+            else -> {
+                return value.toString()
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any> 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.gson.toJson(value, T::class.java).replace("\"", "")
+    }
+}
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9dc8d8dbbfaaef4f86a4f65b8a908ba9e4507060
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
@@ -0,0 +1,43 @@
+package org.openapitools.client.infrastructure
+
+enum class ResponseType {
+    Success, Informational, Redirection, ClientError, ServerError
+}
+
+interface Response
+
+abstract class ApiInfrastructureResponse<T>(val responseType: ResponseType): Response {
+    abstract val statusCode: Int
+    abstract val headers: Map<String,List<String>>
+}
+
+class Success<T>(
+    val data: T,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+): ApiInfrastructureResponse<T>(ResponseType.Success)
+
+class Informational<T>(
+    val statusText: String,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Informational)
+
+class Redirection<T>(
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Redirection)
+
+class ClientError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.ClientError)
+
+class ServerError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>>
+): ApiInfrastructureResponse<T>(ResponseType.ServerError)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
new file mode 100644
index 0000000000000000000000000000000000000000..dd34bd48b2c01a3b2cc449fd1952635bfb9c0c85
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
@@ -0,0 +1,29 @@
+package org.openapitools.client.infrastructure
+
+import kotlin.properties.ReadWriteProperty
+import kotlin.reflect.KProperty
+
+object ApplicationDelegates {
+    /**
+     * Provides a property delegate, allowing the property to be set once and only once.
+     *
+     * If unset (no default value), a get on the property will throw [IllegalStateException].
+     */
+    fun <T> setOnce(defaultValue: T? = null) : ReadWriteProperty<Any?, T> = SetOnce(defaultValue)
+
+    private class SetOnce<T>(defaultValue: T? = null) : ReadWriteProperty<Any?, T> {
+        private var isSet = false
+        private var value: T? = defaultValue
+
+        override fun getValue(thisRef: Any?, property: KProperty<*>): T {
+            return value ?: throw IllegalStateException("${property.name} not initialized")
+        }
+
+        override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) {
+            if (!isSet) {
+                this.value = value
+                isSet = true
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..6120b081929dd7e189873ff58ac533b25cd02234
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
@@ -0,0 +1,33 @@
+package org.openapitools.client.infrastructure
+
+import com.google.gson.TypeAdapter
+import com.google.gson.stream.JsonReader
+import com.google.gson.stream.JsonWriter
+import com.google.gson.stream.JsonToken.NULL
+import java.io.IOException
+
+class ByteArrayAdapter : TypeAdapter<ByteArray>() {
+    @Throws(IOException::class)
+    override fun write(out: JsonWriter?, value: ByteArray?) {
+        if (value == null) {
+            out?.nullValue()
+        } else {
+            out?.value(String(value))
+        }
+    }
+
+    @Throws(IOException::class)
+    override fun read(out: JsonReader?): ByteArray? {
+        out ?: return null
+
+        when (out.peek()) {
+            NULL -> {
+                out.nextNull()
+                return null
+            }
+            else -> {
+                return out.nextString().toByteArray()
+            }
+        }
+    }
+}
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/DateAdapter.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/DateAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..c5d330ac0757540eb5a719e0b59c95fc10979cb3
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/DateAdapter.kt
@@ -0,0 +1,37 @@
+package org.openapitools.client.infrastructure
+
+import com.google.gson.TypeAdapter
+import com.google.gson.stream.JsonReader
+import com.google.gson.stream.JsonWriter
+import com.google.gson.stream.JsonToken.NULL
+import java.io.IOException
+import java.text.DateFormat
+import java.text.SimpleDateFormat
+import java.util.Date
+import java.util.Locale
+
+class DateAdapter(val formatter: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault())) : TypeAdapter<Date>() {
+    @Throws(IOException::class)
+    override fun write(out: JsonWriter?, value: Date?) {
+        if (value == null) {
+            out?.nullValue()
+        } else {
+            out?.value(formatter.format(value))
+        }
+    }
+
+    @Throws(IOException::class)
+    override fun read(out: JsonReader?): Date? {
+        out ?: return null
+
+        when (out.peek()) {
+            NULL -> {
+                out.nextNull()
+                return null
+            }
+            else -> {
+                return formatter.parse(out.nextString())
+            }
+        }
+    }
+}
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Errors.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b5310e71f13c7e7fb874be998af37dd424d9cd11
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Errors.kt
@@ -0,0 +1,18 @@
+@file:Suppress("unused")
+package org.openapitools.client.infrastructure
+
+import java.lang.RuntimeException
+
+open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 123L
+    }
+}
+
+open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 456L
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..30ef6697183a98f06aad567edbb64979bbebb667
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
@@ -0,0 +1,35 @@
+package org.openapitools.client.infrastructure
+
+import com.google.gson.TypeAdapter
+import com.google.gson.stream.JsonReader
+import com.google.gson.stream.JsonWriter
+import com.google.gson.stream.JsonToken.NULL
+import java.io.IOException
+import java.time.LocalDate
+import java.time.format.DateTimeFormatter
+
+class LocalDateAdapter(private val formatter: DateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE) : TypeAdapter<LocalDate>() {
+    @Throws(IOException::class)
+    override fun write(out: JsonWriter?, value: LocalDate?) {
+        if (value == null) {
+            out?.nullValue()
+        } else {
+            out?.value(formatter.format(value))
+        }
+    }
+
+    @Throws(IOException::class)
+    override fun read(out: JsonReader?): LocalDate? {
+        out ?: return null
+
+        when (out.peek()) {
+            NULL -> {
+                out.nextNull()
+                return null
+            }
+            else -> {
+                return LocalDate.parse(out.nextString(), formatter)
+            }
+        }
+    }
+}
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..3ad781c66ca18fad5fa00d51703447e75967da39
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
@@ -0,0 +1,35 @@
+package org.openapitools.client.infrastructure
+
+import com.google.gson.TypeAdapter
+import com.google.gson.stream.JsonReader
+import com.google.gson.stream.JsonWriter
+import com.google.gson.stream.JsonToken.NULL
+import java.io.IOException
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
+
+class LocalDateTimeAdapter(private val formatter: DateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME) : TypeAdapter<LocalDateTime>() {
+    @Throws(IOException::class)
+    override fun write(out: JsonWriter?, value: LocalDateTime?) {
+        if (value == null) {
+            out?.nullValue()
+        } else {
+            out?.value(formatter.format(value))
+        }
+    }
+
+    @Throws(IOException::class)
+    override fun read(out: JsonReader?): LocalDateTime? {
+        out ?: return null
+
+        when (out.peek()) {
+            NULL -> {
+                out.nextNull()
+                return null
+            }
+            else -> {
+                return LocalDateTime.parse(out.nextString(), formatter)
+            }
+        }
+    }
+}
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..e615135c9cc0dc8234f99eed53575eed2497185a
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
@@ -0,0 +1,35 @@
+package org.openapitools.client.infrastructure
+
+import com.google.gson.TypeAdapter
+import com.google.gson.stream.JsonReader
+import com.google.gson.stream.JsonWriter
+import com.google.gson.stream.JsonToken.NULL
+import java.io.IOException
+import java.time.OffsetDateTime
+import java.time.format.DateTimeFormatter
+
+class OffsetDateTimeAdapter(private val formatter: DateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME) : TypeAdapter<OffsetDateTime>() {
+    @Throws(IOException::class)
+    override fun write(out: JsonWriter?, value: OffsetDateTime?) {
+        if (value == null) {
+            out?.nullValue()
+        } else {
+            out?.value(formatter.format(value))
+        }
+    }
+
+    @Throws(IOException::class)
+    override fun read(out: JsonReader?): OffsetDateTime? {
+        out ?: return null
+
+        when (out.peek()) {
+            NULL -> {
+                out.nextNull()
+                return null
+            }
+            else -> {
+                return OffsetDateTime.parse(out.nextString(), formatter)
+            }
+        }
+    }
+}
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
new file mode 100644
index 0000000000000000000000000000000000000000..0f2790f370e29d3fceb044c2309dd945cd562eeb
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
@@ -0,0 +1,17 @@
+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<String,String> because rfc2616 defines
+ *       multi-valued headers as csv-only.
+ */
+data class RequestConfig(
+    val method: RequestMethod,
+    val path: String,
+    val headers: MutableMap<String, String> = mutableMapOf(),
+    val query: MutableMap<String, List<String>> = mutableMapOf(),
+    val body: kotlin.Any? = null
+)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt
new file mode 100644
index 0000000000000000000000000000000000000000..931b12b8bd7a6dba7362eaafc490edf709d14616
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/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
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9bd2790dc144a3794c7957fdff86c114e5570c99
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
@@ -0,0 +1,24 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Response
+
+/**
+ * Provides an extension to evaluation whether the response is a 1xx code
+ */
+val Response.isInformational : Boolean get() = this.code in 100..199
+
+/**
+ * Provides an extension to evaluation whether the response is a 3xx code
+ */
+@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
+val Response.isRedirect : Boolean get() = this.code in 300..399
+
+/**
+ * Provides an extension to evaluation whether the response is a 4xx code
+ */
+val Response.isClientError : Boolean get() = this.code in 400..499
+
+/**
+ * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code
+ */
+val Response.isServerError : Boolean get() = this.code in 500..999
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Serializer.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b80e0390de2d33aa5140c42df6455bdb4b909042
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/infrastructure/Serializer.kt
@@ -0,0 +1,23 @@
+package org.openapitools.client.infrastructure
+
+import com.google.gson.Gson
+import com.google.gson.GsonBuilder
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.OffsetDateTime
+import java.util.UUID
+import java.util.Date
+
+object Serializer {
+    @JvmStatic
+    val gsonBuilder: GsonBuilder = GsonBuilder()
+        .registerTypeAdapter(OffsetDateTime::class.java, OffsetDateTimeAdapter())
+        .registerTypeAdapter(LocalDateTime::class.java, LocalDateTimeAdapter())
+        .registerTypeAdapter(LocalDate::class.java, LocalDateAdapter())
+        .registerTypeAdapter(ByteArray::class.java, ByteArrayAdapter())
+    
+    @JvmStatic
+    val gson: Gson by lazy {
+        gsonBuilder.create()
+    }
+}
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/ApiResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..54df813fceec212e0e1060ca8ebbbe96752c08d2
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/ApiResponse.kt
@@ -0,0 +1,32 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.google.gson.annotations.SerializedName
+
+/**
+ * Describes the result of uploading an image resource
+ * @param code 
+ * @param type 
+ * @param message 
+ */
+
+data class ApiResponse (
+    @SerializedName("code")
+    val code: kotlin.Int? = null,
+    @SerializedName("type")
+    val type: kotlin.String? = null,
+    @SerializedName("message")
+    val message: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Category.kt
new file mode 100644
index 0000000000000000000000000000000000000000..fdefa74fda0b0a313b5857885d011b9501ebe3c3
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Category.kt
@@ -0,0 +1,29 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.google.gson.annotations.SerializedName
+
+/**
+ * A category for a pet
+ * @param id 
+ * @param name 
+ */
+
+data class Category (
+    @SerializedName("id")
+    val id: kotlin.Long? = null,
+    @SerializedName("name")
+    val name: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Order.kt
new file mode 100644
index 0000000000000000000000000000000000000000..049c89df3134d0ab392ce9cae70bb863310f569a
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Order.kt
@@ -0,0 +1,54 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.google.gson.annotations.SerializedName
+
+/**
+ * An order for a pets from the pet store
+ * @param id 
+ * @param petId 
+ * @param quantity 
+ * @param shipDate 
+ * @param status Order Status
+ * @param complete 
+ */
+
+data class Order (
+    @SerializedName("id")
+    val id: kotlin.Long? = null,
+    @SerializedName("petId")
+    val petId: kotlin.Long? = null,
+    @SerializedName("quantity")
+    val quantity: kotlin.Int? = null,
+    @SerializedName("shipDate")
+    val shipDate: java.time.OffsetDateTime? = null,
+    /* Order Status */
+    @SerializedName("status")
+    val status: Order.Status? = null,
+    @SerializedName("complete")
+    val complete: kotlin.Boolean? = null
+) {
+
+    /**
+    * Order Status
+    * Values: placed,approved,delivered
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @SerializedName(value = "placed") placed("placed"),
+        @SerializedName(value = "approved") approved("approved"),
+        @SerializedName(value = "delivered") delivered("delivered");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Pet.kt
new file mode 100644
index 0000000000000000000000000000000000000000..af29ef2b61b74ba68ee1662a2c37177b49511aa4
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Pet.kt
@@ -0,0 +1,56 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+import org.openapitools.client.models.Category
+import org.openapitools.client.models.Tag
+
+import com.google.gson.annotations.SerializedName
+
+/**
+ * A pet for sale in the pet store
+ * @param name 
+ * @param photoUrls 
+ * @param id 
+ * @param category 
+ * @param tags 
+ * @param status pet status in the store
+ */
+
+data class Pet (
+    @SerializedName("name")
+    val name: kotlin.String,
+    @SerializedName("photoUrls")
+    val photoUrls: kotlin.collections.List<kotlin.String>,
+    @SerializedName("id")
+    val id: kotlin.Long? = null,
+    @SerializedName("category")
+    val category: Category? = null,
+    @SerializedName("tags")
+    val tags: kotlin.collections.List<Tag>? = null,
+    /* pet status in the store */
+    @SerializedName("status")
+    val status: Pet.Status? = null
+) {
+
+    /**
+    * pet status in the store
+    * Values: available,pending,sold
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @SerializedName(value = "available") available("available"),
+        @SerializedName(value = "pending") pending("pending"),
+        @SerializedName(value = "sold") sold("sold");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Tag.kt
new file mode 100644
index 0000000000000000000000000000000000000000..28e82b1df685700d55fa4ef61cf6a65f96b7597b
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/Tag.kt
@@ -0,0 +1,29 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.google.gson.annotations.SerializedName
+
+/**
+ * A tag for a pet
+ * @param id 
+ * @param name 
+ */
+
+data class Tag (
+    @SerializedName("id")
+    val id: kotlin.Long? = null,
+    @SerializedName("name")
+    val name: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/User.kt
new file mode 100644
index 0000000000000000000000000000000000000000..62baf33e927eb19f93603fe119daea2a549bc8cd
--- /dev/null
+++ b/samples/client/petstore/kotlin-gson/bin/main/org/openapitools/client/models/User.kt
@@ -0,0 +1,48 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.google.gson.annotations.SerializedName
+
+/**
+ * A User who is purchasing from the pet store
+ * @param id 
+ * @param username 
+ * @param firstName 
+ * @param lastName 
+ * @param email 
+ * @param password 
+ * @param phone 
+ * @param userStatus User Status
+ */
+
+data class User (
+    @SerializedName("id")
+    val id: kotlin.Long? = null,
+    @SerializedName("username")
+    val username: kotlin.String? = null,
+    @SerializedName("firstName")
+    val firstName: kotlin.String? = null,
+    @SerializedName("lastName")
+    val lastName: kotlin.String? = null,
+    @SerializedName("email")
+    val email: kotlin.String? = null,
+    @SerializedName("password")
+    val password: kotlin.String? = null,
+    @SerializedName("phone")
+    val phone: kotlin.String? = null,
+    /* User Status */
+    @SerializedName("userStatus")
+    val userStatus: kotlin.Int? = null
+)
+
diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/PetApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..c8b93b33bf6f60435de09774f61ab084f7fafd04
--- /dev/null
+++ b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/PetApi.kt
@@ -0,0 +1,492 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.ApiResponse
+import org.openapitools.client.models.Pet
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Add a new pet to the store
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun addPet(body: Pet) : Unit {
+        val localVariableConfig = addPetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation addPet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun addPetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Deletes a pet
+    * 
+    * @param petId Pet id to delete 
+    * @param apiKey  (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
+        val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deletePet
+    *
+    * @param petId Pet id to delete 
+    * @param apiKey  (optional)
+    * @return RequestConfig
+    */
+    fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by status
+    * Multiple status values can be provided with comma separated strings
+    * @param status Status values that need to be considered for filter 
+    * @return kotlin.collections.List<Pet>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
+        val localVariableConfig = findPetsByStatusRequestConfig(status = status)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByStatus
+    *
+    * @param status Status values that need to be considered for filter 
+    * @return RequestConfig
+    */
+    fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("status", toMultiValue(status.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByStatus",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by tags
+    * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+    * @param tags Tags to filter by 
+    * @return kotlin.collections.List<Pet>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
+        val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByTags
+    *
+    * @param tags Tags to filter by 
+    * @return RequestConfig
+    */
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("tags", toMultiValue(tags.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByTags",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find pet by ID
+    * Returns a single pet
+    * @param petId ID of pet to return 
+    * @return Pet
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getPetById(petId: kotlin.Long) : Pet {
+        val localVariableConfig = getPetByIdRequestConfig(petId = petId)
+
+        val localVarResponse = request<Pet>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Pet
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getPetById
+    *
+    * @param petId ID of pet to return 
+    * @return RequestConfig
+    */
+    fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Update an existing pet
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updatePet(body: Pet) : Unit {
+        val localVariableConfig = updatePetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun updatePetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updates a pet in the store with form data
+    * 
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
+        val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePetWithForm
+    *
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return RequestConfig
+    */
+    fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * uploads an image
+    * 
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return ApiResponse
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
+        val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
+
+        val localVarResponse = request<ApiResponse>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation uploadFile
+    *
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return RequestConfig
+    */
+    fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/StoreApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..215ed63420c9d538efe258fcc1244627caa4b8e1
--- /dev/null
+++ b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/StoreApi.kt
@@ -0,0 +1,253 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.Order
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Delete purchase order by ID
+    * For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
+    * @param orderId ID of the order that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deleteOrder(orderId: kotlin.String) : Unit {
+        val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteOrder
+    *
+    * @param orderId ID of the order that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Returns pet inventories by status
+    * Returns a map of status codes to quantities
+    * @return kotlin.collections.Map<kotlin.String, kotlin.Int>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
+        val localVariableConfig = getInventoryRequestConfig()
+
+        val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map<kotlin.String, kotlin.Int>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getInventory
+    *
+    * @return RequestConfig
+    */
+    fun getInventoryRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/inventory",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find purchase order by ID
+    * For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
+    * @param orderId ID of pet that needs to be fetched 
+    * @return Order
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getOrderById(orderId: kotlin.Long) : Order {
+        val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getOrderById
+    *
+    * @param orderId ID of pet that needs to be fetched 
+    * @return RequestConfig
+    */
+    fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Place an order for a pet
+    * 
+    * @param body order placed for purchasing the pet 
+    * @return Order
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun placeOrder(body: Order) : Order {
+        val localVariableConfig = placeOrderRequestConfig(body = body)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation placeOrder
+    *
+    * @param body order placed for purchasing the pet 
+    * @return RequestConfig
+    */
+    fun placeOrderRequestConfig(body: Order) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/store/order",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/UserApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..53748b934636efed3e534dcce15de3d659631c0e
--- /dev/null
+++ b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/apis/UserApi.kt
@@ -0,0 +1,476 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.User
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Create user
+    * This can only be done by the logged in user.
+    * @param body Created user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUser(body: User) : Unit {
+        val localVariableConfig = createUserRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUser
+    *
+    * @param body Created user object 
+    * @return RequestConfig
+    */
+    fun createUserRequestConfig(body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithArrayInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithArray",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithListInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithList",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Delete user
+    * This can only be done by the logged in user.
+    * @param username The name that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deleteUser(username: kotlin.String) : Unit {
+        val localVariableConfig = deleteUserRequestConfig(username = username)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteUser
+    *
+    * @param username The name that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Get user by user name
+    * 
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return User
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getUserByName(username: kotlin.String) : User {
+        val localVariableConfig = getUserByNameRequestConfig(username = username)
+
+        val localVarResponse = request<User>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as User
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getUserByName
+    *
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return RequestConfig
+    */
+    fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs user into the system
+    * 
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return kotlin.String
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
+        val localVariableConfig = loginUserRequestConfig(username = username, password = password)
+
+        val localVarResponse = request<kotlin.String>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation loginUser
+    *
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return RequestConfig
+    */
+    fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("username", listOf(username.toString()))
+                put("password", listOf(password.toString()))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/login",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs out current logged in user session
+    * 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun logoutUser() : Unit {
+        val localVariableConfig = logoutUserRequestConfig()
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation logoutUser
+    *
+    * @return RequestConfig
+    */
+    fun logoutUserRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/logout",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updated user
+    * This can only be done by the logged in user.
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updateUser(username: kotlin.String, body: User) : Unit {
+        val localVariableConfig = updateUserRequestConfig(username = username, body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updateUser
+    *
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return RequestConfig
+    */
+    fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ef7a8f1e1a625f7efdbea17077de86da8e09f805
--- /dev/null
+++ b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
@@ -0,0 +1,23 @@
+package org.openapitools.client.infrastructure
+
+typealias MultiValueMap = MutableMap<String,List<String>>
+
+fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
+    "csv" -> ","
+    "tsv" -> "\t"
+    "pipe" -> "|"
+    "space" -> " "
+    else -> ""
+}
+
+val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
+
+fun <T : Any?> toMultiValue(items: Array<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter)
+        = toMultiValue(items.asIterable(), collectionFormat, map)
+
+fun <T : Any?> toMultiValue(items: Iterable<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String> {
+    return when(collectionFormat) {
+        "multi" -> items.map(map)
+        else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map))
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
new file mode 100644
index 0000000000000000000000000000000000000000..637ca64c247bd2e7923975baf55fe3d2df0fc8b9
--- /dev/null
+++ b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
@@ -0,0 +1,251 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Credentials
+import okhttp3.OkHttpClient
+import okhttp3.RequestBody
+import okhttp3.RequestBody.Companion.asRequestBody
+import okhttp3.RequestBody.Companion.toRequestBody
+import okhttp3.FormBody
+import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
+import okhttp3.ResponseBody
+import okhttp3.MediaType.Companion.toMediaTypeOrNull
+import okhttp3.Request
+import okhttp3.Headers
+import okhttp3.MultipartBody
+import java.io.File
+import java.net.URLConnection
+import java.util.Date
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.LocalTime
+import java.time.OffsetDateTime
+import java.time.OffsetTime
+
+open class ApiClient(val baseUrl: String) {
+    companion object {
+        protected const val ContentType = "Content-Type"
+        protected const val Accept = "Accept"
+        protected const val Authorization = "Authorization"
+        protected const val JsonMediaType = "application/json"
+        protected const val FormDataMediaType = "multipart/form-data"
+        protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded"
+        protected const val XmlMediaType = "application/xml"
+
+        val apiKey: MutableMap<String, String> = mutableMapOf()
+        val apiKeyPrefix: MutableMap<String, String> = mutableMapOf()
+        var username: String? = null
+        var password: String? = null
+        var accessToken: String? = null
+
+        @JvmStatic
+        val client: OkHttpClient by lazy {
+            builder.build()
+        }
+
+        @JvmStatic
+        val builder: OkHttpClient.Builder = OkHttpClient.Builder()
+    }
+
+    /**
+     * Guess Content-Type header from the given file (defaults to "application/octet-stream").
+     *
+     * @param file The given file
+     * @return The guessed Content-Type
+     */
+    protected fun guessContentTypeFromFile(file: File): String {
+        val contentType = URLConnection.guessContentTypeFromName(file.name)
+        return contentType ?: "application/octet-stream"
+    }
+
+    protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
+        when {
+            content is File -> content.asRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == FormDataMediaType -> {
+                MultipartBody.Builder()
+                    .setType(MultipartBody.FORM)
+                    .apply {
+                        // content's type *must* be Map<String, Any?>
+                        @Suppress("UNCHECKED_CAST")
+                        (content as Map<String, Any?>).forEach { (key, value) ->
+                            if (value is File) {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\"; filename=\"${value.name}\""
+                                )
+                                val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull()
+                                addPart(partHeaders, value.asRequestBody(fileMediaType))
+                            } else {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\""
+                                )
+                                addPart(
+                                    partHeaders,
+                                    parameterToString(value).toRequestBody(null)
+                                )
+                            }
+                        }
+                    }.build()
+            }
+            mediaType == FormUrlEncMediaType -> {
+                FormBody.Builder().apply {
+                    // content's type *must* be Map<String, Any?>
+                    @Suppress("UNCHECKED_CAST")
+                    (content as Map<String, Any?>).forEach { (key, value) ->
+                        add(key, parameterToString(value))
+                    }
+                }.build()
+            }
+            mediaType == JsonMediaType -> Serializer.jacksonObjectMapper.writeValueAsString(content).toRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
+            // TODO: this should be extended with other serializers
+            else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.")
+        }
+
+    protected inline fun <reified T: Any?> responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? {
+        if(body == null) {
+            return null
+        }
+        val bodyContent = body.string()
+        if (bodyContent.isEmpty()) {
+            return null
+        }
+        return when(mediaType) {
+            JsonMediaType -> Serializer.jacksonObjectMapper.readValue(bodyContent, T::class.java)
+            else ->  throw UnsupportedOperationException("responseBody currently only supports JSON body.")
+        }
+    }
+
+    protected fun updateAuthParams(requestConfig: RequestConfig) {
+        if (requestConfig.headers["api_key"].isNullOrEmpty()) {
+            if (apiKey["api_key"] != null) {
+                if (apiKeyPrefix["api_key"] != null) {
+                    requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!
+                } else {
+                    requestConfig.headers["api_key"] = apiKey["api_key"]!!
+                }
+            }
+        }
+        if (requestConfig.headers[Authorization].isNullOrEmpty()) {
+            accessToken?.let { accessToken ->
+                requestConfig.headers[Authorization] = "Bearer $accessToken "
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
+        val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
+
+        // take authMethod from operation
+        updateAuthParams(requestConfig)
+
+        val url = httpUrl.newBuilder()
+            .addPathSegments(requestConfig.path.trimStart('/'))
+            .apply {
+                requestConfig.query.forEach { query ->
+                    query.value.forEach { queryValue ->
+                        addQueryParameter(query.key, queryValue)
+                    }
+                }
+            }.build()
+
+        // take content-type/accept from spec or set to default (application/json) if not defined
+        if (requestConfig.headers[ContentType].isNullOrEmpty()) {
+            requestConfig.headers[ContentType] = JsonMediaType
+        }
+        if (requestConfig.headers[Accept].isNullOrEmpty()) {
+            requestConfig.headers[Accept] = JsonMediaType
+        }
+        val headers = requestConfig.headers
+
+        if(headers[ContentType] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Content-Type header. This is required.")
+        }
+
+        if(headers[Accept] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Accept header. This is required.")
+        }
+
+        // TODO: support multiple contentType options here.
+        val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
+
+        val request = when (requestConfig.method) {
+            RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
+            RequestMethod.GET -> Request.Builder().url(url)
+            RequestMethod.HEAD -> Request.Builder().url(url).head()
+            RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
+            RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
+            RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
+            RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
+        }.apply {
+            headers.forEach { header -> addHeader(header.key, header.value) }
+        }.build()
+
+        val response = client.newCall(request).execute()
+        val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
+
+        // TODO: handle specific mapping types. e.g. Map<int, Class<?>>
+        when {
+            response.isRedirect -> return Redirection(
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isInformational -> return Informational(
+                    response.message,
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isSuccessful -> return Success(
+                    responseBody(response.body, accept),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isClientError -> return ClientError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            else -> return ServerError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+        }
+    }
+
+    protected fun parameterToString(value: Any?): String {
+        when (value) {
+            null -> {
+                return ""
+            }
+            is Array<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is Iterable<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
+                return parseDateToQueryString<Any>(value)
+            }
+            else -> {
+                return value.toString()
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any> 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/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9dc8d8dbbfaaef4f86a4f65b8a908ba9e4507060
--- /dev/null
+++ b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
@@ -0,0 +1,43 @@
+package org.openapitools.client.infrastructure
+
+enum class ResponseType {
+    Success, Informational, Redirection, ClientError, ServerError
+}
+
+interface Response
+
+abstract class ApiInfrastructureResponse<T>(val responseType: ResponseType): Response {
+    abstract val statusCode: Int
+    abstract val headers: Map<String,List<String>>
+}
+
+class Success<T>(
+    val data: T,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+): ApiInfrastructureResponse<T>(ResponseType.Success)
+
+class Informational<T>(
+    val statusText: String,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Informational)
+
+class Redirection<T>(
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Redirection)
+
+class ClientError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.ClientError)
+
+class ServerError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>>
+): ApiInfrastructureResponse<T>(ResponseType.ServerError)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
new file mode 100644
index 0000000000000000000000000000000000000000..dd34bd48b2c01a3b2cc449fd1952635bfb9c0c85
--- /dev/null
+++ b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
@@ -0,0 +1,29 @@
+package org.openapitools.client.infrastructure
+
+import kotlin.properties.ReadWriteProperty
+import kotlin.reflect.KProperty
+
+object ApplicationDelegates {
+    /**
+     * Provides a property delegate, allowing the property to be set once and only once.
+     *
+     * If unset (no default value), a get on the property will throw [IllegalStateException].
+     */
+    fun <T> setOnce(defaultValue: T? = null) : ReadWriteProperty<Any?, T> = SetOnce(defaultValue)
+
+    private class SetOnce<T>(defaultValue: T? = null) : ReadWriteProperty<Any?, T> {
+        private var isSet = false
+        private var value: T? = defaultValue
+
+        override fun getValue(thisRef: Any?, property: KProperty<*>): T {
+            return value ?: throw IllegalStateException("${property.name} not initialized")
+        }
+
+        override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) {
+            if (!isSet) {
+                this.value = value
+                isSet = true
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..fff39c7ac2430f8583273d0e3a386f5998aac6b9
--- /dev/null
+++ b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
@@ -0,0 +1,3 @@
+package org.openapitools.client.infrastructure
+
+
diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Errors.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b5310e71f13c7e7fb874be998af37dd424d9cd11
--- /dev/null
+++ b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Errors.kt
@@ -0,0 +1,18 @@
+@file:Suppress("unused")
+package org.openapitools.client.infrastructure
+
+import java.lang.RuntimeException
+
+open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 123L
+    }
+}
+
+open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 456L
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
new file mode 100644
index 0000000000000000000000000000000000000000..0f2790f370e29d3fceb044c2309dd945cd562eeb
--- /dev/null
+++ b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
@@ -0,0 +1,17 @@
+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<String,String> because rfc2616 defines
+ *       multi-valued headers as csv-only.
+ */
+data class RequestConfig(
+    val method: RequestMethod,
+    val path: String,
+    val headers: MutableMap<String, String> = mutableMapOf(),
+    val query: MutableMap<String, List<String>> = mutableMapOf(),
+    val body: kotlin.Any? = null
+)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt
new file mode 100644
index 0000000000000000000000000000000000000000..931b12b8bd7a6dba7362eaafc490edf709d14616
--- /dev/null
+++ b/samples/client/petstore/kotlin-jackson/bin/main/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
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9bd2790dc144a3794c7957fdff86c114e5570c99
--- /dev/null
+++ b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
@@ -0,0 +1,24 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Response
+
+/**
+ * Provides an extension to evaluation whether the response is a 1xx code
+ */
+val Response.isInformational : Boolean get() = this.code in 100..199
+
+/**
+ * Provides an extension to evaluation whether the response is a 3xx code
+ */
+@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
+val Response.isRedirect : Boolean get() = this.code in 300..399
+
+/**
+ * Provides an extension to evaluation whether the response is a 4xx code
+ */
+val Response.isClientError : Boolean get() = this.code in 400..499
+
+/**
+ * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code
+ */
+val Response.isServerError : Boolean get() = this.code in 500..999
diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Serializer.kt
new file mode 100644
index 0000000000000000000000000000000000000000..8b34e629c4ec2d5d825a96d88ef3713537c9a39a
--- /dev/null
+++ b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/infrastructure/Serializer.kt
@@ -0,0 +1,18 @@
+package org.openapitools.client.infrastructure
+
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.databind.SerializationFeature
+import com.fasterxml.jackson.datatype.jdk8.Jdk8Module
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
+import com.fasterxml.jackson.annotation.JsonInclude
+import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
+import java.util.Date
+
+object Serializer {
+    @JvmStatic
+    val jacksonObjectMapper: ObjectMapper = jacksonObjectMapper()
+        .registerModule(Jdk8Module())
+        .registerModule(JavaTimeModule())
+        .setSerializationInclusion(JsonInclude.Include.NON_ABSENT)
+        .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)
+}
diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/ApiResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..c341f8ca321b63499ff85a112be69dac80ddd6c8
--- /dev/null
+++ b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/ApiResponse.kt
@@ -0,0 +1,32 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.fasterxml.jackson.annotation.JsonProperty
+
+/**
+ * Describes the result of uploading an image resource
+ * @param code 
+ * @param type 
+ * @param message 
+ */
+
+data class ApiResponse (
+    @field:JsonProperty("code")
+    val code: kotlin.Int? = null,
+    @field:JsonProperty("type")
+    val type: kotlin.String? = null,
+    @field:JsonProperty("message")
+    val message: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Category.kt
new file mode 100644
index 0000000000000000000000000000000000000000..2ed5390c1f3a0a5a5bd79d147c8b8d200ae99c0a
--- /dev/null
+++ b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Category.kt
@@ -0,0 +1,29 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.fasterxml.jackson.annotation.JsonProperty
+
+/**
+ * A category for a pet
+ * @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/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Order.kt
new file mode 100644
index 0000000000000000000000000000000000000000..c7df5b55614b4be4a143d4349cad22304966c865
--- /dev/null
+++ b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Order.kt
@@ -0,0 +1,54 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.fasterxml.jackson.annotation.JsonProperty
+
+/**
+ * An order for a pets from the pet store
+ * @param id 
+ * @param petId 
+ * @param quantity 
+ * @param shipDate 
+ * @param status Order Status
+ * @param complete 
+ */
+
+data class Order (
+    @field:JsonProperty("id")
+    val id: kotlin.Long? = null,
+    @field:JsonProperty("petId")
+    val petId: kotlin.Long? = null,
+    @field:JsonProperty("quantity")
+    val quantity: kotlin.Int? = null,
+    @field:JsonProperty("shipDate")
+    val shipDate: java.time.OffsetDateTime? = null,
+    /* Order Status */
+    @field:JsonProperty("status")
+    val status: Order.Status? = null,
+    @field:JsonProperty("complete")
+    val complete: kotlin.Boolean? = null
+) {
+
+    /**
+    * Order Status
+    * Values: PLACED,APPROVED,DELIVERED
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @JsonProperty(value = "placed") PLACED("placed"),
+        @JsonProperty(value = "approved") APPROVED("approved"),
+        @JsonProperty(value = "delivered") DELIVERED("delivered");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Pet.kt
new file mode 100644
index 0000000000000000000000000000000000000000..be5b168e2d8b60cc24185d1ae08ce992ef8ba654
--- /dev/null
+++ b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Pet.kt
@@ -0,0 +1,56 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+import org.openapitools.client.models.Category
+import org.openapitools.client.models.Tag
+
+import com.fasterxml.jackson.annotation.JsonProperty
+
+/**
+ * A pet for sale in the pet store
+ * @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<kotlin.String>,
+    @field:JsonProperty("id")
+    val id: kotlin.Long? = null,
+    @field:JsonProperty("category")
+    val category: Category? = null,
+    @field:JsonProperty("tags")
+    val tags: kotlin.collections.List<Tag>? = null,
+    /* pet status in the store */
+    @field:JsonProperty("status")
+    val status: Pet.Status? = null
+) {
+
+    /**
+    * pet status in the store
+    * Values: AVAILABLE,PENDING,SOLD
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @JsonProperty(value = "available") AVAILABLE("available"),
+        @JsonProperty(value = "pending") PENDING("pending"),
+        @JsonProperty(value = "sold") SOLD("sold");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Tag.kt
new file mode 100644
index 0000000000000000000000000000000000000000..7243f42ed7d8d43d3c89189898e3a4891e71d0e6
--- /dev/null
+++ b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/Tag.kt
@@ -0,0 +1,29 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.fasterxml.jackson.annotation.JsonProperty
+
+/**
+ * A tag for a pet
+ * @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/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/User.kt
new file mode 100644
index 0000000000000000000000000000000000000000..e8f639e5092839f41dc62575d2574e46505f414b
--- /dev/null
+++ b/samples/client/petstore/kotlin-jackson/bin/main/org/openapitools/client/models/User.kt
@@ -0,0 +1,48 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.fasterxml.jackson.annotation.JsonProperty
+
+/**
+ * A User who is purchasing from the pet store
+ * @param id 
+ * @param username 
+ * @param firstName 
+ * @param lastName 
+ * @param email 
+ * @param password 
+ * @param phone 
+ * @param userStatus User Status
+ */
+
+data class User (
+    @field:JsonProperty("id")
+    val id: kotlin.Long? = null,
+    @field:JsonProperty("username")
+    val username: kotlin.String? = null,
+    @field:JsonProperty("firstName")
+    val firstName: kotlin.String? = null,
+    @field:JsonProperty("lastName")
+    val lastName: kotlin.String? = null,
+    @field:JsonProperty("email")
+    val email: kotlin.String? = null,
+    @field:JsonProperty("password")
+    val password: kotlin.String? = null,
+    @field:JsonProperty("phone")
+    val phone: kotlin.String? = null,
+    /* User Status */
+    @field:JsonProperty("userStatus")
+    val userStatus: kotlin.Int? = null
+)
+
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/PetApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..d939e3d5a43eb702caddcf7996db3a489d0a0c22
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/PetApi.kt
@@ -0,0 +1,494 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.ApiResponse
+import org.openapitools.client.models.Pet
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Add a new pet to the store
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun addPet(body: Pet) : Unit {
+        val localVariableConfig = addPetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation addPet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun addPetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Deletes a pet
+    * 
+    * @param petId Pet id to delete 
+    * @param apiKey  (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
+        val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deletePet
+    *
+    * @param petId Pet id to delete 
+    * @param apiKey  (optional)
+    * @return RequestConfig
+    */
+    fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by tags
+    * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+    * @param tags Tags to filter by 
+    * @return kotlin.collections.List<Pet>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
+        val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByTags
+    *
+    * @param tags Tags to filter by 
+    * @return RequestConfig
+    */
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("tags", toMultiValue(tags.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByTags",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Get all pets
+    * 
+    * @param lastUpdated When this endpoint was hit last to help indentify if the client already has the latest copy. (optional)
+    * @return kotlin.collections.List<Pet>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getAllPets(lastUpdated: java.time.OffsetDateTime?) : kotlin.collections.List<Pet> {
+        val localVariableConfig = getAllPetsRequestConfig(lastUpdated = lastUpdated)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getAllPets
+    *
+    * @param lastUpdated When this endpoint was hit last to help indentify if the client already has the latest copy. (optional)
+    * @return RequestConfig
+    */
+    fun getAllPetsRequestConfig(lastUpdated: java.time.OffsetDateTime?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                if (lastUpdated != null) {
+                    put("lastUpdated", listOf(parseDateToQueryString(lastUpdated)))
+                }
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/getAll",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find pet by ID
+    * Returns a single pet
+    * @param petId ID of pet to return 
+    * @return Pet
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getPetById(petId: kotlin.Long) : Pet {
+        val localVariableConfig = getPetByIdRequestConfig(petId = petId)
+
+        val localVarResponse = request<Pet>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Pet
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getPetById
+    *
+    * @param petId ID of pet to return 
+    * @return RequestConfig
+    */
+    fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Update an existing pet
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updatePet(body: Pet) : Unit {
+        val localVariableConfig = updatePetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun updatePetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updates a pet in the store with form data
+    * 
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
+        val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePetWithForm
+    *
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return RequestConfig
+    */
+    fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * uploads an image
+    * 
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return ApiResponse
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
+        val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
+
+        val localVarResponse = request<ApiResponse>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation uploadFile
+    *
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return RequestConfig
+    */
+    fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/StoreApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..215ed63420c9d538efe258fcc1244627caa4b8e1
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/StoreApi.kt
@@ -0,0 +1,253 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.Order
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Delete purchase order by ID
+    * For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
+    * @param orderId ID of the order that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deleteOrder(orderId: kotlin.String) : Unit {
+        val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteOrder
+    *
+    * @param orderId ID of the order that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Returns pet inventories by status
+    * Returns a map of status codes to quantities
+    * @return kotlin.collections.Map<kotlin.String, kotlin.Int>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
+        val localVariableConfig = getInventoryRequestConfig()
+
+        val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map<kotlin.String, kotlin.Int>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getInventory
+    *
+    * @return RequestConfig
+    */
+    fun getInventoryRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/inventory",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find purchase order by ID
+    * For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
+    * @param orderId ID of pet that needs to be fetched 
+    * @return Order
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getOrderById(orderId: kotlin.Long) : Order {
+        val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getOrderById
+    *
+    * @param orderId ID of pet that needs to be fetched 
+    * @return RequestConfig
+    */
+    fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Place an order for a pet
+    * 
+    * @param body order placed for purchasing the pet 
+    * @return Order
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun placeOrder(body: Order) : Order {
+        val localVariableConfig = placeOrderRequestConfig(body = body)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation placeOrder
+    *
+    * @param body order placed for purchasing the pet 
+    * @return RequestConfig
+    */
+    fun placeOrderRequestConfig(body: Order) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/store/order",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/UserApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..53748b934636efed3e534dcce15de3d659631c0e
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/apis/UserApi.kt
@@ -0,0 +1,476 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.User
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Create user
+    * This can only be done by the logged in user.
+    * @param body Created user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUser(body: User) : Unit {
+        val localVariableConfig = createUserRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUser
+    *
+    * @param body Created user object 
+    * @return RequestConfig
+    */
+    fun createUserRequestConfig(body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithArrayInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithArray",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithListInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithList",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Delete user
+    * This can only be done by the logged in user.
+    * @param username The name that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deleteUser(username: kotlin.String) : Unit {
+        val localVariableConfig = deleteUserRequestConfig(username = username)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteUser
+    *
+    * @param username The name that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Get user by user name
+    * 
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return User
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getUserByName(username: kotlin.String) : User {
+        val localVariableConfig = getUserByNameRequestConfig(username = username)
+
+        val localVarResponse = request<User>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as User
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getUserByName
+    *
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return RequestConfig
+    */
+    fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs user into the system
+    * 
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return kotlin.String
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
+        val localVariableConfig = loginUserRequestConfig(username = username, password = password)
+
+        val localVarResponse = request<kotlin.String>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation loginUser
+    *
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return RequestConfig
+    */
+    fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("username", listOf(username.toString()))
+                put("password", listOf(password.toString()))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/login",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs out current logged in user session
+    * 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun logoutUser() : Unit {
+        val localVariableConfig = logoutUserRequestConfig()
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation logoutUser
+    *
+    * @return RequestConfig
+    */
+    fun logoutUserRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/logout",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updated user
+    * This can only be done by the logged in user.
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updateUser(username: kotlin.String, body: User) : Unit {
+        val localVariableConfig = updateUserRequestConfig(username = username, body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updateUser
+    *
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return RequestConfig
+    */
+    fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ef7a8f1e1a625f7efdbea17077de86da8e09f805
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
@@ -0,0 +1,23 @@
+package org.openapitools.client.infrastructure
+
+typealias MultiValueMap = MutableMap<String,List<String>>
+
+fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
+    "csv" -> ","
+    "tsv" -> "\t"
+    "pipe" -> "|"
+    "space" -> " "
+    else -> ""
+}
+
+val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
+
+fun <T : Any?> toMultiValue(items: Array<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter)
+        = toMultiValue(items.asIterable(), collectionFormat, map)
+
+fun <T : Any?> toMultiValue(items: Iterable<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String> {
+    return when(collectionFormat) {
+        "multi" -> items.map(map)
+        else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map))
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
new file mode 100644
index 0000000000000000000000000000000000000000..e1d5bc9c412cde367be4b9b41257935f1acb7f7b
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
@@ -0,0 +1,245 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Credentials
+import okhttp3.OkHttpClient
+import okhttp3.RequestBody
+import okhttp3.RequestBody.Companion.asRequestBody
+import okhttp3.RequestBody.Companion.toRequestBody
+import okhttp3.FormBody
+import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
+import okhttp3.ResponseBody
+import okhttp3.MediaType.Companion.toMediaTypeOrNull
+import okhttp3.Request
+import okhttp3.Headers
+import okhttp3.MultipartBody
+import java.io.File
+import java.net.URLConnection
+import java.util.Date
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.LocalTime
+import java.time.OffsetDateTime
+import java.time.OffsetTime
+
+open class ApiClient(val baseUrl: String) {
+    companion object {
+        protected const val ContentType = "Content-Type"
+        protected const val Accept = "Accept"
+        protected const val Authorization = "Authorization"
+        protected const val JsonMediaType = "application/json"
+        protected const val FormDataMediaType = "multipart/form-data"
+        protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded"
+        protected const val XmlMediaType = "application/xml"
+
+        val apiKey: MutableMap<String, String> = mutableMapOf()
+        val apiKeyPrefix: MutableMap<String, String> = mutableMapOf()
+        var username: String? = null
+        var password: String? = null
+        var accessToken: String? = null
+
+        @JvmStatic
+        val client: OkHttpClient by lazy {
+            builder.build()
+        }
+
+        @JvmStatic
+        val builder: OkHttpClient.Builder = OkHttpClient.Builder()
+    }
+
+    /**
+     * Guess Content-Type header from the given file (defaults to "application/octet-stream").
+     *
+     * @param file The given file
+     * @return The guessed Content-Type
+     */
+    protected fun guessContentTypeFromFile(file: File): String {
+        val contentType = URLConnection.guessContentTypeFromName(file.name)
+        return contentType ?: "application/octet-stream"
+    }
+
+    protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
+        when {
+            content is File -> content.asRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == FormDataMediaType -> {
+                MultipartBody.Builder()
+                    .setType(MultipartBody.FORM)
+                    .apply {
+                        // content's type *must* be Map<String, Any?>
+                        @Suppress("UNCHECKED_CAST")
+                        (content as Map<String, Any?>).forEach { (key, value) ->
+                            if (value is File) {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\"; filename=\"${value.name}\""
+                                )
+                                val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull()
+                                addPart(partHeaders, value.asRequestBody(fileMediaType))
+                            } else {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\""
+                                )
+                                addPart(
+                                    partHeaders,
+                                    parameterToString(value).toRequestBody(null)
+                                )
+                            }
+                        }
+                    }.build()
+            }
+            mediaType == FormUrlEncMediaType -> {
+                FormBody.Builder().apply {
+                    // content's type *must* be Map<String, Any?>
+                    @Suppress("UNCHECKED_CAST")
+                    (content as Map<String, Any?>).forEach { (key, value) ->
+                        add(key, parameterToString(value))
+                    }
+                }.build()
+            }
+            mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
+            // TODO: this should be extended with other serializers
+            else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.")
+        }
+
+    protected inline fun <reified T: Any?> responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? {
+        if(body == null) {
+            return null
+        }
+        val bodyContent = body.string()
+        if (bodyContent.isEmpty()) {
+            return null
+        }
+        return when(mediaType) {
+            JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent)
+            else ->  throw UnsupportedOperationException("responseBody currently only supports JSON body.")
+        }
+    }
+
+    protected fun updateAuthParams(requestConfig: RequestConfig) {
+        if (requestConfig.headers["api_key"].isNullOrEmpty()) {
+            if (apiKey["api_key"] != null) {
+                if (apiKeyPrefix["api_key"] != null) {
+                    requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!
+                } else {
+                    requestConfig.headers["api_key"] = apiKey["api_key"]!!
+                }
+            }
+        }
+        if (requestConfig.headers[Authorization].isNullOrEmpty()) {
+            accessToken?.let { accessToken ->
+                requestConfig.headers[Authorization] = "Bearer $accessToken "
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
+        val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
+
+        // take authMethod from operation
+        updateAuthParams(requestConfig)
+
+        val url = httpUrl.newBuilder()
+            .addPathSegments(requestConfig.path.trimStart('/'))
+            .apply {
+                requestConfig.query.forEach { query ->
+                    query.value.forEach { queryValue ->
+                        addQueryParameter(query.key, queryValue)
+                    }
+                }
+            }.build()
+
+        // take content-type/accept from spec or set to default (application/json) if not defined
+        if (requestConfig.headers[ContentType].isNullOrEmpty()) {
+            requestConfig.headers[ContentType] = JsonMediaType
+        }
+        if (requestConfig.headers[Accept].isNullOrEmpty()) {
+            requestConfig.headers[Accept] = JsonMediaType
+        }
+        val headers = requestConfig.headers
+
+        if(headers[ContentType] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Content-Type header. This is required.")
+        }
+
+        if(headers[Accept] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Accept header. This is required.")
+        }
+
+        // TODO: support multiple contentType options here.
+        val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
+
+        val request = when (requestConfig.method) {
+            RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
+            RequestMethod.GET -> Request.Builder().url(url)
+            RequestMethod.HEAD -> Request.Builder().url(url).head()
+            RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
+            RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
+            RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
+            RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
+        }.apply {
+            headers.forEach { header -> addHeader(header.key, header.value) }
+        }.build()
+
+        val response = client.newCall(request).execute()
+        val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
+
+        // TODO: handle specific mapping types. e.g. Map<int, Class<?>>
+        when {
+            response.isRedirect -> return Redirection(
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isInformational -> return Informational(
+                    response.message,
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isSuccessful -> return Success(
+                    responseBody(response.body, accept),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isClientError -> return ClientError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            else -> return ServerError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+        }
+    }
+
+    protected fun parameterToString(value: Any?): String {
+        when (value) {
+            null -> {
+                return ""
+            }
+            is Array<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is Iterable<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
+                return parseDateToQueryString<Any>(value)
+            }
+            else -> {
+                return value.toString()
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any> parseDateToQueryString(value : T): String {
+        return value.toString()
+    }
+}
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9dc8d8dbbfaaef4f86a4f65b8a908ba9e4507060
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
@@ -0,0 +1,43 @@
+package org.openapitools.client.infrastructure
+
+enum class ResponseType {
+    Success, Informational, Redirection, ClientError, ServerError
+}
+
+interface Response
+
+abstract class ApiInfrastructureResponse<T>(val responseType: ResponseType): Response {
+    abstract val statusCode: Int
+    abstract val headers: Map<String,List<String>>
+}
+
+class Success<T>(
+    val data: T,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+): ApiInfrastructureResponse<T>(ResponseType.Success)
+
+class Informational<T>(
+    val statusText: String,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Informational)
+
+class Redirection<T>(
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Redirection)
+
+class ClientError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.ClientError)
+
+class ServerError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>>
+): ApiInfrastructureResponse<T>(ResponseType.ServerError)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
new file mode 100644
index 0000000000000000000000000000000000000000..dd34bd48b2c01a3b2cc449fd1952635bfb9c0c85
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
@@ -0,0 +1,29 @@
+package org.openapitools.client.infrastructure
+
+import kotlin.properties.ReadWriteProperty
+import kotlin.reflect.KProperty
+
+object ApplicationDelegates {
+    /**
+     * Provides a property delegate, allowing the property to be set once and only once.
+     *
+     * If unset (no default value), a get on the property will throw [IllegalStateException].
+     */
+    fun <T> setOnce(defaultValue: T? = null) : ReadWriteProperty<Any?, T> = SetOnce(defaultValue)
+
+    private class SetOnce<T>(defaultValue: T? = null) : ReadWriteProperty<Any?, T> {
+        private var isSet = false
+        private var value: T? = defaultValue
+
+        override fun getValue(thisRef: Any?, property: KProperty<*>): T {
+            return value ?: throw IllegalStateException("${property.name} not initialized")
+        }
+
+        override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) {
+            if (!isSet) {
+                this.value = value
+                isSet = true
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ff5e2a81ee8ce2677c90a56384c165450f0c5b18
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
@@ -0,0 +1,12 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+
+class ByteArrayAdapter {
+    @ToJson
+    fun toJson(data: ByteArray): String = String(data)
+
+    @FromJson
+    fun fromJson(data: String): ByteArray = data.toByteArray()
+}
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Errors.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b5310e71f13c7e7fb874be998af37dd424d9cd11
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Errors.kt
@@ -0,0 +1,18 @@
+@file:Suppress("unused")
+package org.openapitools.client.infrastructure
+
+import java.lang.RuntimeException
+
+open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 123L
+    }
+}
+
+open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 456L
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b2e1654479a01d0c02930408910cc70d93f16c9d
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.LocalDate
+import java.time.format.DateTimeFormatter
+
+class LocalDateAdapter {
+    @ToJson
+    fun toJson(value: LocalDate): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDate {
+        return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..e082db94811d386498db8b1cd56cf58af82bad56
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
+
+class LocalDateTimeAdapter {
+    @ToJson
+    fun toJson(value: LocalDateTime): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDateTime {
+        return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..87437871a31e6ae83dca8573985f7d178ce6f3e6
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.OffsetDateTime
+import java.time.format.DateTimeFormatter
+
+class OffsetDateTimeAdapter {
+    @ToJson
+    fun toJson(value: OffsetDateTime): String {
+        return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): OffsetDateTime {
+        return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
new file mode 100644
index 0000000000000000000000000000000000000000..0f2790f370e29d3fceb044c2309dd945cd562eeb
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
@@ -0,0 +1,17 @@
+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<String,String> because rfc2616 defines
+ *       multi-valued headers as csv-only.
+ */
+data class RequestConfig(
+    val method: RequestMethod,
+    val path: String,
+    val headers: MutableMap<String, String> = mutableMapOf(),
+    val query: MutableMap<String, List<String>> = mutableMapOf(),
+    val body: kotlin.Any? = null
+)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt
new file mode 100644
index 0000000000000000000000000000000000000000..931b12b8bd7a6dba7362eaafc490edf709d14616
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/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
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9bd2790dc144a3794c7957fdff86c114e5570c99
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
@@ -0,0 +1,24 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Response
+
+/**
+ * Provides an extension to evaluation whether the response is a 1xx code
+ */
+val Response.isInformational : Boolean get() = this.code in 100..199
+
+/**
+ * Provides an extension to evaluation whether the response is a 3xx code
+ */
+@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
+val Response.isRedirect : Boolean get() = this.code in 300..399
+
+/**
+ * Provides an extension to evaluation whether the response is a 4xx code
+ */
+val Response.isClientError : Boolean get() = this.code in 400..499
+
+/**
+ * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code
+ */
+val Response.isServerError : Boolean get() = this.code in 500..999
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9a45b67d9b1a435f1ebfa35c6d6c0fd329cea27b
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt
@@ -0,0 +1,21 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.Moshi
+import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
+import java.util.Date
+
+object Serializer {
+    @JvmStatic
+    val moshiBuilder: Moshi.Builder = Moshi.Builder()
+        .add(OffsetDateTimeAdapter())
+        .add(LocalDateTimeAdapter())
+        .add(LocalDateAdapter())
+        .add(UUIDAdapter())
+        .add(ByteArrayAdapter())
+        .add(KotlinJsonAdapterFactory())
+
+    @JvmStatic
+    val moshi: Moshi by lazy {
+        moshiBuilder.build()
+    }
+}
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a4a44cc18b73e4a0ec722fa385e0276dbfbac670
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
@@ -0,0 +1,13 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.util.UUID
+
+class UUIDAdapter {
+    @ToJson
+    fun toJson(uuid: UUID) = uuid.toString()
+
+    @FromJson
+    fun fromJson(s: String) = UUID.fromString(s)
+}
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/ApiResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..fafca8738f663b840b5a6a005cf320c5f0aa1a68
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/ApiResponse.kt
@@ -0,0 +1,32 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * Describes the result of uploading an image resource
+ * @param code 
+ * @param type 
+ * @param message 
+ */
+
+data class ApiResponse (
+    @Json(name = "code")
+    val code: kotlin.Int? = null,
+    @Json(name = "type")
+    val type: kotlin.String? = null,
+    @Json(name = "message")
+    val message: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Category.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a4c17c3b49ddf7328874d853f6022b5f80ac057c
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Category.kt
@@ -0,0 +1,29 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * A category for a pet
+ * @param id 
+ * @param name 
+ */
+
+data class Category (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "name")
+    val name: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Order.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a66c335904e714f99a07894143f35bb08a602712
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Order.kt
@@ -0,0 +1,54 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * An order for a pets from the pet store
+ * @param id 
+ * @param petId 
+ * @param quantity 
+ * @param shipDate 
+ * @param status Order Status
+ * @param complete 
+ */
+
+data class Order (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "petId")
+    val petId: kotlin.Long? = null,
+    @Json(name = "quantity")
+    val quantity: kotlin.Int? = null,
+    @Json(name = "shipDate")
+    val shipDate: java.time.OffsetDateTime? = null,
+    /* Order Status */
+    @Json(name = "status")
+    val status: Order.Status? = null,
+    @Json(name = "complete")
+    val complete: kotlin.Boolean? = null
+) {
+
+    /**
+    * Order Status
+    * Values: placed,approved,delivered
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @Json(name = "placed") placed("placed"),
+        @Json(name = "approved") approved("approved"),
+        @Json(name = "delivered") delivered("delivered");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Pet.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a3df06cb6eb3c1cd1ab6e0e4e083304f44ddb73e
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Pet.kt
@@ -0,0 +1,56 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+import org.openapitools.client.models.Category
+import org.openapitools.client.models.Tag
+
+import com.squareup.moshi.Json
+
+/**
+ * A pet for sale in the pet store
+ * @param name 
+ * @param photoUrls 
+ * @param id 
+ * @param category 
+ * @param tags 
+ * @param status pet status in the store
+ */
+
+data class Pet (
+    @Json(name = "name")
+    val name: kotlin.String,
+    @Json(name = "photoUrls")
+    val photoUrls: kotlin.collections.List<kotlin.String>,
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "category")
+    val category: Category? = null,
+    @Json(name = "tags")
+    val tags: kotlin.collections.List<Tag>? = null,
+    /* pet status in the store */
+    @Json(name = "status")
+    val status: Pet.Status? = null
+) {
+
+    /**
+    * pet status in the store
+    * Values: available,pending,sold
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @Json(name = "available") available("available"),
+        @Json(name = "pending") pending("pending"),
+        @Json(name = "sold") sold("sold");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Tag.kt
new file mode 100644
index 0000000000000000000000000000000000000000..6e619023a5c95599835a7a618d17f6e6813fae53
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/Tag.kt
@@ -0,0 +1,29 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * A tag for a pet
+ * @param id 
+ * @param name 
+ */
+
+data class Tag (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "name")
+    val name: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/User.kt
new file mode 100644
index 0000000000000000000000000000000000000000..af1e270325de4659cbfaaa68c2074ea309e1ef5b
--- /dev/null
+++ b/samples/client/petstore/kotlin-json-request-string/bin/main/org/openapitools/client/models/User.kt
@@ -0,0 +1,48 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * A User who is purchasing from the pet store
+ * @param id 
+ * @param username 
+ * @param firstName 
+ * @param lastName 
+ * @param email 
+ * @param password 
+ * @param phone 
+ * @param userStatus User Status
+ */
+
+data class User (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "username")
+    val username: kotlin.String? = null,
+    @Json(name = "firstName")
+    val firstName: kotlin.String? = null,
+    @Json(name = "lastName")
+    val lastName: kotlin.String? = null,
+    @Json(name = "email")
+    val email: kotlin.String? = null,
+    @Json(name = "password")
+    val password: kotlin.String? = null,
+    @Json(name = "phone")
+    val phone: kotlin.String? = null,
+    /* User Status */
+    @Json(name = "userStatus")
+    val userStatus: kotlin.Int? = null
+)
+
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/PetApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..78223583f6456f29a8d6c8cea45ce15f4fe37b6a
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/PetApi.kt
@@ -0,0 +1,492 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.ApiResponse
+import org.openapitools.client.models.Pet
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Add a new pet to the store
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    suspend fun addPet(body: Pet) : Unit {
+        val localVariableConfig = addPetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation addPet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun addPetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Deletes a pet
+    * 
+    * @param petId Pet id to delete 
+    * @param apiKey  (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
+        val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deletePet
+    *
+    * @param petId Pet id to delete 
+    * @param apiKey  (optional)
+    * @return RequestConfig
+    */
+    fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by status
+    * Multiple status values can be provided with comma separated strings
+    * @param status Status values that need to be considered for filter 
+    * @return kotlin.collections.List<Pet>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    suspend fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
+        val localVariableConfig = findPetsByStatusRequestConfig(status = status)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByStatus
+    *
+    * @param status Status values that need to be considered for filter 
+    * @return RequestConfig
+    */
+    fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("status", toMultiValue(status.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByStatus",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by tags
+    * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+    * @param tags Tags to filter by 
+    * @return kotlin.collections.List<Pet>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    @Deprecated(message = "This operation is deprecated.")
+    suspend fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
+        val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByTags
+    *
+    * @param tags Tags to filter by 
+    * @return RequestConfig
+    */
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("tags", toMultiValue(tags.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByTags",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find pet by ID
+    * Returns a single pet
+    * @param petId ID of pet to return 
+    * @return Pet
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    suspend fun getPetById(petId: kotlin.Long) : Pet {
+        val localVariableConfig = getPetByIdRequestConfig(petId = petId)
+
+        val localVarResponse = request<Pet>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Pet
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getPetById
+    *
+    * @param petId ID of pet to return 
+    * @return RequestConfig
+    */
+    fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Update an existing pet
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    suspend fun updatePet(body: Pet) : Unit {
+        val localVariableConfig = updatePetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun updatePetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updates a pet in the store with form data
+    * 
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
+        val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePetWithForm
+    *
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return RequestConfig
+    */
+    fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * uploads an image
+    * 
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return ApiResponse
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
+        val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
+
+        val localVarResponse = request<ApiResponse>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation uploadFile
+    *
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return RequestConfig
+    */
+    fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/StoreApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..4ab794d66081a4dbf093027093c7f9a0f24e64dd
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/StoreApi.kt
@@ -0,0 +1,253 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.Order
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Delete purchase order by ID
+    * For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
+    * @param orderId ID of the order that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    suspend fun deleteOrder(orderId: kotlin.String) : Unit {
+        val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteOrder
+    *
+    * @param orderId ID of the order that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Returns pet inventories by status
+    * Returns a map of status codes to quantities
+    * @return kotlin.collections.Map<kotlin.String, kotlin.Int>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    suspend fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
+        val localVariableConfig = getInventoryRequestConfig()
+
+        val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map<kotlin.String, kotlin.Int>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getInventory
+    *
+    * @return RequestConfig
+    */
+    fun getInventoryRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/inventory",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find purchase order by ID
+    * For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
+    * @param orderId ID of pet that needs to be fetched 
+    * @return Order
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    suspend fun getOrderById(orderId: kotlin.Long) : Order {
+        val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getOrderById
+    *
+    * @param orderId ID of pet that needs to be fetched 
+    * @return RequestConfig
+    */
+    fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Place an order for a pet
+    * 
+    * @param body order placed for purchasing the pet 
+    * @return Order
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    suspend fun placeOrder(body: Order) : Order {
+        val localVariableConfig = placeOrderRequestConfig(body = body)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation placeOrder
+    *
+    * @param body order placed for purchasing the pet 
+    * @return RequestConfig
+    */
+    fun placeOrderRequestConfig(body: Order) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/store/order",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/UserApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..911bbee5b6b30fc3c28b40617af84de19e4c7ea5
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/apis/UserApi.kt
@@ -0,0 +1,476 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.User
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Create user
+    * This can only be done by the logged in user.
+    * @param body Created user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    suspend fun createUser(body: User) : Unit {
+        val localVariableConfig = createUserRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUser
+    *
+    * @param body Created user object 
+    * @return RequestConfig
+    */
+    fun createUserRequestConfig(body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    suspend fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithArrayInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithArray",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    suspend fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithListInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithList",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Delete user
+    * This can only be done by the logged in user.
+    * @param username The name that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    suspend fun deleteUser(username: kotlin.String) : Unit {
+        val localVariableConfig = deleteUserRequestConfig(username = username)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteUser
+    *
+    * @param username The name that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Get user by user name
+    * 
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return User
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    suspend fun getUserByName(username: kotlin.String) : User {
+        val localVariableConfig = getUserByNameRequestConfig(username = username)
+
+        val localVarResponse = request<User>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as User
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getUserByName
+    *
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return RequestConfig
+    */
+    fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs user into the system
+    * 
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return kotlin.String
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    suspend fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
+        val localVariableConfig = loginUserRequestConfig(username = username, password = password)
+
+        val localVarResponse = request<kotlin.String>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation loginUser
+    *
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return RequestConfig
+    */
+    fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("username", listOf(username.toString()))
+                put("password", listOf(password.toString()))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/login",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs out current logged in user session
+    * 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    suspend fun logoutUser() : Unit {
+        val localVariableConfig = logoutUserRequestConfig()
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation logoutUser
+    *
+    * @return RequestConfig
+    */
+    fun logoutUserRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/logout",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updated user
+    * This can only be done by the logged in user.
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    suspend fun updateUser(username: kotlin.String, body: User) : Unit {
+        val localVariableConfig = updateUserRequestConfig(username = username, body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updateUser
+    *
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return RequestConfig
+    */
+    fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ef7a8f1e1a625f7efdbea17077de86da8e09f805
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
@@ -0,0 +1,23 @@
+package org.openapitools.client.infrastructure
+
+typealias MultiValueMap = MutableMap<String,List<String>>
+
+fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
+    "csv" -> ","
+    "tsv" -> "\t"
+    "pipe" -> "|"
+    "space" -> " "
+    else -> ""
+}
+
+val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
+
+fun <T : Any?> toMultiValue(items: Array<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter)
+        = toMultiValue(items.asIterable(), collectionFormat, map)
+
+fun <T : Any?> toMultiValue(items: Iterable<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String> {
+    return when(collectionFormat) {
+        "multi" -> items.map(map)
+        else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map))
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
new file mode 100644
index 0000000000000000000000000000000000000000..bcbb1cf862732a87a37224fa6806a98a8776c94f
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
@@ -0,0 +1,251 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Credentials
+import okhttp3.OkHttpClient
+import okhttp3.RequestBody
+import okhttp3.RequestBody.Companion.asRequestBody
+import okhttp3.RequestBody.Companion.toRequestBody
+import okhttp3.FormBody
+import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
+import okhttp3.ResponseBody
+import okhttp3.MediaType.Companion.toMediaTypeOrNull
+import okhttp3.Request
+import okhttp3.Headers
+import okhttp3.MultipartBody
+import java.io.File
+import java.net.URLConnection
+import java.util.Date
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.LocalTime
+import java.time.OffsetDateTime
+import java.time.OffsetTime
+
+open class ApiClient(val baseUrl: String) {
+    companion object {
+        protected const val ContentType = "Content-Type"
+        protected const val Accept = "Accept"
+        protected const val Authorization = "Authorization"
+        protected const val JsonMediaType = "application/json"
+        protected const val FormDataMediaType = "multipart/form-data"
+        protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded"
+        protected const val XmlMediaType = "application/xml"
+
+        val apiKey: MutableMap<String, String> = mutableMapOf()
+        val apiKeyPrefix: MutableMap<String, String> = mutableMapOf()
+        var username: String? = null
+        var password: String? = null
+        var accessToken: String? = null
+
+        @JvmStatic
+        val client: OkHttpClient by lazy {
+            builder.build()
+        }
+
+        @JvmStatic
+        val builder: OkHttpClient.Builder = OkHttpClient.Builder()
+    }
+
+    /**
+     * Guess Content-Type header from the given file (defaults to "application/octet-stream").
+     *
+     * @param file The given file
+     * @return The guessed Content-Type
+     */
+    protected fun guessContentTypeFromFile(file: File): String {
+        val contentType = URLConnection.guessContentTypeFromName(file.name)
+        return contentType ?: "application/octet-stream"
+    }
+
+    protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
+        when {
+            content is File -> content.asRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == FormDataMediaType -> {
+                MultipartBody.Builder()
+                    .setType(MultipartBody.FORM)
+                    .apply {
+                        // content's type *must* be Map<String, Any?>
+                        @Suppress("UNCHECKED_CAST")
+                        (content as Map<String, Any?>).forEach { (key, value) ->
+                            if (value is File) {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\"; filename=\"${value.name}\""
+                                )
+                                val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull()
+                                addPart(partHeaders, value.asRequestBody(fileMediaType))
+                            } else {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\""
+                                )
+                                addPart(
+                                    partHeaders,
+                                    parameterToString(value).toRequestBody(null)
+                                )
+                            }
+                        }
+                    }.build()
+            }
+            mediaType == FormUrlEncMediaType -> {
+                FormBody.Builder().apply {
+                    // content's type *must* be Map<String, Any?>
+                    @Suppress("UNCHECKED_CAST")
+                    (content as Map<String, Any?>).forEach { (key, value) ->
+                        add(key, parameterToString(value))
+                    }
+                }.build()
+            }
+            mediaType == JsonMediaType -> Serializer.gson.toJson(content, T::class.java).toRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
+            // TODO: this should be extended with other serializers
+            else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.")
+        }
+
+    protected inline fun <reified T: Any?> responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? {
+        if(body == null) {
+            return null
+        }
+        val bodyContent = body.string()
+        if (bodyContent.isEmpty()) {
+            return null
+        }
+        return when(mediaType) {
+            JsonMediaType -> Serializer.gson.fromJson(bodyContent, T::class.java)
+            else ->  throw UnsupportedOperationException("responseBody currently only supports JSON body.")
+        }
+    }
+
+    protected fun updateAuthParams(requestConfig: RequestConfig) {
+        if (requestConfig.headers["api_key"].isNullOrEmpty()) {
+            if (apiKey["api_key"] != null) {
+                if (apiKeyPrefix["api_key"] != null) {
+                    requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!
+                } else {
+                    requestConfig.headers["api_key"] = apiKey["api_key"]!!
+                }
+            }
+        }
+        if (requestConfig.headers[Authorization].isNullOrEmpty()) {
+            accessToken?.let { accessToken ->
+                requestConfig.headers[Authorization] = "Bearer $accessToken "
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
+        val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
+
+        // take authMethod from operation
+        updateAuthParams(requestConfig)
+
+        val url = httpUrl.newBuilder()
+            .addPathSegments(requestConfig.path.trimStart('/'))
+            .apply {
+                requestConfig.query.forEach { query ->
+                    query.value.forEach { queryValue ->
+                        addQueryParameter(query.key, queryValue)
+                    }
+                }
+            }.build()
+
+        // take content-type/accept from spec or set to default (application/json) if not defined
+        if (requestConfig.headers[ContentType].isNullOrEmpty()) {
+            requestConfig.headers[ContentType] = JsonMediaType
+        }
+        if (requestConfig.headers[Accept].isNullOrEmpty()) {
+            requestConfig.headers[Accept] = JsonMediaType
+        }
+        val headers = requestConfig.headers
+
+        if(headers[ContentType] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Content-Type header. This is required.")
+        }
+
+        if(headers[Accept] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Accept header. This is required.")
+        }
+
+        // TODO: support multiple contentType options here.
+        val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
+
+        val request = when (requestConfig.method) {
+            RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
+            RequestMethod.GET -> Request.Builder().url(url)
+            RequestMethod.HEAD -> Request.Builder().url(url).head()
+            RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
+            RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
+            RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
+            RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
+        }.apply {
+            headers.forEach { header -> addHeader(header.key, header.value) }
+        }.build()
+
+        val response = client.newCall(request).execute()
+        val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
+
+        // TODO: handle specific mapping types. e.g. Map<int, Class<?>>
+        when {
+            response.isRedirect -> return Redirection(
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isInformational -> return Informational(
+                    response.message,
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isSuccessful -> return Success(
+                    responseBody(response.body, accept),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isClientError -> return ClientError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            else -> return ServerError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+        }
+    }
+
+    protected fun parameterToString(value: Any?): String {
+        when (value) {
+            null -> {
+                return ""
+            }
+            is Array<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is Iterable<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
+                return parseDateToQueryString<Any>(value)
+            }
+            else -> {
+                return value.toString()
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any> 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.gson.toJson(value, T::class.java).replace("\"", "")
+    }
+}
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9dc8d8dbbfaaef4f86a4f65b8a908ba9e4507060
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
@@ -0,0 +1,43 @@
+package org.openapitools.client.infrastructure
+
+enum class ResponseType {
+    Success, Informational, Redirection, ClientError, ServerError
+}
+
+interface Response
+
+abstract class ApiInfrastructureResponse<T>(val responseType: ResponseType): Response {
+    abstract val statusCode: Int
+    abstract val headers: Map<String,List<String>>
+}
+
+class Success<T>(
+    val data: T,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+): ApiInfrastructureResponse<T>(ResponseType.Success)
+
+class Informational<T>(
+    val statusText: String,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Informational)
+
+class Redirection<T>(
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Redirection)
+
+class ClientError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.ClientError)
+
+class ServerError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>>
+): ApiInfrastructureResponse<T>(ResponseType.ServerError)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
new file mode 100644
index 0000000000000000000000000000000000000000..dd34bd48b2c01a3b2cc449fd1952635bfb9c0c85
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
@@ -0,0 +1,29 @@
+package org.openapitools.client.infrastructure
+
+import kotlin.properties.ReadWriteProperty
+import kotlin.reflect.KProperty
+
+object ApplicationDelegates {
+    /**
+     * Provides a property delegate, allowing the property to be set once and only once.
+     *
+     * If unset (no default value), a get on the property will throw [IllegalStateException].
+     */
+    fun <T> setOnce(defaultValue: T? = null) : ReadWriteProperty<Any?, T> = SetOnce(defaultValue)
+
+    private class SetOnce<T>(defaultValue: T? = null) : ReadWriteProperty<Any?, T> {
+        private var isSet = false
+        private var value: T? = defaultValue
+
+        override fun getValue(thisRef: Any?, property: KProperty<*>): T {
+            return value ?: throw IllegalStateException("${property.name} not initialized")
+        }
+
+        override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) {
+            if (!isSet) {
+                this.value = value
+                isSet = true
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..6120b081929dd7e189873ff58ac533b25cd02234
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
@@ -0,0 +1,33 @@
+package org.openapitools.client.infrastructure
+
+import com.google.gson.TypeAdapter
+import com.google.gson.stream.JsonReader
+import com.google.gson.stream.JsonWriter
+import com.google.gson.stream.JsonToken.NULL
+import java.io.IOException
+
+class ByteArrayAdapter : TypeAdapter<ByteArray>() {
+    @Throws(IOException::class)
+    override fun write(out: JsonWriter?, value: ByteArray?) {
+        if (value == null) {
+            out?.nullValue()
+        } else {
+            out?.value(String(value))
+        }
+    }
+
+    @Throws(IOException::class)
+    override fun read(out: JsonReader?): ByteArray? {
+        out ?: return null
+
+        when (out.peek()) {
+            NULL -> {
+                out.nextNull()
+                return null
+            }
+            else -> {
+                return out.nextString().toByteArray()
+            }
+        }
+    }
+}
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/DateAdapter.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/DateAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..c5d330ac0757540eb5a719e0b59c95fc10979cb3
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/DateAdapter.kt
@@ -0,0 +1,37 @@
+package org.openapitools.client.infrastructure
+
+import com.google.gson.TypeAdapter
+import com.google.gson.stream.JsonReader
+import com.google.gson.stream.JsonWriter
+import com.google.gson.stream.JsonToken.NULL
+import java.io.IOException
+import java.text.DateFormat
+import java.text.SimpleDateFormat
+import java.util.Date
+import java.util.Locale
+
+class DateAdapter(val formatter: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault())) : TypeAdapter<Date>() {
+    @Throws(IOException::class)
+    override fun write(out: JsonWriter?, value: Date?) {
+        if (value == null) {
+            out?.nullValue()
+        } else {
+            out?.value(formatter.format(value))
+        }
+    }
+
+    @Throws(IOException::class)
+    override fun read(out: JsonReader?): Date? {
+        out ?: return null
+
+        when (out.peek()) {
+            NULL -> {
+                out.nextNull()
+                return null
+            }
+            else -> {
+                return formatter.parse(out.nextString())
+            }
+        }
+    }
+}
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/Errors.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b5310e71f13c7e7fb874be998af37dd424d9cd11
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/Errors.kt
@@ -0,0 +1,18 @@
+@file:Suppress("unused")
+package org.openapitools.client.infrastructure
+
+import java.lang.RuntimeException
+
+open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 123L
+    }
+}
+
+open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 456L
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..30ef6697183a98f06aad567edbb64979bbebb667
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
@@ -0,0 +1,35 @@
+package org.openapitools.client.infrastructure
+
+import com.google.gson.TypeAdapter
+import com.google.gson.stream.JsonReader
+import com.google.gson.stream.JsonWriter
+import com.google.gson.stream.JsonToken.NULL
+import java.io.IOException
+import java.time.LocalDate
+import java.time.format.DateTimeFormatter
+
+class LocalDateAdapter(private val formatter: DateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE) : TypeAdapter<LocalDate>() {
+    @Throws(IOException::class)
+    override fun write(out: JsonWriter?, value: LocalDate?) {
+        if (value == null) {
+            out?.nullValue()
+        } else {
+            out?.value(formatter.format(value))
+        }
+    }
+
+    @Throws(IOException::class)
+    override fun read(out: JsonReader?): LocalDate? {
+        out ?: return null
+
+        when (out.peek()) {
+            NULL -> {
+                out.nextNull()
+                return null
+            }
+            else -> {
+                return LocalDate.parse(out.nextString(), formatter)
+            }
+        }
+    }
+}
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..3ad781c66ca18fad5fa00d51703447e75967da39
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
@@ -0,0 +1,35 @@
+package org.openapitools.client.infrastructure
+
+import com.google.gson.TypeAdapter
+import com.google.gson.stream.JsonReader
+import com.google.gson.stream.JsonWriter
+import com.google.gson.stream.JsonToken.NULL
+import java.io.IOException
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
+
+class LocalDateTimeAdapter(private val formatter: DateTimeFormatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME) : TypeAdapter<LocalDateTime>() {
+    @Throws(IOException::class)
+    override fun write(out: JsonWriter?, value: LocalDateTime?) {
+        if (value == null) {
+            out?.nullValue()
+        } else {
+            out?.value(formatter.format(value))
+        }
+    }
+
+    @Throws(IOException::class)
+    override fun read(out: JsonReader?): LocalDateTime? {
+        out ?: return null
+
+        when (out.peek()) {
+            NULL -> {
+                out.nextNull()
+                return null
+            }
+            else -> {
+                return LocalDateTime.parse(out.nextString(), formatter)
+            }
+        }
+    }
+}
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..e615135c9cc0dc8234f99eed53575eed2497185a
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
@@ -0,0 +1,35 @@
+package org.openapitools.client.infrastructure
+
+import com.google.gson.TypeAdapter
+import com.google.gson.stream.JsonReader
+import com.google.gson.stream.JsonWriter
+import com.google.gson.stream.JsonToken.NULL
+import java.io.IOException
+import java.time.OffsetDateTime
+import java.time.format.DateTimeFormatter
+
+class OffsetDateTimeAdapter(private val formatter: DateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME) : TypeAdapter<OffsetDateTime>() {
+    @Throws(IOException::class)
+    override fun write(out: JsonWriter?, value: OffsetDateTime?) {
+        if (value == null) {
+            out?.nullValue()
+        } else {
+            out?.value(formatter.format(value))
+        }
+    }
+
+    @Throws(IOException::class)
+    override fun read(out: JsonReader?): OffsetDateTime? {
+        out ?: return null
+
+        when (out.peek()) {
+            NULL -> {
+                out.nextNull()
+                return null
+            }
+            else -> {
+                return OffsetDateTime.parse(out.nextString(), formatter)
+            }
+        }
+    }
+}
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
new file mode 100644
index 0000000000000000000000000000000000000000..0f2790f370e29d3fceb044c2309dd945cd562eeb
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
@@ -0,0 +1,17 @@
+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<String,String> because rfc2616 defines
+ *       multi-valued headers as csv-only.
+ */
+data class RequestConfig(
+    val method: RequestMethod,
+    val path: String,
+    val headers: MutableMap<String, String> = mutableMapOf(),
+    val query: MutableMap<String, List<String>> = mutableMapOf(),
+    val body: kotlin.Any? = null
+)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt
new file mode 100644
index 0000000000000000000000000000000000000000..931b12b8bd7a6dba7362eaafc490edf709d14616
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/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
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9bd2790dc144a3794c7957fdff86c114e5570c99
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
@@ -0,0 +1,24 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Response
+
+/**
+ * Provides an extension to evaluation whether the response is a 1xx code
+ */
+val Response.isInformational : Boolean get() = this.code in 100..199
+
+/**
+ * Provides an extension to evaluation whether the response is a 3xx code
+ */
+@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
+val Response.isRedirect : Boolean get() = this.code in 300..399
+
+/**
+ * Provides an extension to evaluation whether the response is a 4xx code
+ */
+val Response.isClientError : Boolean get() = this.code in 400..499
+
+/**
+ * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code
+ */
+val Response.isServerError : Boolean get() = this.code in 500..999
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/Serializer.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b80e0390de2d33aa5140c42df6455bdb4b909042
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/infrastructure/Serializer.kt
@@ -0,0 +1,23 @@
+package org.openapitools.client.infrastructure
+
+import com.google.gson.Gson
+import com.google.gson.GsonBuilder
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.OffsetDateTime
+import java.util.UUID
+import java.util.Date
+
+object Serializer {
+    @JvmStatic
+    val gsonBuilder: GsonBuilder = GsonBuilder()
+        .registerTypeAdapter(OffsetDateTime::class.java, OffsetDateTimeAdapter())
+        .registerTypeAdapter(LocalDateTime::class.java, LocalDateTimeAdapter())
+        .registerTypeAdapter(LocalDate::class.java, LocalDateAdapter())
+        .registerTypeAdapter(ByteArray::class.java, ByteArrayAdapter())
+    
+    @JvmStatic
+    val gson: Gson by lazy {
+        gsonBuilder.create()
+    }
+}
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/ApiResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..fc89bf34e7fc3fc862c2c2e5aa1729ad00fece7e
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/ApiResponse.kt
@@ -0,0 +1,38 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.google.gson.annotations.SerializedName
+import java.io.Serializable
+
+/**
+ * Describes the result of uploading an image resource
+ * @param code 
+ * @param type 
+ * @param message 
+ */
+
+data class ApiResponse (
+    @SerializedName("code")
+    val code: kotlin.Int? = null,
+    @SerializedName("type")
+    val type: kotlin.String? = null,
+    @SerializedName("message")
+    val message: kotlin.String? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+}
+
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Category.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b483bee69b3ef3f11c723c2b0d9d1255ec32f1f4
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Category.kt
@@ -0,0 +1,35 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.google.gson.annotations.SerializedName
+import java.io.Serializable
+
+/**
+ * A category for a pet
+ * @param id 
+ * @param name 
+ */
+
+data class Category (
+    @SerializedName("id")
+    val id: kotlin.Long? = null,
+    @SerializedName("name")
+    val name: kotlin.String? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+}
+
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Order.kt
new file mode 100644
index 0000000000000000000000000000000000000000..d6bacf867c4769561e4f3ab4fe362b397a885eae
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Order.kt
@@ -0,0 +1,58 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.google.gson.annotations.SerializedName
+import java.io.Serializable
+
+/**
+ * An order for a pets from the pet store
+ * @param id 
+ * @param petId 
+ * @param quantity 
+ * @param shipDate 
+ * @param status Order Status
+ * @param complete 
+ */
+
+data class Order (
+    @SerializedName("id")
+    val id: kotlin.Long? = null,
+    @SerializedName("petId")
+    val petId: kotlin.Long? = null,
+    @SerializedName("quantity")
+    val quantity: kotlin.Int? = null,
+    @SerializedName("shipDate")
+    val shipDate: java.time.OffsetDateTime? = null,
+    /* Order Status */
+    @SerializedName("status")
+    val status: Order.Status? = null,
+    @SerializedName("complete")
+    val complete: kotlin.Boolean? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+    /**
+    * Order Status
+    * Values: placed,approved,delivered
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @SerializedName(value = "placed") placed("placed"),
+        @SerializedName(value = "approved") approved("approved"),
+        @SerializedName(value = "delivered") delivered("delivered");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Pet.kt
new file mode 100644
index 0000000000000000000000000000000000000000..afa65785d3870f0d45d51df40fe2fc0df7b1a361
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Pet.kt
@@ -0,0 +1,60 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+import org.openapitools.client.models.Category
+import org.openapitools.client.models.Tag
+
+import com.google.gson.annotations.SerializedName
+import java.io.Serializable
+
+/**
+ * A pet for sale in the pet store
+ * @param name 
+ * @param photoUrls 
+ * @param id 
+ * @param category 
+ * @param tags 
+ * @param status pet status in the store
+ */
+
+data class Pet (
+    @SerializedName("name")
+    val name: kotlin.String,
+    @SerializedName("photoUrls")
+    val photoUrls: kotlin.collections.List<kotlin.String>,
+    @SerializedName("id")
+    val id: kotlin.Long? = null,
+    @SerializedName("category")
+    val category: Category? = null,
+    @SerializedName("tags")
+    val tags: kotlin.collections.List<Tag>? = null,
+    /* pet status in the store */
+    @SerializedName("status")
+    val status: Pet.Status? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+    /**
+    * pet status in the store
+    * Values: available,pending,sold
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @SerializedName(value = "available") available("available"),
+        @SerializedName(value = "pending") pending("pending"),
+        @SerializedName(value = "sold") sold("sold");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Tag.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a1a282cb38dfef156e8ebea14b66b32dd35b2fbe
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/Tag.kt
@@ -0,0 +1,35 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.google.gson.annotations.SerializedName
+import java.io.Serializable
+
+/**
+ * A tag for a pet
+ * @param id 
+ * @param name 
+ */
+
+data class Tag (
+    @SerializedName("id")
+    val id: kotlin.Long? = null,
+    @SerializedName("name")
+    val name: kotlin.String? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+}
+
diff --git a/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/User.kt
new file mode 100644
index 0000000000000000000000000000000000000000..59ba0254f6030cdafc2903f744564559a09f277b
--- /dev/null
+++ b/samples/client/petstore/kotlin-jvm-okhttp4-coroutines/bin/main/org/openapitools/client/models/User.kt
@@ -0,0 +1,54 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.google.gson.annotations.SerializedName
+import java.io.Serializable
+
+/**
+ * A User who is purchasing from the pet store
+ * @param id 
+ * @param username 
+ * @param firstName 
+ * @param lastName 
+ * @param email 
+ * @param password 
+ * @param phone 
+ * @param userStatus User Status
+ */
+
+data class User (
+    @SerializedName("id")
+    val id: kotlin.Long? = null,
+    @SerializedName("username")
+    val username: kotlin.String? = null,
+    @SerializedName("firstName")
+    val firstName: kotlin.String? = null,
+    @SerializedName("lastName")
+    val lastName: kotlin.String? = null,
+    @SerializedName("email")
+    val email: kotlin.String? = null,
+    @SerializedName("password")
+    val password: kotlin.String? = null,
+    @SerializedName("phone")
+    val phone: kotlin.String? = null,
+    /* User Status */
+    @SerializedName("userStatus")
+    val userStatus: kotlin.Int? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+}
+
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/PetApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..c8b93b33bf6f60435de09774f61ab084f7fafd04
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/PetApi.kt
@@ -0,0 +1,492 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.ApiResponse
+import org.openapitools.client.models.Pet
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Add a new pet to the store
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun addPet(body: Pet) : Unit {
+        val localVariableConfig = addPetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation addPet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun addPetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Deletes a pet
+    * 
+    * @param petId Pet id to delete 
+    * @param apiKey  (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
+        val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deletePet
+    *
+    * @param petId Pet id to delete 
+    * @param apiKey  (optional)
+    * @return RequestConfig
+    */
+    fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by status
+    * Multiple status values can be provided with comma separated strings
+    * @param status Status values that need to be considered for filter 
+    * @return kotlin.collections.List<Pet>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
+        val localVariableConfig = findPetsByStatusRequestConfig(status = status)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByStatus
+    *
+    * @param status Status values that need to be considered for filter 
+    * @return RequestConfig
+    */
+    fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("status", toMultiValue(status.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByStatus",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by tags
+    * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+    * @param tags Tags to filter by 
+    * @return kotlin.collections.List<Pet>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
+        val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByTags
+    *
+    * @param tags Tags to filter by 
+    * @return RequestConfig
+    */
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("tags", toMultiValue(tags.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByTags",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find pet by ID
+    * Returns a single pet
+    * @param petId ID of pet to return 
+    * @return Pet
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getPetById(petId: kotlin.Long) : Pet {
+        val localVariableConfig = getPetByIdRequestConfig(petId = petId)
+
+        val localVarResponse = request<Pet>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Pet
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getPetById
+    *
+    * @param petId ID of pet to return 
+    * @return RequestConfig
+    */
+    fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Update an existing pet
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updatePet(body: Pet) : Unit {
+        val localVariableConfig = updatePetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun updatePetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updates a pet in the store with form data
+    * 
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
+        val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePetWithForm
+    *
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return RequestConfig
+    */
+    fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * uploads an image
+    * 
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return ApiResponse
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
+        val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
+
+        val localVarResponse = request<ApiResponse>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation uploadFile
+    *
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return RequestConfig
+    */
+    fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/StoreApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..215ed63420c9d538efe258fcc1244627caa4b8e1
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/StoreApi.kt
@@ -0,0 +1,253 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.Order
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Delete purchase order by ID
+    * For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
+    * @param orderId ID of the order that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deleteOrder(orderId: kotlin.String) : Unit {
+        val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteOrder
+    *
+    * @param orderId ID of the order that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Returns pet inventories by status
+    * Returns a map of status codes to quantities
+    * @return kotlin.collections.Map<kotlin.String, kotlin.Int>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
+        val localVariableConfig = getInventoryRequestConfig()
+
+        val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map<kotlin.String, kotlin.Int>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getInventory
+    *
+    * @return RequestConfig
+    */
+    fun getInventoryRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/inventory",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find purchase order by ID
+    * For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
+    * @param orderId ID of pet that needs to be fetched 
+    * @return Order
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getOrderById(orderId: kotlin.Long) : Order {
+        val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getOrderById
+    *
+    * @param orderId ID of pet that needs to be fetched 
+    * @return RequestConfig
+    */
+    fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Place an order for a pet
+    * 
+    * @param body order placed for purchasing the pet 
+    * @return Order
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun placeOrder(body: Order) : Order {
+        val localVariableConfig = placeOrderRequestConfig(body = body)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation placeOrder
+    *
+    * @param body order placed for purchasing the pet 
+    * @return RequestConfig
+    */
+    fun placeOrderRequestConfig(body: Order) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/store/order",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/UserApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..53748b934636efed3e534dcce15de3d659631c0e
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/apis/UserApi.kt
@@ -0,0 +1,476 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.User
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Create user
+    * This can only be done by the logged in user.
+    * @param body Created user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUser(body: User) : Unit {
+        val localVariableConfig = createUserRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUser
+    *
+    * @param body Created user object 
+    * @return RequestConfig
+    */
+    fun createUserRequestConfig(body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithArrayInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithArray",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithListInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithList",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Delete user
+    * This can only be done by the logged in user.
+    * @param username The name that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deleteUser(username: kotlin.String) : Unit {
+        val localVariableConfig = deleteUserRequestConfig(username = username)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteUser
+    *
+    * @param username The name that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Get user by user name
+    * 
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return User
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getUserByName(username: kotlin.String) : User {
+        val localVariableConfig = getUserByNameRequestConfig(username = username)
+
+        val localVarResponse = request<User>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as User
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getUserByName
+    *
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return RequestConfig
+    */
+    fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs user into the system
+    * 
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return kotlin.String
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
+        val localVariableConfig = loginUserRequestConfig(username = username, password = password)
+
+        val localVarResponse = request<kotlin.String>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation loginUser
+    *
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return RequestConfig
+    */
+    fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("username", listOf(username.toString()))
+                put("password", listOf(password.toString()))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/login",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs out current logged in user session
+    * 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun logoutUser() : Unit {
+        val localVariableConfig = logoutUserRequestConfig()
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation logoutUser
+    *
+    * @return RequestConfig
+    */
+    fun logoutUserRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/logout",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updated user
+    * This can only be done by the logged in user.
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updateUser(username: kotlin.String, body: User) : Unit {
+        val localVariableConfig = updateUserRequestConfig(username = username, body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updateUser
+    *
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return RequestConfig
+    */
+    fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ef7a8f1e1a625f7efdbea17077de86da8e09f805
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
@@ -0,0 +1,23 @@
+package org.openapitools.client.infrastructure
+
+typealias MultiValueMap = MutableMap<String,List<String>>
+
+fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
+    "csv" -> ","
+    "tsv" -> "\t"
+    "pipe" -> "|"
+    "space" -> " "
+    else -> ""
+}
+
+val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
+
+fun <T : Any?> toMultiValue(items: Array<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter)
+        = toMultiValue(items.asIterable(), collectionFormat, map)
+
+fun <T : Any?> toMultiValue(items: Iterable<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String> {
+    return when(collectionFormat) {
+        "multi" -> items.map(map)
+        else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map))
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
new file mode 100644
index 0000000000000000000000000000000000000000..7a8dcc91cd4b42efec03e777faa270456888e1e5
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
@@ -0,0 +1,251 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Credentials
+import okhttp3.OkHttpClient
+import okhttp3.RequestBody
+import okhttp3.RequestBody.Companion.asRequestBody
+import okhttp3.RequestBody.Companion.toRequestBody
+import okhttp3.FormBody
+import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
+import okhttp3.ResponseBody
+import okhttp3.MediaType.Companion.toMediaTypeOrNull
+import okhttp3.Request
+import okhttp3.Headers
+import okhttp3.MultipartBody
+import java.io.File
+import java.net.URLConnection
+import java.util.Date
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.LocalTime
+import java.time.OffsetDateTime
+import java.time.OffsetTime
+
+open class ApiClient(val baseUrl: String) {
+    companion object {
+        protected const val ContentType = "Content-Type"
+        protected const val Accept = "Accept"
+        protected const val Authorization = "Authorization"
+        protected const val JsonMediaType = "application/json"
+        protected const val FormDataMediaType = "multipart/form-data"
+        protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded"
+        protected const val XmlMediaType = "application/xml"
+
+        val apiKey: MutableMap<String, String> = mutableMapOf()
+        val apiKeyPrefix: MutableMap<String, String> = mutableMapOf()
+        var username: String? = null
+        var password: String? = null
+        var accessToken: String? = null
+
+        @JvmStatic
+        val client: OkHttpClient by lazy {
+            builder.build()
+        }
+
+        @JvmStatic
+        val builder: OkHttpClient.Builder = OkHttpClient.Builder()
+    }
+
+    /**
+     * Guess Content-Type header from the given file (defaults to "application/octet-stream").
+     *
+     * @param file The given file
+     * @return The guessed Content-Type
+     */
+    protected fun guessContentTypeFromFile(file: File): String {
+        val contentType = URLConnection.guessContentTypeFromName(file.name)
+        return contentType ?: "application/octet-stream"
+    }
+
+    protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
+        when {
+            content is File -> content.asRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == FormDataMediaType -> {
+                MultipartBody.Builder()
+                    .setType(MultipartBody.FORM)
+                    .apply {
+                        // content's type *must* be Map<String, Any?>
+                        @Suppress("UNCHECKED_CAST")
+                        (content as Map<String, Any?>).forEach { (key, value) ->
+                            if (value is File) {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\"; filename=\"${value.name}\""
+                                )
+                                val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull()
+                                addPart(partHeaders, value.asRequestBody(fileMediaType))
+                            } else {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\""
+                                )
+                                addPart(
+                                    partHeaders,
+                                    parameterToString(value).toRequestBody(null)
+                                )
+                            }
+                        }
+                    }.build()
+            }
+            mediaType == FormUrlEncMediaType -> {
+                FormBody.Builder().apply {
+                    // content's type *must* be Map<String, Any?>
+                    @Suppress("UNCHECKED_CAST")
+                    (content as Map<String, Any?>).forEach { (key, value) ->
+                        add(key, parameterToString(value))
+                    }
+                }.build()
+            }
+            mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
+            // TODO: this should be extended with other serializers
+            else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.")
+        }
+
+    protected inline fun <reified T: Any?> responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? {
+        if(body == null) {
+            return null
+        }
+        val bodyContent = body.string()
+        if (bodyContent.isEmpty()) {
+            return null
+        }
+        return when(mediaType) {
+            JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent)
+            else ->  throw UnsupportedOperationException("responseBody currently only supports JSON body.")
+        }
+    }
+
+    protected fun updateAuthParams(requestConfig: RequestConfig) {
+        if (requestConfig.headers["api_key"].isNullOrEmpty()) {
+            if (apiKey["api_key"] != null) {
+                if (apiKeyPrefix["api_key"] != null) {
+                    requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!
+                } else {
+                    requestConfig.headers["api_key"] = apiKey["api_key"]!!
+                }
+            }
+        }
+        if (requestConfig.headers[Authorization].isNullOrEmpty()) {
+            accessToken?.let { accessToken ->
+                requestConfig.headers[Authorization] = "Bearer $accessToken "
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
+        val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
+
+        // take authMethod from operation
+        updateAuthParams(requestConfig)
+
+        val url = httpUrl.newBuilder()
+            .addPathSegments(requestConfig.path.trimStart('/'))
+            .apply {
+                requestConfig.query.forEach { query ->
+                    query.value.forEach { queryValue ->
+                        addQueryParameter(query.key, queryValue)
+                    }
+                }
+            }.build()
+
+        // take content-type/accept from spec or set to default (application/json) if not defined
+        if (requestConfig.headers[ContentType].isNullOrEmpty()) {
+            requestConfig.headers[ContentType] = JsonMediaType
+        }
+        if (requestConfig.headers[Accept].isNullOrEmpty()) {
+            requestConfig.headers[Accept] = JsonMediaType
+        }
+        val headers = requestConfig.headers
+
+        if(headers[ContentType] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Content-Type header. This is required.")
+        }
+
+        if(headers[Accept] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Accept header. This is required.")
+        }
+
+        // TODO: support multiple contentType options here.
+        val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
+
+        val request = when (requestConfig.method) {
+            RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
+            RequestMethod.GET -> Request.Builder().url(url)
+            RequestMethod.HEAD -> Request.Builder().url(url).head()
+            RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
+            RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
+            RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
+            RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
+        }.apply {
+            headers.forEach { header -> addHeader(header.key, header.value) }
+        }.build()
+
+        val response = client.newCall(request).execute()
+        val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
+
+        // TODO: handle specific mapping types. e.g. Map<int, Class<?>>
+        when {
+            response.isRedirect -> return Redirection(
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isInformational -> return Informational(
+                    response.message,
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isSuccessful -> return Success(
+                    responseBody(response.body, accept),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isClientError -> return ClientError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            else -> return ServerError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+        }
+    }
+
+    protected fun parameterToString(value: Any?): String {
+        when (value) {
+            null -> {
+                return ""
+            }
+            is Array<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is Iterable<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
+                return parseDateToQueryString<Any>(value)
+            }
+            else -> {
+                return value.toString()
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any> 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.moshi.adapter(T::class.java).toJson(value).replace("\"", "")
+    }
+}
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9dc8d8dbbfaaef4f86a4f65b8a908ba9e4507060
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
@@ -0,0 +1,43 @@
+package org.openapitools.client.infrastructure
+
+enum class ResponseType {
+    Success, Informational, Redirection, ClientError, ServerError
+}
+
+interface Response
+
+abstract class ApiInfrastructureResponse<T>(val responseType: ResponseType): Response {
+    abstract val statusCode: Int
+    abstract val headers: Map<String,List<String>>
+}
+
+class Success<T>(
+    val data: T,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+): ApiInfrastructureResponse<T>(ResponseType.Success)
+
+class Informational<T>(
+    val statusText: String,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Informational)
+
+class Redirection<T>(
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Redirection)
+
+class ClientError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.ClientError)
+
+class ServerError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>>
+): ApiInfrastructureResponse<T>(ResponseType.ServerError)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
new file mode 100644
index 0000000000000000000000000000000000000000..dd34bd48b2c01a3b2cc449fd1952635bfb9c0c85
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
@@ -0,0 +1,29 @@
+package org.openapitools.client.infrastructure
+
+import kotlin.properties.ReadWriteProperty
+import kotlin.reflect.KProperty
+
+object ApplicationDelegates {
+    /**
+     * Provides a property delegate, allowing the property to be set once and only once.
+     *
+     * If unset (no default value), a get on the property will throw [IllegalStateException].
+     */
+    fun <T> setOnce(defaultValue: T? = null) : ReadWriteProperty<Any?, T> = SetOnce(defaultValue)
+
+    private class SetOnce<T>(defaultValue: T? = null) : ReadWriteProperty<Any?, T> {
+        private var isSet = false
+        private var value: T? = defaultValue
+
+        override fun getValue(thisRef: Any?, property: KProperty<*>): T {
+            return value ?: throw IllegalStateException("${property.name} not initialized")
+        }
+
+        override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) {
+            if (!isSet) {
+                this.value = value
+                isSet = true
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ff5e2a81ee8ce2677c90a56384c165450f0c5b18
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
@@ -0,0 +1,12 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+
+class ByteArrayAdapter {
+    @ToJson
+    fun toJson(data: ByteArray): String = String(data)
+
+    @FromJson
+    fun fromJson(data: String): ByteArray = data.toByteArray()
+}
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Errors.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b5310e71f13c7e7fb874be998af37dd424d9cd11
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Errors.kt
@@ -0,0 +1,18 @@
+@file:Suppress("unused")
+package org.openapitools.client.infrastructure
+
+import java.lang.RuntimeException
+
+open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 123L
+    }
+}
+
+open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 456L
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b2e1654479a01d0c02930408910cc70d93f16c9d
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.LocalDate
+import java.time.format.DateTimeFormatter
+
+class LocalDateAdapter {
+    @ToJson
+    fun toJson(value: LocalDate): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDate {
+        return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..e082db94811d386498db8b1cd56cf58af82bad56
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
+
+class LocalDateTimeAdapter {
+    @ToJson
+    fun toJson(value: LocalDateTime): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDateTime {
+        return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..87437871a31e6ae83dca8573985f7d178ce6f3e6
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.OffsetDateTime
+import java.time.format.DateTimeFormatter
+
+class OffsetDateTimeAdapter {
+    @ToJson
+    fun toJson(value: OffsetDateTime): String {
+        return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): OffsetDateTime {
+        return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
new file mode 100644
index 0000000000000000000000000000000000000000..0f2790f370e29d3fceb044c2309dd945cd562eeb
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
@@ -0,0 +1,17 @@
+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<String,String> because rfc2616 defines
+ *       multi-valued headers as csv-only.
+ */
+data class RequestConfig(
+    val method: RequestMethod,
+    val path: String,
+    val headers: MutableMap<String, String> = mutableMapOf(),
+    val query: MutableMap<String, List<String>> = mutableMapOf(),
+    val body: kotlin.Any? = null
+)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt
new file mode 100644
index 0000000000000000000000000000000000000000..931b12b8bd7a6dba7362eaafc490edf709d14616
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/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
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9bd2790dc144a3794c7957fdff86c114e5570c99
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
@@ -0,0 +1,24 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Response
+
+/**
+ * Provides an extension to evaluation whether the response is a 1xx code
+ */
+val Response.isInformational : Boolean get() = this.code in 100..199
+
+/**
+ * Provides an extension to evaluation whether the response is a 3xx code
+ */
+@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
+val Response.isRedirect : Boolean get() = this.code in 300..399
+
+/**
+ * Provides an extension to evaluation whether the response is a 4xx code
+ */
+val Response.isClientError : Boolean get() = this.code in 400..499
+
+/**
+ * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code
+ */
+val Response.isServerError : Boolean get() = this.code in 500..999
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Serializer.kt
new file mode 100644
index 0000000000000000000000000000000000000000..25447c818e668d4113a94a0d6a1c4a2471c52e6c
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/Serializer.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.Moshi
+import java.util.Date
+
+object Serializer {
+    @JvmStatic
+    val moshiBuilder: Moshi.Builder = Moshi.Builder()
+        .add(OffsetDateTimeAdapter())
+        .add(LocalDateTimeAdapter())
+        .add(LocalDateAdapter())
+        .add(UUIDAdapter())
+        .add(ByteArrayAdapter())
+
+    @JvmStatic
+    val moshi: Moshi by lazy {
+        moshiBuilder.build()
+    }
+}
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a4a44cc18b73e4a0ec722fa385e0276dbfbac670
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
@@ -0,0 +1,13 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.util.UUID
+
+class UUIDAdapter {
+    @ToJson
+    fun toJson(uuid: UUID) = uuid.toString()
+
+    @FromJson
+    fun fromJson(s: String) = UUID.fromString(s)
+}
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/ApiResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..18d2ce3dbbe73fa819cc9910522a36278f5ad8cf
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/ApiResponse.kt
@@ -0,0 +1,33 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+import com.squareup.moshi.JsonClass
+
+/**
+ * Describes the result of uploading an image resource
+ * @param code 
+ * @param type 
+ * @param message 
+ */
+@JsonClass(generateAdapter = true)
+data class ApiResponse (
+    @Json(name = "code")
+    val code: kotlin.Int? = null,
+    @Json(name = "type")
+    val type: kotlin.String? = null,
+    @Json(name = "message")
+    val message: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Category.kt
new file mode 100644
index 0000000000000000000000000000000000000000..8396fa423574b359c987832c905c6868ae1cb511
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Category.kt
@@ -0,0 +1,30 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+import com.squareup.moshi.JsonClass
+
+/**
+ * A category for a pet
+ * @param id 
+ * @param name 
+ */
+@JsonClass(generateAdapter = true)
+data class Category (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "name")
+    val name: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Order.kt
new file mode 100644
index 0000000000000000000000000000000000000000..d7091dd4c0c2041f3a402b5cf5738cc72db80858
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Order.kt
@@ -0,0 +1,55 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+import com.squareup.moshi.JsonClass
+
+/**
+ * An order for a pets from the pet store
+ * @param id 
+ * @param petId 
+ * @param quantity 
+ * @param shipDate 
+ * @param status Order Status
+ * @param complete 
+ */
+@JsonClass(generateAdapter = true)
+data class Order (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "petId")
+    val petId: kotlin.Long? = null,
+    @Json(name = "quantity")
+    val quantity: kotlin.Int? = null,
+    @Json(name = "shipDate")
+    val shipDate: java.time.OffsetDateTime? = null,
+    /* Order Status */
+    @Json(name = "status")
+    val status: Order.Status? = null,
+    @Json(name = "complete")
+    val complete: kotlin.Boolean? = null
+) {
+
+    /**
+    * Order Status
+    * Values: placed,approved,delivered
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @Json(name = "placed") placed("placed"),
+        @Json(name = "approved") approved("approved"),
+        @Json(name = "delivered") delivered("delivered");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Pet.kt
new file mode 100644
index 0000000000000000000000000000000000000000..8b4e6b44d4cca790a18db7a1219a69f1496baa03
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Pet.kt
@@ -0,0 +1,57 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+import org.openapitools.client.models.Category
+import org.openapitools.client.models.Tag
+
+import com.squareup.moshi.Json
+import com.squareup.moshi.JsonClass
+
+/**
+ * A pet for sale in the pet store
+ * @param name 
+ * @param photoUrls 
+ * @param id 
+ * @param category 
+ * @param tags 
+ * @param status pet status in the store
+ */
+@JsonClass(generateAdapter = true)
+data class Pet (
+    @Json(name = "name")
+    val name: kotlin.String,
+    @Json(name = "photoUrls")
+    val photoUrls: kotlin.collections.List<kotlin.String>,
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "category")
+    val category: Category? = null,
+    @Json(name = "tags")
+    val tags: kotlin.collections.List<Tag>? = null,
+    /* pet status in the store */
+    @Json(name = "status")
+    val status: Pet.Status? = null
+) {
+
+    /**
+    * pet status in the store
+    * Values: available,pending,sold
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @Json(name = "available") available("available"),
+        @Json(name = "pending") pending("pending"),
+        @Json(name = "sold") sold("sold");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Tag.kt
new file mode 100644
index 0000000000000000000000000000000000000000..e7cdab2bb5df5ed52a5c84b83c488be3196f3e26
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/Tag.kt
@@ -0,0 +1,30 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+import com.squareup.moshi.JsonClass
+
+/**
+ * A tag for a pet
+ * @param id 
+ * @param name 
+ */
+@JsonClass(generateAdapter = true)
+data class Tag (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "name")
+    val name: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/User.kt
new file mode 100644
index 0000000000000000000000000000000000000000..1bfad8449046fcb16888341f77b8da707d939895
--- /dev/null
+++ b/samples/client/petstore/kotlin-moshi-codegen/bin/main/org/openapitools/client/models/User.kt
@@ -0,0 +1,49 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+import com.squareup.moshi.JsonClass
+
+/**
+ * A User who is purchasing from the pet store
+ * @param id 
+ * @param username 
+ * @param firstName 
+ * @param lastName 
+ * @param email 
+ * @param password 
+ * @param phone 
+ * @param userStatus User Status
+ */
+@JsonClass(generateAdapter = true)
+data class User (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "username")
+    val username: kotlin.String? = null,
+    @Json(name = "firstName")
+    val firstName: kotlin.String? = null,
+    @Json(name = "lastName")
+    val lastName: kotlin.String? = null,
+    @Json(name = "email")
+    val email: kotlin.String? = null,
+    @Json(name = "password")
+    val password: kotlin.String? = null,
+    @Json(name = "phone")
+    val phone: kotlin.String? = null,
+    /* User Status */
+    @Json(name = "userStatus")
+    val userStatus: kotlin.Int? = null
+)
+
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/PetApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b6b38fa42f346ad6f42451922fce0ef36d5786f5
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/PetApi.kt
@@ -0,0 +1,492 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.ApiResponse
+import org.openapitools.client.models.Pet
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+internal class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Add a new pet to the store
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun addPet(body: Pet) : Unit {
+        val localVariableConfig = addPetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation addPet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun addPetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Deletes a pet
+    * 
+    * @param petId Pet id to delete 
+    * @param apiKey  (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
+        val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deletePet
+    *
+    * @param petId Pet id to delete 
+    * @param apiKey  (optional)
+    * @return RequestConfig
+    */
+    fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by status
+    * Multiple status values can be provided with comma separated strings
+    * @param status Status values that need to be considered for filter 
+    * @return kotlin.collections.List<Pet>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
+        val localVariableConfig = findPetsByStatusRequestConfig(status = status)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByStatus
+    *
+    * @param status Status values that need to be considered for filter 
+    * @return RequestConfig
+    */
+    fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("status", toMultiValue(status.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByStatus",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by tags
+    * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+    * @param tags Tags to filter by 
+    * @return kotlin.collections.List<Pet>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
+        val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByTags
+    *
+    * @param tags Tags to filter by 
+    * @return RequestConfig
+    */
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("tags", toMultiValue(tags.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByTags",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find pet by ID
+    * Returns a single pet
+    * @param petId ID of pet to return 
+    * @return Pet
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getPetById(petId: kotlin.Long) : Pet {
+        val localVariableConfig = getPetByIdRequestConfig(petId = petId)
+
+        val localVarResponse = request<Pet>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Pet
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getPetById
+    *
+    * @param petId ID of pet to return 
+    * @return RequestConfig
+    */
+    fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Update an existing pet
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updatePet(body: Pet) : Unit {
+        val localVariableConfig = updatePetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun updatePetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updates a pet in the store with form data
+    * 
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
+        val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePetWithForm
+    *
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return RequestConfig
+    */
+    fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * uploads an image
+    * 
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return ApiResponse
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
+        val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
+
+        val localVarResponse = request<ApiResponse>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation uploadFile
+    *
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return RequestConfig
+    */
+    fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/StoreApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..19b7acdbd31e13bc62d0ee5bec2c31ddab59bc6d
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/StoreApi.kt
@@ -0,0 +1,253 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.Order
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+internal class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Delete purchase order by ID
+    * For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
+    * @param orderId ID of the order that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deleteOrder(orderId: kotlin.String) : Unit {
+        val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteOrder
+    *
+    * @param orderId ID of the order that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Returns pet inventories by status
+    * Returns a map of status codes to quantities
+    * @return kotlin.collections.Map<kotlin.String, kotlin.Int>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
+        val localVariableConfig = getInventoryRequestConfig()
+
+        val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map<kotlin.String, kotlin.Int>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getInventory
+    *
+    * @return RequestConfig
+    */
+    fun getInventoryRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/inventory",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find purchase order by ID
+    * For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
+    * @param orderId ID of pet that needs to be fetched 
+    * @return Order
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getOrderById(orderId: kotlin.Long) : Order {
+        val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getOrderById
+    *
+    * @param orderId ID of pet that needs to be fetched 
+    * @return RequestConfig
+    */
+    fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Place an order for a pet
+    * 
+    * @param body order placed for purchasing the pet 
+    * @return Order
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun placeOrder(body: Order) : Order {
+        val localVariableConfig = placeOrderRequestConfig(body = body)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation placeOrder
+    *
+    * @param body order placed for purchasing the pet 
+    * @return RequestConfig
+    */
+    fun placeOrderRequestConfig(body: Order) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/store/order",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/UserApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..979bb1b81f86a9e08eeb1e53e066e1d1398b1ca2
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/apis/UserApi.kt
@@ -0,0 +1,476 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.User
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+internal class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Create user
+    * This can only be done by the logged in user.
+    * @param body Created user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUser(body: User) : Unit {
+        val localVariableConfig = createUserRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUser
+    *
+    * @param body Created user object 
+    * @return RequestConfig
+    */
+    fun createUserRequestConfig(body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithArrayInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithArray",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithListInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithList",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Delete user
+    * This can only be done by the logged in user.
+    * @param username The name that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deleteUser(username: kotlin.String) : Unit {
+        val localVariableConfig = deleteUserRequestConfig(username = username)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteUser
+    *
+    * @param username The name that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Get user by user name
+    * 
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return User
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getUserByName(username: kotlin.String) : User {
+        val localVariableConfig = getUserByNameRequestConfig(username = username)
+
+        val localVarResponse = request<User>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as User
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getUserByName
+    *
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return RequestConfig
+    */
+    fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs user into the system
+    * 
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return kotlin.String
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
+        val localVariableConfig = loginUserRequestConfig(username = username, password = password)
+
+        val localVarResponse = request<kotlin.String>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation loginUser
+    *
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return RequestConfig
+    */
+    fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("username", listOf(username.toString()))
+                put("password", listOf(password.toString()))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/login",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs out current logged in user session
+    * 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun logoutUser() : Unit {
+        val localVariableConfig = logoutUserRequestConfig()
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation logoutUser
+    *
+    * @return RequestConfig
+    */
+    fun logoutUserRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/logout",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updated user
+    * This can only be done by the logged in user.
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updateUser(username: kotlin.String, body: User) : Unit {
+        val localVariableConfig = updateUserRequestConfig(username = username, body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updateUser
+    *
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return RequestConfig
+    */
+    fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..d26cda9091ca0fe77c8c32b95cdb1d5579d087ef
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
@@ -0,0 +1,23 @@
+package org.openapitools.client.infrastructure
+
+internal typealias MultiValueMap = MutableMap<String,List<String>>
+
+internal fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
+    "csv" -> ","
+    "tsv" -> "\t"
+    "pipe" -> "|"
+    "space" -> " "
+    else -> ""
+}
+
+internal val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
+
+internal fun <T : Any?> toMultiValue(items: Array<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter)
+        = toMultiValue(items.asIterable(), collectionFormat, map)
+
+internal fun <T : Any?> toMultiValue(items: Iterable<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String> {
+    return when(collectionFormat) {
+        "multi" -> items.map(map)
+        else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map))
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
new file mode 100644
index 0000000000000000000000000000000000000000..c4da8e3989b872329cb63d8faa34a5708eedfae9
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
@@ -0,0 +1,251 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Credentials
+import okhttp3.OkHttpClient
+import okhttp3.RequestBody
+import okhttp3.RequestBody.Companion.asRequestBody
+import okhttp3.RequestBody.Companion.toRequestBody
+import okhttp3.FormBody
+import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
+import okhttp3.ResponseBody
+import okhttp3.MediaType.Companion.toMediaTypeOrNull
+import okhttp3.Request
+import okhttp3.Headers
+import okhttp3.MultipartBody
+import java.io.File
+import java.net.URLConnection
+import java.util.Date
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.LocalTime
+import java.time.OffsetDateTime
+import java.time.OffsetTime
+
+internal open class ApiClient(val baseUrl: String) {
+    internal companion object {
+        protected const val ContentType = "Content-Type"
+        protected const val Accept = "Accept"
+        protected const val Authorization = "Authorization"
+        protected const val JsonMediaType = "application/json"
+        protected const val FormDataMediaType = "multipart/form-data"
+        protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded"
+        protected const val XmlMediaType = "application/xml"
+
+        val apiKey: MutableMap<String, String> = mutableMapOf()
+        val apiKeyPrefix: MutableMap<String, String> = mutableMapOf()
+        var username: String? = null
+        var password: String? = null
+        var accessToken: String? = null
+
+        @JvmStatic
+        val client: OkHttpClient by lazy {
+            builder.build()
+        }
+
+        @JvmStatic
+        val builder: OkHttpClient.Builder = OkHttpClient.Builder()
+    }
+
+    /**
+     * Guess Content-Type header from the given file (defaults to "application/octet-stream").
+     *
+     * @param file The given file
+     * @return The guessed Content-Type
+     */
+    protected fun guessContentTypeFromFile(file: File): String {
+        val contentType = URLConnection.guessContentTypeFromName(file.name)
+        return contentType ?: "application/octet-stream"
+    }
+
+    protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
+        when {
+            content is File -> content.asRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == FormDataMediaType -> {
+                MultipartBody.Builder()
+                    .setType(MultipartBody.FORM)
+                    .apply {
+                        // content's type *must* be Map<String, Any?>
+                        @Suppress("UNCHECKED_CAST")
+                        (content as Map<String, Any?>).forEach { (key, value) ->
+                            if (value is File) {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\"; filename=\"${value.name}\""
+                                )
+                                val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull()
+                                addPart(partHeaders, value.asRequestBody(fileMediaType))
+                            } else {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\""
+                                )
+                                addPart(
+                                    partHeaders,
+                                    parameterToString(value).toRequestBody(null)
+                                )
+                            }
+                        }
+                    }.build()
+            }
+            mediaType == FormUrlEncMediaType -> {
+                FormBody.Builder().apply {
+                    // content's type *must* be Map<String, Any?>
+                    @Suppress("UNCHECKED_CAST")
+                    (content as Map<String, Any?>).forEach { (key, value) ->
+                        add(key, parameterToString(value))
+                    }
+                }.build()
+            }
+            mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
+            // TODO: this should be extended with other serializers
+            else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.")
+        }
+
+    protected inline fun <reified T: Any?> responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? {
+        if(body == null) {
+            return null
+        }
+        val bodyContent = body.string()
+        if (bodyContent.isEmpty()) {
+            return null
+        }
+        return when(mediaType) {
+            JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent)
+            else ->  throw UnsupportedOperationException("responseBody currently only supports JSON body.")
+        }
+    }
+
+    protected fun updateAuthParams(requestConfig: RequestConfig) {
+        if (requestConfig.headers["api_key"].isNullOrEmpty()) {
+            if (apiKey["api_key"] != null) {
+                if (apiKeyPrefix["api_key"] != null) {
+                    requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!
+                } else {
+                    requestConfig.headers["api_key"] = apiKey["api_key"]!!
+                }
+            }
+        }
+        if (requestConfig.headers[Authorization].isNullOrEmpty()) {
+            accessToken?.let { accessToken ->
+                requestConfig.headers[Authorization] = "Bearer $accessToken "
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
+        val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
+
+        // take authMethod from operation
+        updateAuthParams(requestConfig)
+
+        val url = httpUrl.newBuilder()
+            .addPathSegments(requestConfig.path.trimStart('/'))
+            .apply {
+                requestConfig.query.forEach { query ->
+                    query.value.forEach { queryValue ->
+                        addQueryParameter(query.key, queryValue)
+                    }
+                }
+            }.build()
+
+        // take content-type/accept from spec or set to default (application/json) if not defined
+        if (requestConfig.headers[ContentType].isNullOrEmpty()) {
+            requestConfig.headers[ContentType] = JsonMediaType
+        }
+        if (requestConfig.headers[Accept].isNullOrEmpty()) {
+            requestConfig.headers[Accept] = JsonMediaType
+        }
+        val headers = requestConfig.headers
+
+        if(headers[ContentType] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Content-Type header. This is required.")
+        }
+
+        if(headers[Accept] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Accept header. This is required.")
+        }
+
+        // TODO: support multiple contentType options here.
+        val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
+
+        val request = when (requestConfig.method) {
+            RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
+            RequestMethod.GET -> Request.Builder().url(url)
+            RequestMethod.HEAD -> Request.Builder().url(url).head()
+            RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
+            RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
+            RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
+            RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
+        }.apply {
+            headers.forEach { header -> addHeader(header.key, header.value) }
+        }.build()
+
+        val response = client.newCall(request).execute()
+        val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
+
+        // TODO: handle specific mapping types. e.g. Map<int, Class<?>>
+        when {
+            response.isRedirect -> return Redirection(
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isInformational -> return Informational(
+                    response.message,
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isSuccessful -> return Success(
+                    responseBody(response.body, accept),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isClientError -> return ClientError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            else -> return ServerError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+        }
+    }
+
+    protected fun parameterToString(value: Any?): String {
+        when (value) {
+            null -> {
+                return ""
+            }
+            is Array<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is Iterable<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
+                return parseDateToQueryString<Any>(value)
+            }
+            else -> {
+                return value.toString()
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any> 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.moshi.adapter(T::class.java).toJson(value).replace("\"", "")
+    }
+}
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..c618544573e43ba21fbd7e7d01063b2fec430a84
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
@@ -0,0 +1,43 @@
+package org.openapitools.client.infrastructure
+
+internal enum class ResponseType {
+    Success, Informational, Redirection, ClientError, ServerError
+}
+
+internal interface Response
+
+internal abstract class ApiInfrastructureResponse<T>(val responseType: ResponseType): Response {
+    abstract val statusCode: Int
+    abstract val headers: Map<String,List<String>>
+}
+
+internal class Success<T>(
+    val data: T,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+): ApiInfrastructureResponse<T>(ResponseType.Success)
+
+internal class Informational<T>(
+    val statusText: String,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Informational)
+
+internal class Redirection<T>(
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Redirection)
+
+internal class ClientError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.ClientError)
+
+internal class ServerError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>>
+): ApiInfrastructureResponse<T>(ResponseType.ServerError)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
new file mode 100644
index 0000000000000000000000000000000000000000..d7f9079c0d54667fcce50efb492143847d189a38
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
@@ -0,0 +1,29 @@
+package org.openapitools.client.infrastructure
+
+import kotlin.properties.ReadWriteProperty
+import kotlin.reflect.KProperty
+
+internal object ApplicationDelegates {
+    /**
+     * Provides a property delegate, allowing the property to be set once and only once.
+     *
+     * If unset (no default value), a get on the property will throw [IllegalStateException].
+     */
+    fun <T> setOnce(defaultValue: T? = null) : ReadWriteProperty<Any?, T> = SetOnce(defaultValue)
+
+    private class SetOnce<T>(defaultValue: T? = null) : ReadWriteProperty<Any?, T> {
+        private var isSet = false
+        private var value: T? = defaultValue
+
+        override fun getValue(thisRef: Any?, property: KProperty<*>): T {
+            return value ?: throw IllegalStateException("${property.name} not initialized")
+        }
+
+        override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) {
+            if (!isSet) {
+                this.value = value
+                isSet = true
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..86bcb51fba6f9a7d50469595911dc1596d380037
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
@@ -0,0 +1,12 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+
+internal class ByteArrayAdapter {
+    @ToJson
+    fun toJson(data: ByteArray): String = String(data)
+
+    @FromJson
+    fun fromJson(data: String): ByteArray = data.toByteArray()
+}
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Errors.kt
new file mode 100644
index 0000000000000000000000000000000000000000..204b69dcb08ee4356c215e426f7dab7b259c38cb
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Errors.kt
@@ -0,0 +1,18 @@
+@file:Suppress("unused")
+package org.openapitools.client.infrastructure
+
+import java.lang.RuntimeException
+
+internal open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    internal companion object {
+        private const val serialVersionUID: Long = 123L
+    }
+}
+
+internal open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    internal companion object {
+        private const val serialVersionUID: Long = 456L
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..e86215d5717d0b5d0071a6b26bb681f660ff8c09
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.LocalDate
+import java.time.format.DateTimeFormatter
+
+internal class LocalDateAdapter {
+    @ToJson
+    fun toJson(value: LocalDate): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDate {
+        return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..fe7069904ca3935e2082b2a1dc3e589dc2ebce58
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
+
+internal class LocalDateTimeAdapter {
+    @ToJson
+    fun toJson(value: LocalDateTime): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDateTime {
+        return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..be7703c103d26e2e01fe66c81216acaf8d461f02
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.OffsetDateTime
+import java.time.format.DateTimeFormatter
+
+internal class OffsetDateTimeAdapter {
+    @ToJson
+    fun toJson(value: OffsetDateTime): String {
+        return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): OffsetDateTime {
+        return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
new file mode 100644
index 0000000000000000000000000000000000000000..68f41c5497dd9d4daa77f896a48d1a498d36f72c
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
@@ -0,0 +1,17 @@
+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<String,String> because rfc2616 defines
+ *       multi-valued headers as csv-only.
+ */
+internal data class RequestConfig(
+    val method: RequestMethod,
+    val path: String,
+    val headers: MutableMap<String, String> = mutableMapOf(),
+    val query: MutableMap<String, List<String>> = mutableMapOf(),
+    val body: kotlin.Any? = null
+)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt
new file mode 100644
index 0000000000000000000000000000000000000000..e0fbb1e6526cd4db32de4fb20b3bfbdba288ec6e
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt
@@ -0,0 +1,8 @@
+package org.openapitools.client.infrastructure
+
+/**
+ * Provides enumerated HTTP verbs
+ */
+internal enum class RequestMethod {
+    GET, DELETE, HEAD, OPTIONS, PATCH, POST, PUT
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..858d1b7339b416a15aafe85a7e72a02d4bda8345
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
@@ -0,0 +1,24 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Response
+
+/**
+ * Provides an extension to evaluation whether the response is a 1xx code
+ */
+internal val Response.isInformational : Boolean get() = this.code in 100..199
+
+/**
+ * Provides an extension to evaluation whether the response is a 3xx code
+ */
+@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
+internal val Response.isRedirect : Boolean get() = this.code in 300..399
+
+/**
+ * Provides an extension to evaluation whether the response is a 4xx code
+ */
+internal val Response.isClientError : Boolean get() = this.code in 400..499
+
+/**
+ * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code
+ */
+internal val Response.isServerError : Boolean get() = this.code in 500..999
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Serializer.kt
new file mode 100644
index 0000000000000000000000000000000000000000..7265f759142849dae9d1e7c7d4f9d769c2a0f9a8
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/Serializer.kt
@@ -0,0 +1,21 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.Moshi
+import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
+import java.util.Date
+
+internal object Serializer {
+    @JvmStatic
+    val moshiBuilder: Moshi.Builder = Moshi.Builder()
+        .add(OffsetDateTimeAdapter())
+        .add(LocalDateTimeAdapter())
+        .add(LocalDateAdapter())
+        .add(UUIDAdapter())
+        .add(ByteArrayAdapter())
+        .add(KotlinJsonAdapterFactory())
+
+    @JvmStatic
+    val moshi: Moshi by lazy {
+        moshiBuilder.build()
+    }
+}
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..02fa692b57dc15c0e066e3738786ce014fc50cce
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
@@ -0,0 +1,13 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.util.UUID
+
+internal class UUIDAdapter {
+    @ToJson
+    fun toJson(uuid: UUID) = uuid.toString()
+
+    @FromJson
+    fun fromJson(s: String) = UUID.fromString(s)
+}
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/ApiResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a695278dfa3cfafefe6ec3e659a947775aae6486
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/ApiResponse.kt
@@ -0,0 +1,32 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * Describes the result of uploading an image resource
+ * @param code 
+ * @param type 
+ * @param message 
+ */
+
+internal data class ApiResponse (
+    @Json(name = "code")
+    val code: kotlin.Int? = null,
+    @Json(name = "type")
+    val type: kotlin.String? = null,
+    @Json(name = "message")
+    val message: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Category.kt
new file mode 100644
index 0000000000000000000000000000000000000000..376994a9b250b11801a7d51e89e6fa2724166650
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Category.kt
@@ -0,0 +1,29 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * A category for a pet
+ * @param id 
+ * @param name 
+ */
+
+internal data class Category (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "name")
+    val name: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Order.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a943b97c1ea316e196513ef4387f98cfb65d8004
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Order.kt
@@ -0,0 +1,54 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * An order for a pets from the pet store
+ * @param id 
+ * @param petId 
+ * @param quantity 
+ * @param shipDate 
+ * @param status Order Status
+ * @param complete 
+ */
+
+internal data class Order (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "petId")
+    val petId: kotlin.Long? = null,
+    @Json(name = "quantity")
+    val quantity: kotlin.Int? = null,
+    @Json(name = "shipDate")
+    val shipDate: java.time.OffsetDateTime? = null,
+    /* Order Status */
+    @Json(name = "status")
+    val status: Order.Status? = null,
+    @Json(name = "complete")
+    val complete: kotlin.Boolean? = null
+) {
+
+    /**
+    * Order Status
+    * Values: placed,approved,delivered
+    */
+    
+    internal enum class Status(val value: kotlin.String){
+        @Json(name = "placed") placed("placed"),
+        @Json(name = "approved") approved("approved"),
+        @Json(name = "delivered") delivered("delivered");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Pet.kt
new file mode 100644
index 0000000000000000000000000000000000000000..544fab20f5a7f58f8dc98fdd90df99f6a48e67eb
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Pet.kt
@@ -0,0 +1,56 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+import org.openapitools.client.models.Category
+import org.openapitools.client.models.Tag
+
+import com.squareup.moshi.Json
+
+/**
+ * A pet for sale in the pet store
+ * @param name 
+ * @param photoUrls 
+ * @param id 
+ * @param category 
+ * @param tags 
+ * @param status pet status in the store
+ */
+
+internal data class Pet (
+    @Json(name = "name")
+    val name: kotlin.String,
+    @Json(name = "photoUrls")
+    val photoUrls: kotlin.collections.List<kotlin.String>,
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "category")
+    val category: Category? = null,
+    @Json(name = "tags")
+    val tags: kotlin.collections.List<Tag>? = null,
+    /* pet status in the store */
+    @Json(name = "status")
+    val status: Pet.Status? = null
+) {
+
+    /**
+    * pet status in the store
+    * Values: available,pending,sold
+    */
+    
+    internal enum class Status(val value: kotlin.String){
+        @Json(name = "available") available("available"),
+        @Json(name = "pending") pending("pending"),
+        @Json(name = "sold") sold("sold");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Tag.kt
new file mode 100644
index 0000000000000000000000000000000000000000..d9b84e93eafd3302192c0c391240433bdbd95cdd
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/Tag.kt
@@ -0,0 +1,29 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * A tag for a pet
+ * @param id 
+ * @param name 
+ */
+
+internal data class Tag (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "name")
+    val name: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/User.kt
new file mode 100644
index 0000000000000000000000000000000000000000..e0e821cd7e3826fd467a330f4e312f35a2e15bcc
--- /dev/null
+++ b/samples/client/petstore/kotlin-nonpublic/bin/main/org/openapitools/client/models/User.kt
@@ -0,0 +1,48 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * A User who is purchasing from the pet store
+ * @param id 
+ * @param username 
+ * @param firstName 
+ * @param lastName 
+ * @param email 
+ * @param password 
+ * @param phone 
+ * @param userStatus User Status
+ */
+
+internal data class User (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "username")
+    val username: kotlin.String? = null,
+    @Json(name = "firstName")
+    val firstName: kotlin.String? = null,
+    @Json(name = "lastName")
+    val lastName: kotlin.String? = null,
+    @Json(name = "email")
+    val email: kotlin.String? = null,
+    @Json(name = "password")
+    val password: kotlin.String? = null,
+    @Json(name = "phone")
+    val phone: kotlin.String? = null,
+    /* User Status */
+    @Json(name = "userStatus")
+    val userStatus: kotlin.Int? = null
+)
+
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/PetApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..95f695cb9f4822a3617ab273cfc2dc584a68dcb5
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/PetApi.kt
@@ -0,0 +1,492 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.ApiResponse
+import org.openapitools.client.models.Pet
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Add a new pet to the store
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun addPet(body: Pet) : Unit {
+        val localVariableConfig = addPetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation addPet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun addPetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Deletes a pet
+    * 
+    * @param petId Pet id to delete 
+    * @param apiKey  (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
+        val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deletePet
+    *
+    * @param petId Pet id to delete 
+    * @param apiKey  (optional)
+    * @return RequestConfig
+    */
+    fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by status
+    * Multiple status values can be provided with comma separated strings
+    * @param status Status values that need to be considered for filter 
+    * @return kotlin.collections.List<Pet> or null
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet>? {
+        val localVariableConfig = findPetsByStatusRequestConfig(status = status)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>?
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByStatus
+    *
+    * @param status Status values that need to be considered for filter 
+    * @return RequestConfig
+    */
+    fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("status", toMultiValue(status.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByStatus",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by tags
+    * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+    * @param tags Tags to filter by 
+    * @return kotlin.collections.List<Pet> or null
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet>? {
+        val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>?
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByTags
+    *
+    * @param tags Tags to filter by 
+    * @return RequestConfig
+    */
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("tags", toMultiValue(tags.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByTags",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find pet by ID
+    * Returns a single pet
+    * @param petId ID of pet to return 
+    * @return Pet or null
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getPetById(petId: kotlin.Long) : Pet? {
+        val localVariableConfig = getPetByIdRequestConfig(petId = petId)
+
+        val localVarResponse = request<Pet>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Pet?
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getPetById
+    *
+    * @param petId ID of pet to return 
+    * @return RequestConfig
+    */
+    fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Update an existing pet
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updatePet(body: Pet) : Unit {
+        val localVariableConfig = updatePetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun updatePetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updates a pet in the store with form data
+    * 
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
+        val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePetWithForm
+    *
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return RequestConfig
+    */
+    fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * uploads an image
+    * 
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return ApiResponse or null
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse? {
+        val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
+
+        val localVarResponse = request<ApiResponse>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse?
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation uploadFile
+    *
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return RequestConfig
+    */
+    fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/StoreApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..c442f8661003805f0bc3995bd7160223dd2a0eee
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/StoreApi.kt
@@ -0,0 +1,253 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.Order
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Delete purchase order by ID
+    * For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
+    * @param orderId ID of the order that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deleteOrder(orderId: kotlin.String) : Unit {
+        val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteOrder
+    *
+    * @param orderId ID of the order that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Returns pet inventories by status
+    * Returns a map of status codes to quantities
+    * @return kotlin.collections.Map<kotlin.String, kotlin.Int> or null
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int>? {
+        val localVariableConfig = getInventoryRequestConfig()
+
+        val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map<kotlin.String, kotlin.Int>?
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getInventory
+    *
+    * @return RequestConfig
+    */
+    fun getInventoryRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/inventory",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find purchase order by ID
+    * For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
+    * @param orderId ID of pet that needs to be fetched 
+    * @return Order or null
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getOrderById(orderId: kotlin.Long) : Order? {
+        val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order?
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getOrderById
+    *
+    * @param orderId ID of pet that needs to be fetched 
+    * @return RequestConfig
+    */
+    fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Place an order for a pet
+    * 
+    * @param body order placed for purchasing the pet 
+    * @return Order or null
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun placeOrder(body: Order) : Order? {
+        val localVariableConfig = placeOrderRequestConfig(body = body)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order?
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation placeOrder
+    *
+    * @param body order placed for purchasing the pet 
+    * @return RequestConfig
+    */
+    fun placeOrderRequestConfig(body: Order) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/store/order",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/UserApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..6e6c329144cc037ab20df7395a97fc732199a806
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/apis/UserApi.kt
@@ -0,0 +1,476 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.User
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Create user
+    * This can only be done by the logged in user.
+    * @param body Created user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUser(body: User) : Unit {
+        val localVariableConfig = createUserRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUser
+    *
+    * @param body Created user object 
+    * @return RequestConfig
+    */
+    fun createUserRequestConfig(body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithArrayInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithArray",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithListInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithList",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Delete user
+    * This can only be done by the logged in user.
+    * @param username The name that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deleteUser(username: kotlin.String) : Unit {
+        val localVariableConfig = deleteUserRequestConfig(username = username)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteUser
+    *
+    * @param username The name that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Get user by user name
+    * 
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return User or null
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getUserByName(username: kotlin.String) : User? {
+        val localVariableConfig = getUserByNameRequestConfig(username = username)
+
+        val localVarResponse = request<User>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as User?
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getUserByName
+    *
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return RequestConfig
+    */
+    fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs user into the system
+    * 
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return kotlin.String or null
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String? {
+        val localVariableConfig = loginUserRequestConfig(username = username, password = password)
+
+        val localVarResponse = request<kotlin.String>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String?
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation loginUser
+    *
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return RequestConfig
+    */
+    fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("username", listOf(username.toString()))
+                put("password", listOf(password.toString()))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/login",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs out current logged in user session
+    * 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun logoutUser() : Unit {
+        val localVariableConfig = logoutUserRequestConfig()
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation logoutUser
+    *
+    * @return RequestConfig
+    */
+    fun logoutUserRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/logout",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updated user
+    * This can only be done by the logged in user.
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updateUser(username: kotlin.String, body: User) : Unit {
+        val localVariableConfig = updateUserRequestConfig(username = username, body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updateUser
+    *
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return RequestConfig
+    */
+    fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ef7a8f1e1a625f7efdbea17077de86da8e09f805
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
@@ -0,0 +1,23 @@
+package org.openapitools.client.infrastructure
+
+typealias MultiValueMap = MutableMap<String,List<String>>
+
+fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
+    "csv" -> ","
+    "tsv" -> "\t"
+    "pipe" -> "|"
+    "space" -> " "
+    else -> ""
+}
+
+val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
+
+fun <T : Any?> toMultiValue(items: Array<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter)
+        = toMultiValue(items.asIterable(), collectionFormat, map)
+
+fun <T : Any?> toMultiValue(items: Iterable<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String> {
+    return when(collectionFormat) {
+        "multi" -> items.map(map)
+        else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map))
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
new file mode 100644
index 0000000000000000000000000000000000000000..7a8dcc91cd4b42efec03e777faa270456888e1e5
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
@@ -0,0 +1,251 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Credentials
+import okhttp3.OkHttpClient
+import okhttp3.RequestBody
+import okhttp3.RequestBody.Companion.asRequestBody
+import okhttp3.RequestBody.Companion.toRequestBody
+import okhttp3.FormBody
+import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
+import okhttp3.ResponseBody
+import okhttp3.MediaType.Companion.toMediaTypeOrNull
+import okhttp3.Request
+import okhttp3.Headers
+import okhttp3.MultipartBody
+import java.io.File
+import java.net.URLConnection
+import java.util.Date
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.LocalTime
+import java.time.OffsetDateTime
+import java.time.OffsetTime
+
+open class ApiClient(val baseUrl: String) {
+    companion object {
+        protected const val ContentType = "Content-Type"
+        protected const val Accept = "Accept"
+        protected const val Authorization = "Authorization"
+        protected const val JsonMediaType = "application/json"
+        protected const val FormDataMediaType = "multipart/form-data"
+        protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded"
+        protected const val XmlMediaType = "application/xml"
+
+        val apiKey: MutableMap<String, String> = mutableMapOf()
+        val apiKeyPrefix: MutableMap<String, String> = mutableMapOf()
+        var username: String? = null
+        var password: String? = null
+        var accessToken: String? = null
+
+        @JvmStatic
+        val client: OkHttpClient by lazy {
+            builder.build()
+        }
+
+        @JvmStatic
+        val builder: OkHttpClient.Builder = OkHttpClient.Builder()
+    }
+
+    /**
+     * Guess Content-Type header from the given file (defaults to "application/octet-stream").
+     *
+     * @param file The given file
+     * @return The guessed Content-Type
+     */
+    protected fun guessContentTypeFromFile(file: File): String {
+        val contentType = URLConnection.guessContentTypeFromName(file.name)
+        return contentType ?: "application/octet-stream"
+    }
+
+    protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
+        when {
+            content is File -> content.asRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == FormDataMediaType -> {
+                MultipartBody.Builder()
+                    .setType(MultipartBody.FORM)
+                    .apply {
+                        // content's type *must* be Map<String, Any?>
+                        @Suppress("UNCHECKED_CAST")
+                        (content as Map<String, Any?>).forEach { (key, value) ->
+                            if (value is File) {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\"; filename=\"${value.name}\""
+                                )
+                                val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull()
+                                addPart(partHeaders, value.asRequestBody(fileMediaType))
+                            } else {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\""
+                                )
+                                addPart(
+                                    partHeaders,
+                                    parameterToString(value).toRequestBody(null)
+                                )
+                            }
+                        }
+                    }.build()
+            }
+            mediaType == FormUrlEncMediaType -> {
+                FormBody.Builder().apply {
+                    // content's type *must* be Map<String, Any?>
+                    @Suppress("UNCHECKED_CAST")
+                    (content as Map<String, Any?>).forEach { (key, value) ->
+                        add(key, parameterToString(value))
+                    }
+                }.build()
+            }
+            mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
+            // TODO: this should be extended with other serializers
+            else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.")
+        }
+
+    protected inline fun <reified T: Any?> responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? {
+        if(body == null) {
+            return null
+        }
+        val bodyContent = body.string()
+        if (bodyContent.isEmpty()) {
+            return null
+        }
+        return when(mediaType) {
+            JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent)
+            else ->  throw UnsupportedOperationException("responseBody currently only supports JSON body.")
+        }
+    }
+
+    protected fun updateAuthParams(requestConfig: RequestConfig) {
+        if (requestConfig.headers["api_key"].isNullOrEmpty()) {
+            if (apiKey["api_key"] != null) {
+                if (apiKeyPrefix["api_key"] != null) {
+                    requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!
+                } else {
+                    requestConfig.headers["api_key"] = apiKey["api_key"]!!
+                }
+            }
+        }
+        if (requestConfig.headers[Authorization].isNullOrEmpty()) {
+            accessToken?.let { accessToken ->
+                requestConfig.headers[Authorization] = "Bearer $accessToken "
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
+        val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
+
+        // take authMethod from operation
+        updateAuthParams(requestConfig)
+
+        val url = httpUrl.newBuilder()
+            .addPathSegments(requestConfig.path.trimStart('/'))
+            .apply {
+                requestConfig.query.forEach { query ->
+                    query.value.forEach { queryValue ->
+                        addQueryParameter(query.key, queryValue)
+                    }
+                }
+            }.build()
+
+        // take content-type/accept from spec or set to default (application/json) if not defined
+        if (requestConfig.headers[ContentType].isNullOrEmpty()) {
+            requestConfig.headers[ContentType] = JsonMediaType
+        }
+        if (requestConfig.headers[Accept].isNullOrEmpty()) {
+            requestConfig.headers[Accept] = JsonMediaType
+        }
+        val headers = requestConfig.headers
+
+        if(headers[ContentType] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Content-Type header. This is required.")
+        }
+
+        if(headers[Accept] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Accept header. This is required.")
+        }
+
+        // TODO: support multiple contentType options here.
+        val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
+
+        val request = when (requestConfig.method) {
+            RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
+            RequestMethod.GET -> Request.Builder().url(url)
+            RequestMethod.HEAD -> Request.Builder().url(url).head()
+            RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
+            RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
+            RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
+            RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
+        }.apply {
+            headers.forEach { header -> addHeader(header.key, header.value) }
+        }.build()
+
+        val response = client.newCall(request).execute()
+        val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
+
+        // TODO: handle specific mapping types. e.g. Map<int, Class<?>>
+        when {
+            response.isRedirect -> return Redirection(
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isInformational -> return Informational(
+                    response.message,
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isSuccessful -> return Success(
+                    responseBody(response.body, accept),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isClientError -> return ClientError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            else -> return ServerError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+        }
+    }
+
+    protected fun parameterToString(value: Any?): String {
+        when (value) {
+            null -> {
+                return ""
+            }
+            is Array<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is Iterable<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
+                return parseDateToQueryString<Any>(value)
+            }
+            else -> {
+                return value.toString()
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any> 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.moshi.adapter(T::class.java).toJson(value).replace("\"", "")
+    }
+}
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..77066de4e55955c13ca95d75ac00e2f0312c77bc
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
@@ -0,0 +1,43 @@
+package org.openapitools.client.infrastructure
+
+enum class ResponseType {
+    Success, Informational, Redirection, ClientError, ServerError
+}
+
+interface Response
+
+abstract class ApiInfrastructureResponse<T>(val responseType: ResponseType): Response {
+    abstract val statusCode: Int
+    abstract val headers: Map<String,List<String>>
+}
+
+class Success<T>(
+    val data: T?,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+): ApiInfrastructureResponse<T>(ResponseType.Success)
+
+class Informational<T>(
+    val statusText: String,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Informational)
+
+class Redirection<T>(
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Redirection)
+
+class ClientError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.ClientError)
+
+class ServerError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>>
+): ApiInfrastructureResponse<T>(ResponseType.ServerError)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
new file mode 100644
index 0000000000000000000000000000000000000000..dd34bd48b2c01a3b2cc449fd1952635bfb9c0c85
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
@@ -0,0 +1,29 @@
+package org.openapitools.client.infrastructure
+
+import kotlin.properties.ReadWriteProperty
+import kotlin.reflect.KProperty
+
+object ApplicationDelegates {
+    /**
+     * Provides a property delegate, allowing the property to be set once and only once.
+     *
+     * If unset (no default value), a get on the property will throw [IllegalStateException].
+     */
+    fun <T> setOnce(defaultValue: T? = null) : ReadWriteProperty<Any?, T> = SetOnce(defaultValue)
+
+    private class SetOnce<T>(defaultValue: T? = null) : ReadWriteProperty<Any?, T> {
+        private var isSet = false
+        private var value: T? = defaultValue
+
+        override fun getValue(thisRef: Any?, property: KProperty<*>): T {
+            return value ?: throw IllegalStateException("${property.name} not initialized")
+        }
+
+        override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) {
+            if (!isSet) {
+                this.value = value
+                isSet = true
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ff5e2a81ee8ce2677c90a56384c165450f0c5b18
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
@@ -0,0 +1,12 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+
+class ByteArrayAdapter {
+    @ToJson
+    fun toJson(data: ByteArray): String = String(data)
+
+    @FromJson
+    fun fromJson(data: String): ByteArray = data.toByteArray()
+}
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Errors.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b5310e71f13c7e7fb874be998af37dd424d9cd11
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Errors.kt
@@ -0,0 +1,18 @@
+@file:Suppress("unused")
+package org.openapitools.client.infrastructure
+
+import java.lang.RuntimeException
+
+open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 123L
+    }
+}
+
+open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 456L
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b2e1654479a01d0c02930408910cc70d93f16c9d
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.LocalDate
+import java.time.format.DateTimeFormatter
+
+class LocalDateAdapter {
+    @ToJson
+    fun toJson(value: LocalDate): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDate {
+        return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..e082db94811d386498db8b1cd56cf58af82bad56
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
+
+class LocalDateTimeAdapter {
+    @ToJson
+    fun toJson(value: LocalDateTime): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDateTime {
+        return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..87437871a31e6ae83dca8573985f7d178ce6f3e6
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.OffsetDateTime
+import java.time.format.DateTimeFormatter
+
+class OffsetDateTimeAdapter {
+    @ToJson
+    fun toJson(value: OffsetDateTime): String {
+        return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): OffsetDateTime {
+        return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
new file mode 100644
index 0000000000000000000000000000000000000000..0f2790f370e29d3fceb044c2309dd945cd562eeb
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
@@ -0,0 +1,17 @@
+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<String,String> because rfc2616 defines
+ *       multi-valued headers as csv-only.
+ */
+data class RequestConfig(
+    val method: RequestMethod,
+    val path: String,
+    val headers: MutableMap<String, String> = mutableMapOf(),
+    val query: MutableMap<String, List<String>> = mutableMapOf(),
+    val body: kotlin.Any? = null
+)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt
new file mode 100644
index 0000000000000000000000000000000000000000..931b12b8bd7a6dba7362eaafc490edf709d14616
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/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
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9bd2790dc144a3794c7957fdff86c114e5570c99
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
@@ -0,0 +1,24 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Response
+
+/**
+ * Provides an extension to evaluation whether the response is a 1xx code
+ */
+val Response.isInformational : Boolean get() = this.code in 100..199
+
+/**
+ * Provides an extension to evaluation whether the response is a 3xx code
+ */
+@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
+val Response.isRedirect : Boolean get() = this.code in 300..399
+
+/**
+ * Provides an extension to evaluation whether the response is a 4xx code
+ */
+val Response.isClientError : Boolean get() = this.code in 400..499
+
+/**
+ * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code
+ */
+val Response.isServerError : Boolean get() = this.code in 500..999
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Serializer.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9a45b67d9b1a435f1ebfa35c6d6c0fd329cea27b
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/Serializer.kt
@@ -0,0 +1,21 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.Moshi
+import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
+import java.util.Date
+
+object Serializer {
+    @JvmStatic
+    val moshiBuilder: Moshi.Builder = Moshi.Builder()
+        .add(OffsetDateTimeAdapter())
+        .add(LocalDateTimeAdapter())
+        .add(LocalDateAdapter())
+        .add(UUIDAdapter())
+        .add(ByteArrayAdapter())
+        .add(KotlinJsonAdapterFactory())
+
+    @JvmStatic
+    val moshi: Moshi by lazy {
+        moshiBuilder.build()
+    }
+}
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a4a44cc18b73e4a0ec722fa385e0276dbfbac670
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
@@ -0,0 +1,13 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.util.UUID
+
+class UUIDAdapter {
+    @ToJson
+    fun toJson(uuid: UUID) = uuid.toString()
+
+    @FromJson
+    fun fromJson(s: String) = UUID.fromString(s)
+}
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/ApiResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..7d40c8efbc2f02676165dc9c33c00667df36cb87
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/ApiResponse.kt
@@ -0,0 +1,38 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+import java.io.Serializable
+
+/**
+ * Describes the result of uploading an image resource
+ * @param code 
+ * @param type 
+ * @param message 
+ */
+
+data class ApiResponse (
+    @Json(name = "code")
+    val code: kotlin.Int? = null,
+    @Json(name = "type")
+    val type: kotlin.String? = null,
+    @Json(name = "message")
+    val message: kotlin.String? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+}
+
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Category.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ceb0fbc8fe6087d846ab9681db045aacdafe6d9a
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Category.kt
@@ -0,0 +1,35 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+import java.io.Serializable
+
+/**
+ * A category for a pet
+ * @param id 
+ * @param name 
+ */
+
+data class Category (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "name")
+    val name: kotlin.String? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+}
+
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Order.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ed8f8b13a43bbd6ec2676bde2e3efd0dbaefa2cd
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Order.kt
@@ -0,0 +1,58 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+import java.io.Serializable
+
+/**
+ * An order for a pets from the pet store
+ * @param id 
+ * @param petId 
+ * @param quantity 
+ * @param shipDate 
+ * @param status Order Status
+ * @param complete 
+ */
+
+data class Order (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "petId")
+    val petId: kotlin.Long? = null,
+    @Json(name = "quantity")
+    val quantity: kotlin.Int? = null,
+    @Json(name = "shipDate")
+    val shipDate: java.time.OffsetDateTime? = null,
+    /* Order Status */
+    @Json(name = "status")
+    val status: Order.Status? = null,
+    @Json(name = "complete")
+    val complete: kotlin.Boolean? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+    /**
+    * Order Status
+    * Values: placed,approved,delivered
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @Json(name = "placed") placed("placed"),
+        @Json(name = "approved") approved("approved"),
+        @Json(name = "delivered") delivered("delivered");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Pet.kt
new file mode 100644
index 0000000000000000000000000000000000000000..105f485f021d0465393491221f926e9246331fb1
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Pet.kt
@@ -0,0 +1,60 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+import org.openapitools.client.models.Category
+import org.openapitools.client.models.Tag
+
+import com.squareup.moshi.Json
+import java.io.Serializable
+
+/**
+ * A pet for sale in the pet store
+ * @param name 
+ * @param photoUrls 
+ * @param id 
+ * @param category 
+ * @param tags 
+ * @param status pet status in the store
+ */
+
+data class Pet (
+    @Json(name = "name")
+    val name: kotlin.String,
+    @Json(name = "photoUrls")
+    val photoUrls: kotlin.collections.List<kotlin.String>,
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "category")
+    val category: Category? = null,
+    @Json(name = "tags")
+    val tags: kotlin.collections.List<Tag>? = null,
+    /* pet status in the store */
+    @Json(name = "status")
+    val status: Pet.Status? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+    /**
+    * pet status in the store
+    * Values: available,pending,sold
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @Json(name = "available") available("available"),
+        @Json(name = "pending") pending("pending"),
+        @Json(name = "sold") sold("sold");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Tag.kt
new file mode 100644
index 0000000000000000000000000000000000000000..944b1cd0a141546f8e31f284f522276edc1f299b
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/Tag.kt
@@ -0,0 +1,35 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+import java.io.Serializable
+
+/**
+ * A tag for a pet
+ * @param id 
+ * @param name 
+ */
+
+data class Tag (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "name")
+    val name: kotlin.String? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+}
+
diff --git a/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/User.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9697f07d5bf881ae0ca1f808a4a00866b7030603
--- /dev/null
+++ b/samples/client/petstore/kotlin-nullable/bin/main/org/openapitools/client/models/User.kt
@@ -0,0 +1,54 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+import java.io.Serializable
+
+/**
+ * A User who is purchasing from the pet store
+ * @param id 
+ * @param username 
+ * @param firstName 
+ * @param lastName 
+ * @param email 
+ * @param password 
+ * @param phone 
+ * @param userStatus User Status
+ */
+
+data class User (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "username")
+    val username: kotlin.String? = null,
+    @Json(name = "firstName")
+    val firstName: kotlin.String? = null,
+    @Json(name = "lastName")
+    val lastName: kotlin.String? = null,
+    @Json(name = "email")
+    val email: kotlin.String? = null,
+    @Json(name = "password")
+    val password: kotlin.String? = null,
+    @Json(name = "phone")
+    val phone: kotlin.String? = null,
+    /* User Status */
+    @Json(name = "userStatus")
+    val userStatus: kotlin.Int? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+}
+
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/PetApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..c8b93b33bf6f60435de09774f61ab084f7fafd04
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/PetApi.kt
@@ -0,0 +1,492 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.ApiResponse
+import org.openapitools.client.models.Pet
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Add a new pet to the store
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun addPet(body: Pet) : Unit {
+        val localVariableConfig = addPetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation addPet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun addPetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Deletes a pet
+    * 
+    * @param petId Pet id to delete 
+    * @param apiKey  (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
+        val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deletePet
+    *
+    * @param petId Pet id to delete 
+    * @param apiKey  (optional)
+    * @return RequestConfig
+    */
+    fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by status
+    * Multiple status values can be provided with comma separated strings
+    * @param status Status values that need to be considered for filter 
+    * @return kotlin.collections.List<Pet>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
+        val localVariableConfig = findPetsByStatusRequestConfig(status = status)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByStatus
+    *
+    * @param status Status values that need to be considered for filter 
+    * @return RequestConfig
+    */
+    fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("status", toMultiValue(status.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByStatus",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by tags
+    * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+    * @param tags Tags to filter by 
+    * @return kotlin.collections.List<Pet>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
+        val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByTags
+    *
+    * @param tags Tags to filter by 
+    * @return RequestConfig
+    */
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("tags", toMultiValue(tags.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByTags",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find pet by ID
+    * Returns a single pet
+    * @param petId ID of pet to return 
+    * @return Pet
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getPetById(petId: kotlin.Long) : Pet {
+        val localVariableConfig = getPetByIdRequestConfig(petId = petId)
+
+        val localVarResponse = request<Pet>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Pet
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getPetById
+    *
+    * @param petId ID of pet to return 
+    * @return RequestConfig
+    */
+    fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Update an existing pet
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updatePet(body: Pet) : Unit {
+        val localVariableConfig = updatePetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun updatePetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updates a pet in the store with form data
+    * 
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
+        val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePetWithForm
+    *
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return RequestConfig
+    */
+    fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * uploads an image
+    * 
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return ApiResponse
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
+        val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
+
+        val localVarResponse = request<ApiResponse>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation uploadFile
+    *
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return RequestConfig
+    */
+    fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/StoreApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..215ed63420c9d538efe258fcc1244627caa4b8e1
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/StoreApi.kt
@@ -0,0 +1,253 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.Order
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Delete purchase order by ID
+    * For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
+    * @param orderId ID of the order that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deleteOrder(orderId: kotlin.String) : Unit {
+        val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteOrder
+    *
+    * @param orderId ID of the order that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Returns pet inventories by status
+    * Returns a map of status codes to quantities
+    * @return kotlin.collections.Map<kotlin.String, kotlin.Int>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
+        val localVariableConfig = getInventoryRequestConfig()
+
+        val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map<kotlin.String, kotlin.Int>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getInventory
+    *
+    * @return RequestConfig
+    */
+    fun getInventoryRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/inventory",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find purchase order by ID
+    * For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
+    * @param orderId ID of pet that needs to be fetched 
+    * @return Order
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getOrderById(orderId: kotlin.Long) : Order {
+        val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getOrderById
+    *
+    * @param orderId ID of pet that needs to be fetched 
+    * @return RequestConfig
+    */
+    fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Place an order for a pet
+    * 
+    * @param body order placed for purchasing the pet 
+    * @return Order
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun placeOrder(body: Order) : Order {
+        val localVariableConfig = placeOrderRequestConfig(body = body)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation placeOrder
+    *
+    * @param body order placed for purchasing the pet 
+    * @return RequestConfig
+    */
+    fun placeOrderRequestConfig(body: Order) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/store/order",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/UserApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..53748b934636efed3e534dcce15de3d659631c0e
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/apis/UserApi.kt
@@ -0,0 +1,476 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.User
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Create user
+    * This can only be done by the logged in user.
+    * @param body Created user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUser(body: User) : Unit {
+        val localVariableConfig = createUserRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUser
+    *
+    * @param body Created user object 
+    * @return RequestConfig
+    */
+    fun createUserRequestConfig(body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithArrayInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithArray",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithListInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithList",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Delete user
+    * This can only be done by the logged in user.
+    * @param username The name that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deleteUser(username: kotlin.String) : Unit {
+        val localVariableConfig = deleteUserRequestConfig(username = username)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteUser
+    *
+    * @param username The name that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Get user by user name
+    * 
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return User
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getUserByName(username: kotlin.String) : User {
+        val localVariableConfig = getUserByNameRequestConfig(username = username)
+
+        val localVarResponse = request<User>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as User
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getUserByName
+    *
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return RequestConfig
+    */
+    fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs user into the system
+    * 
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return kotlin.String
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
+        val localVariableConfig = loginUserRequestConfig(username = username, password = password)
+
+        val localVarResponse = request<kotlin.String>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation loginUser
+    *
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return RequestConfig
+    */
+    fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("username", listOf(username.toString()))
+                put("password", listOf(password.toString()))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/login",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs out current logged in user session
+    * 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun logoutUser() : Unit {
+        val localVariableConfig = logoutUserRequestConfig()
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation logoutUser
+    *
+    * @return RequestConfig
+    */
+    fun logoutUserRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/logout",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updated user
+    * This can only be done by the logged in user.
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updateUser(username: kotlin.String, body: User) : Unit {
+        val localVariableConfig = updateUserRequestConfig(username = username, body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updateUser
+    *
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return RequestConfig
+    */
+    fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ef7a8f1e1a625f7efdbea17077de86da8e09f805
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
@@ -0,0 +1,23 @@
+package org.openapitools.client.infrastructure
+
+typealias MultiValueMap = MutableMap<String,List<String>>
+
+fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
+    "csv" -> ","
+    "tsv" -> "\t"
+    "pipe" -> "|"
+    "space" -> " "
+    else -> ""
+}
+
+val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
+
+fun <T : Any?> toMultiValue(items: Array<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter)
+        = toMultiValue(items.asIterable(), collectionFormat, map)
+
+fun <T : Any?> toMultiValue(items: Iterable<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String> {
+    return when(collectionFormat) {
+        "multi" -> items.map(map)
+        else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map))
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9d526273d7ac165afb2cc64a863d18e23c7351de
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
@@ -0,0 +1,249 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Credentials
+import okhttp3.OkHttpClient
+import okhttp3.RequestBody
+import okhttp3.MediaType
+import okhttp3.FormBody
+import okhttp3.HttpUrl
+import okhttp3.ResponseBody
+import okhttp3.Request
+import okhttp3.Headers
+import okhttp3.MultipartBody
+import java.io.File
+import java.net.URLConnection
+import java.util.Date
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.LocalTime
+import java.time.OffsetDateTime
+import java.time.OffsetTime
+
+open class ApiClient(val baseUrl: String) {
+    companion object {
+        protected const val ContentType = "Content-Type"
+        protected const val Accept = "Accept"
+        protected const val Authorization = "Authorization"
+        protected const val JsonMediaType = "application/json"
+        protected const val FormDataMediaType = "multipart/form-data"
+        protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded"
+        protected const val XmlMediaType = "application/xml"
+
+        val apiKey: MutableMap<String, String> = mutableMapOf()
+        val apiKeyPrefix: MutableMap<String, String> = mutableMapOf()
+        var username: String? = null
+        var password: String? = null
+        var accessToken: String? = null
+
+        @JvmStatic
+        val client: OkHttpClient by lazy {
+            builder.build()
+        }
+
+        @JvmStatic
+        val builder: OkHttpClient.Builder = OkHttpClient.Builder()
+    }
+
+    /**
+     * Guess Content-Type header from the given file (defaults to "application/octet-stream").
+     *
+     * @param file The given file
+     * @return The guessed Content-Type
+     */
+    protected fun guessContentTypeFromFile(file: File): String {
+        val contentType = URLConnection.guessContentTypeFromName(file.name)
+        return contentType ?: "application/octet-stream"
+    }
+
+    protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
+        when {
+            content is File -> RequestBody.create(
+                MediaType.parse(mediaType), content
+            )
+            mediaType == FormDataMediaType -> {
+                MultipartBody.Builder()
+                    .setType(MultipartBody.FORM)
+                    .apply {
+                        // content's type *must* be Map<String, Any?>
+                        @Suppress("UNCHECKED_CAST")
+                        (content as Map<String, Any?>).forEach { (key, value) ->
+                            if (value is File) {
+                                val partHeaders = Headers.of(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\"; filename=\"${value.name}\""
+                                )
+                                val fileMediaType = MediaType.parse(guessContentTypeFromFile(value))
+                                addPart(partHeaders, RequestBody.create(fileMediaType, value))
+                            } else {
+                                val partHeaders = Headers.of(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\""
+                                )
+                                addPart(
+                                    partHeaders,
+                                    RequestBody.create(null, parameterToString(value))
+                                )
+                            }
+                        }
+                    }.build()
+            }
+            mediaType == FormUrlEncMediaType -> {
+                FormBody.Builder().apply {
+                    // content's type *must* be Map<String, Any?>
+                    @Suppress("UNCHECKED_CAST")
+                    (content as Map<String, Any?>).forEach { (key, value) ->
+                        add(key, parameterToString(value))
+                    }
+                }.build()
+            }
+            mediaType == JsonMediaType -> RequestBody.create(
+                MediaType.parse(mediaType), Serializer.moshi.adapter(T::class.java).toJson(content)
+            )
+            mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
+            // TODO: this should be extended with other serializers
+            else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.")
+        }
+
+    protected inline fun <reified T: Any?> responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? {
+        if(body == null) {
+            return null
+        }
+        val bodyContent = body.string()
+        if (bodyContent.isEmpty()) {
+            return null
+        }
+        return when(mediaType) {
+            JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent)
+            else ->  throw UnsupportedOperationException("responseBody currently only supports JSON body.")
+        }
+    }
+
+    protected fun updateAuthParams(requestConfig: RequestConfig) {
+        if (requestConfig.headers["api_key"].isNullOrEmpty()) {
+            if (apiKey["api_key"] != null) {
+                if (apiKeyPrefix["api_key"] != null) {
+                    requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!
+                } else {
+                    requestConfig.headers["api_key"] = apiKey["api_key"]!!
+                }
+            }
+        }
+        if (requestConfig.headers[Authorization].isNullOrEmpty()) {
+            accessToken?.let { accessToken ->
+                requestConfig.headers[Authorization] = "Bearer $accessToken "
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
+        val httpUrl = HttpUrl.parse(baseUrl) ?: throw IllegalStateException("baseUrl is invalid.")
+
+        // take authMethod from operation
+        updateAuthParams(requestConfig)
+
+        val url = httpUrl.newBuilder()
+            .addPathSegments(requestConfig.path.trimStart('/'))
+            .apply {
+                requestConfig.query.forEach { query ->
+                    query.value.forEach { queryValue ->
+                        addQueryParameter(query.key, queryValue)
+                    }
+                }
+            }.build()
+
+        // take content-type/accept from spec or set to default (application/json) if not defined
+        if (requestConfig.headers[ContentType].isNullOrEmpty()) {
+            requestConfig.headers[ContentType] = JsonMediaType
+        }
+        if (requestConfig.headers[Accept].isNullOrEmpty()) {
+            requestConfig.headers[Accept] = JsonMediaType
+        }
+        val headers = requestConfig.headers
+
+        if(headers[ContentType] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Content-Type header. This is required.")
+        }
+
+        if(headers[Accept] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Accept header. This is required.")
+        }
+
+        // TODO: support multiple contentType options here.
+        val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
+
+        val request = when (requestConfig.method) {
+            RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
+            RequestMethod.GET -> Request.Builder().url(url)
+            RequestMethod.HEAD -> Request.Builder().url(url).head()
+            RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
+            RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
+            RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
+            RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
+        }.apply {
+            headers.forEach { header -> addHeader(header.key, header.value) }
+        }.build()
+
+        val response = client.newCall(request).execute()
+        val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
+
+        // TODO: handle specific mapping types. e.g. Map<int, Class<?>>
+        when {
+            response.isRedirect -> return Redirection(
+                    response.code(),
+                    response.headers().toMultimap()
+            )
+            response.isInformational -> return Informational(
+                    response.message(),
+                    response.code(),
+                    response.headers().toMultimap()
+            )
+            response.isSuccessful -> return Success(
+                    responseBody(response.body(), accept),
+                    response.code(),
+                    response.headers().toMultimap()
+            )
+            response.isClientError -> return ClientError(
+                    response.message(),
+                    response.body()?.string(),
+                    response.code(),
+                    response.headers().toMultimap()
+            )
+            else -> return ServerError(
+                    response.message(),
+                    response.body()?.string(),
+                    response.code(),
+                    response.headers().toMultimap()
+            )
+        }
+    }
+
+    protected fun parameterToString(value: Any?): String {
+        when (value) {
+            null -> {
+                return ""
+            }
+            is Array<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is Iterable<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
+                return parseDateToQueryString<Any>(value)
+            }
+            else -> {
+                return value.toString()
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any> 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.moshi.adapter(T::class.java).toJson(value).replace("\"", "")
+    }
+}
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9dc8d8dbbfaaef4f86a4f65b8a908ba9e4507060
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
@@ -0,0 +1,43 @@
+package org.openapitools.client.infrastructure
+
+enum class ResponseType {
+    Success, Informational, Redirection, ClientError, ServerError
+}
+
+interface Response
+
+abstract class ApiInfrastructureResponse<T>(val responseType: ResponseType): Response {
+    abstract val statusCode: Int
+    abstract val headers: Map<String,List<String>>
+}
+
+class Success<T>(
+    val data: T,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+): ApiInfrastructureResponse<T>(ResponseType.Success)
+
+class Informational<T>(
+    val statusText: String,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Informational)
+
+class Redirection<T>(
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Redirection)
+
+class ClientError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.ClientError)
+
+class ServerError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>>
+): ApiInfrastructureResponse<T>(ResponseType.ServerError)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
new file mode 100644
index 0000000000000000000000000000000000000000..dd34bd48b2c01a3b2cc449fd1952635bfb9c0c85
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
@@ -0,0 +1,29 @@
+package org.openapitools.client.infrastructure
+
+import kotlin.properties.ReadWriteProperty
+import kotlin.reflect.KProperty
+
+object ApplicationDelegates {
+    /**
+     * Provides a property delegate, allowing the property to be set once and only once.
+     *
+     * If unset (no default value), a get on the property will throw [IllegalStateException].
+     */
+    fun <T> setOnce(defaultValue: T? = null) : ReadWriteProperty<Any?, T> = SetOnce(defaultValue)
+
+    private class SetOnce<T>(defaultValue: T? = null) : ReadWriteProperty<Any?, T> {
+        private var isSet = false
+        private var value: T? = defaultValue
+
+        override fun getValue(thisRef: Any?, property: KProperty<*>): T {
+            return value ?: throw IllegalStateException("${property.name} not initialized")
+        }
+
+        override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) {
+            if (!isSet) {
+                this.value = value
+                isSet = true
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ff5e2a81ee8ce2677c90a56384c165450f0c5b18
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
@@ -0,0 +1,12 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+
+class ByteArrayAdapter {
+    @ToJson
+    fun toJson(data: ByteArray): String = String(data)
+
+    @FromJson
+    fun fromJson(data: String): ByteArray = data.toByteArray()
+}
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Errors.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b5310e71f13c7e7fb874be998af37dd424d9cd11
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Errors.kt
@@ -0,0 +1,18 @@
+@file:Suppress("unused")
+package org.openapitools.client.infrastructure
+
+import java.lang.RuntimeException
+
+open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 123L
+    }
+}
+
+open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 456L
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b2e1654479a01d0c02930408910cc70d93f16c9d
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.LocalDate
+import java.time.format.DateTimeFormatter
+
+class LocalDateAdapter {
+    @ToJson
+    fun toJson(value: LocalDate): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDate {
+        return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..e082db94811d386498db8b1cd56cf58af82bad56
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
+
+class LocalDateTimeAdapter {
+    @ToJson
+    fun toJson(value: LocalDateTime): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDateTime {
+        return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..87437871a31e6ae83dca8573985f7d178ce6f3e6
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.OffsetDateTime
+import java.time.format.DateTimeFormatter
+
+class OffsetDateTimeAdapter {
+    @ToJson
+    fun toJson(value: OffsetDateTime): String {
+        return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): OffsetDateTime {
+        return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
new file mode 100644
index 0000000000000000000000000000000000000000..0f2790f370e29d3fceb044c2309dd945cd562eeb
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
@@ -0,0 +1,17 @@
+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<String,String> because rfc2616 defines
+ *       multi-valued headers as csv-only.
+ */
+data class RequestConfig(
+    val method: RequestMethod,
+    val path: String,
+    val headers: MutableMap<String, String> = mutableMapOf(),
+    val query: MutableMap<String, List<String>> = mutableMapOf(),
+    val body: kotlin.Any? = null
+)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt
new file mode 100644
index 0000000000000000000000000000000000000000..931b12b8bd7a6dba7362eaafc490edf709d14616
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/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
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..037fedbd18bdb96002e7948f464dbb0c1d815f2a
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
@@ -0,0 +1,24 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Response
+
+/**
+ * Provides an extension to evaluation whether the response is a 1xx code
+ */
+val Response.isInformational : Boolean get() = this.code() in 100..199
+
+/**
+ * Provides an extension to evaluation whether the response is a 3xx code
+ */
+@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
+val Response.isRedirect : Boolean get() = this.code() in 300..399
+
+/**
+ * Provides an extension to evaluation whether the response is a 4xx code
+ */
+val Response.isClientError : Boolean get() = this.code() in 400..499
+
+/**
+ * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code
+ */
+val Response.isServerError : Boolean get() = this.code() in 500..999
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Serializer.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9a45b67d9b1a435f1ebfa35c6d6c0fd329cea27b
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/Serializer.kt
@@ -0,0 +1,21 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.Moshi
+import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
+import java.util.Date
+
+object Serializer {
+    @JvmStatic
+    val moshiBuilder: Moshi.Builder = Moshi.Builder()
+        .add(OffsetDateTimeAdapter())
+        .add(LocalDateTimeAdapter())
+        .add(LocalDateAdapter())
+        .add(UUIDAdapter())
+        .add(ByteArrayAdapter())
+        .add(KotlinJsonAdapterFactory())
+
+    @JvmStatic
+    val moshi: Moshi by lazy {
+        moshiBuilder.build()
+    }
+}
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a4a44cc18b73e4a0ec722fa385e0276dbfbac670
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
@@ -0,0 +1,13 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.util.UUID
+
+class UUIDAdapter {
+    @ToJson
+    fun toJson(uuid: UUID) = uuid.toString()
+
+    @FromJson
+    fun fromJson(s: String) = UUID.fromString(s)
+}
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/ApiResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..fafca8738f663b840b5a6a005cf320c5f0aa1a68
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/ApiResponse.kt
@@ -0,0 +1,32 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * Describes the result of uploading an image resource
+ * @param code 
+ * @param type 
+ * @param message 
+ */
+
+data class ApiResponse (
+    @Json(name = "code")
+    val code: kotlin.Int? = null,
+    @Json(name = "type")
+    val type: kotlin.String? = null,
+    @Json(name = "message")
+    val message: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Category.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a4c17c3b49ddf7328874d853f6022b5f80ac057c
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Category.kt
@@ -0,0 +1,29 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * A category for a pet
+ * @param id 
+ * @param name 
+ */
+
+data class Category (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "name")
+    val name: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Order.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a66c335904e714f99a07894143f35bb08a602712
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Order.kt
@@ -0,0 +1,54 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * An order for a pets from the pet store
+ * @param id 
+ * @param petId 
+ * @param quantity 
+ * @param shipDate 
+ * @param status Order Status
+ * @param complete 
+ */
+
+data class Order (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "petId")
+    val petId: kotlin.Long? = null,
+    @Json(name = "quantity")
+    val quantity: kotlin.Int? = null,
+    @Json(name = "shipDate")
+    val shipDate: java.time.OffsetDateTime? = null,
+    /* Order Status */
+    @Json(name = "status")
+    val status: Order.Status? = null,
+    @Json(name = "complete")
+    val complete: kotlin.Boolean? = null
+) {
+
+    /**
+    * Order Status
+    * Values: placed,approved,delivered
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @Json(name = "placed") placed("placed"),
+        @Json(name = "approved") approved("approved"),
+        @Json(name = "delivered") delivered("delivered");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Pet.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a3df06cb6eb3c1cd1ab6e0e4e083304f44ddb73e
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Pet.kt
@@ -0,0 +1,56 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+import org.openapitools.client.models.Category
+import org.openapitools.client.models.Tag
+
+import com.squareup.moshi.Json
+
+/**
+ * A pet for sale in the pet store
+ * @param name 
+ * @param photoUrls 
+ * @param id 
+ * @param category 
+ * @param tags 
+ * @param status pet status in the store
+ */
+
+data class Pet (
+    @Json(name = "name")
+    val name: kotlin.String,
+    @Json(name = "photoUrls")
+    val photoUrls: kotlin.collections.List<kotlin.String>,
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "category")
+    val category: Category? = null,
+    @Json(name = "tags")
+    val tags: kotlin.collections.List<Tag>? = null,
+    /* pet status in the store */
+    @Json(name = "status")
+    val status: Pet.Status? = null
+) {
+
+    /**
+    * pet status in the store
+    * Values: available,pending,sold
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @Json(name = "available") available("available"),
+        @Json(name = "pending") pending("pending"),
+        @Json(name = "sold") sold("sold");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Tag.kt
new file mode 100644
index 0000000000000000000000000000000000000000..6e619023a5c95599835a7a618d17f6e6813fae53
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/Tag.kt
@@ -0,0 +1,29 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * A tag for a pet
+ * @param id 
+ * @param name 
+ */
+
+data class Tag (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "name")
+    val name: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/User.kt
new file mode 100644
index 0000000000000000000000000000000000000000..af1e270325de4659cbfaaa68c2074ea309e1ef5b
--- /dev/null
+++ b/samples/client/petstore/kotlin-okhttp3/bin/main/org/openapitools/client/models/User.kt
@@ -0,0 +1,48 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * A User who is purchasing from the pet store
+ * @param id 
+ * @param username 
+ * @param firstName 
+ * @param lastName 
+ * @param email 
+ * @param password 
+ * @param phone 
+ * @param userStatus User Status
+ */
+
+data class User (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "username")
+    val username: kotlin.String? = null,
+    @Json(name = "firstName")
+    val firstName: kotlin.String? = null,
+    @Json(name = "lastName")
+    val lastName: kotlin.String? = null,
+    @Json(name = "email")
+    val email: kotlin.String? = null,
+    @Json(name = "password")
+    val password: kotlin.String? = null,
+    @Json(name = "phone")
+    val phone: kotlin.String? = null,
+    /* User Status */
+    @Json(name = "userStatus")
+    val userStatus: kotlin.Int? = null
+)
+
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/PetApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..90e791f37afad1f32fe172b24c8477dd9e961dc3
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/PetApi.kt
@@ -0,0 +1,125 @@
+package org.openapitools.client.apis
+
+import org.openapitools.client.infrastructure.CollectionFormats.*
+import retrofit2.http.*
+import okhttp3.RequestBody
+import io.reactivex.rxjava3.core.Single;
+import io.reactivex.rxjava3.core.Completable;
+
+import org.openapitools.client.models.ApiResponse
+import org.openapitools.client.models.Pet
+
+import okhttp3.MultipartBody
+
+interface PetApi {
+    /**
+     * Add a new pet to the store
+     * 
+     * Responses:
+     *  - 405: Invalid input
+     * 
+     * @param body Pet object that needs to be added to the store 
+     * @return [Call]<[Unit]>
+     */
+    @POST("pet")
+    fun addPet(@Body body: Pet): Completable
+
+    /**
+     * Deletes a pet
+     * 
+     * Responses:
+     *  - 400: Invalid pet value
+     * 
+     * @param petId Pet id to delete 
+     * @param apiKey  (optional)
+     * @return [Call]<[Unit]>
+     */
+    @DELETE("pet/{petId}")
+    fun deletePet(@Path("petId") petId: kotlin.Long, @Header("api_key") apiKey: kotlin.String): Completable
+
+    /**
+     * Finds Pets by status
+     * Multiple status values can be provided with comma separated strings
+     * Responses:
+     *  - 200: successful operation
+     *  - 400: Invalid status value
+     * 
+     * @param status Status values that need to be considered for filter 
+     * @return [Call]<[kotlin.collections.List<Pet>]>
+     */
+    @GET("pet/findByStatus")
+    fun findPetsByStatus(@Query("status") status: CSVParams): Single<kotlin.collections.List<Pet>>
+
+    /**
+     * Finds Pets by tags
+     * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+     * Responses:
+     *  - 200: successful operation
+     *  - 400: Invalid tag value
+     * 
+     * @param tags Tags to filter by 
+     * @return [Call]<[kotlin.collections.List<Pet>]>
+     */
+    @Deprecated("This api was deprecated")
+    @GET("pet/findByTags")
+    fun findPetsByTags(@Query("tags") tags: CSVParams): Single<kotlin.collections.List<Pet>>
+
+    /**
+     * Find pet by ID
+     * Returns a single pet
+     * Responses:
+     *  - 200: successful operation
+     *  - 400: Invalid ID supplied
+     *  - 404: Pet not found
+     * 
+     * @param petId ID of pet to return 
+     * @return [Call]<[Pet]>
+     */
+    @GET("pet/{petId}")
+    fun getPetById(@Path("petId") petId: kotlin.Long): Single<Pet>
+
+    /**
+     * Update an existing pet
+     * 
+     * Responses:
+     *  - 400: Invalid ID supplied
+     *  - 404: Pet not found
+     *  - 405: Validation exception
+     * 
+     * @param body Pet object that needs to be added to the store 
+     * @return [Call]<[Unit]>
+     */
+    @PUT("pet")
+    fun updatePet(@Body body: Pet): Completable
+
+    /**
+     * Updates a pet in the store with form data
+     * 
+     * Responses:
+     *  - 405: Invalid input
+     * 
+     * @param petId ID of pet that needs to be updated 
+     * @param name Updated name of the pet (optional)
+     * @param status Updated status of the pet (optional)
+     * @return [Call]<[Unit]>
+     */
+    @FormUrlEncoded
+    @POST("pet/{petId}")
+    fun updatePetWithForm(@Path("petId") petId: kotlin.Long, @Field("name") name: kotlin.String, @Field("status") status: kotlin.String): Completable
+
+    /**
+     * uploads an image
+     * 
+     * Responses:
+     *  - 200: successful operation
+     * 
+     * @param petId ID of pet to update 
+     * @param additionalMetadata Additional data to pass to server (optional)
+     * @param file file to upload (optional)
+     * @return [Call]<[ApiResponse]>
+     */
+    @Multipart
+    @POST("pet/{petId}/uploadImage")
+    fun uploadFile(@Path("petId") petId: kotlin.Long, @Part("additionalMetadata") additionalMetadata: kotlin.String, @Part file: MultipartBody.Part): Single<ApiResponse>
+
+}
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/StoreApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..11acb2eb8b700f34f20e1d9584fb5e594da6664a
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/StoreApi.kt
@@ -0,0 +1,63 @@
+package org.openapitools.client.apis
+
+import org.openapitools.client.infrastructure.CollectionFormats.*
+import retrofit2.http.*
+import okhttp3.RequestBody
+import io.reactivex.rxjava3.core.Single;
+import io.reactivex.rxjava3.core.Completable;
+
+import org.openapitools.client.models.Order
+
+interface StoreApi {
+    /**
+     * Delete purchase order by ID
+     * For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
+     * Responses:
+     *  - 400: Invalid ID supplied
+     *  - 404: Order not found
+     * 
+     * @param orderId ID of the order that needs to be deleted 
+     * @return [Call]<[Unit]>
+     */
+    @DELETE("store/order/{orderId}")
+    fun deleteOrder(@Path("orderId") orderId: kotlin.String): Completable
+
+    /**
+     * Returns pet inventories by status
+     * Returns a map of status codes to quantities
+     * Responses:
+     *  - 200: successful operation
+     * 
+     * @return [Call]<[kotlin.collections.Map<kotlin.String, kotlin.Int>]>
+     */
+    @GET("store/inventory")
+    fun getInventory(): Single<kotlin.collections.Map<kotlin.String, kotlin.Int>>
+
+    /**
+     * Find purchase order by ID
+     * For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
+     * Responses:
+     *  - 200: successful operation
+     *  - 400: Invalid ID supplied
+     *  - 404: Order not found
+     * 
+     * @param orderId ID of pet that needs to be fetched 
+     * @return [Call]<[Order]>
+     */
+    @GET("store/order/{orderId}")
+    fun getOrderById(@Path("orderId") orderId: kotlin.Long): Single<Order>
+
+    /**
+     * Place an order for a pet
+     * 
+     * Responses:
+     *  - 200: successful operation
+     *  - 400: Invalid Order
+     * 
+     * @param body order placed for purchasing the pet 
+     * @return [Call]<[Order]>
+     */
+    @POST("store/order")
+    fun placeOrder(@Body body: Order): Single<Order>
+
+}
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/UserApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..d6fad78e88f3962f71c54a4e89ffe193ff1a3022
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/apis/UserApi.kt
@@ -0,0 +1,114 @@
+package org.openapitools.client.apis
+
+import org.openapitools.client.infrastructure.CollectionFormats.*
+import retrofit2.http.*
+import okhttp3.RequestBody
+import io.reactivex.rxjava3.core.Single;
+import io.reactivex.rxjava3.core.Completable;
+
+import org.openapitools.client.models.User
+
+interface UserApi {
+    /**
+     * Create user
+     * This can only be done by the logged in user.
+     * Responses:
+     *  - 0: successful operation
+     * 
+     * @param body Created user object 
+     * @return [Call]<[Unit]>
+     */
+    @POST("user")
+    fun createUser(@Body body: User): Completable
+
+    /**
+     * Creates list of users with given input array
+     * 
+     * Responses:
+     *  - 0: successful operation
+     * 
+     * @param body List of user object 
+     * @return [Call]<[Unit]>
+     */
+    @POST("user/createWithArray")
+    fun createUsersWithArrayInput(@Body body: kotlin.collections.List<User>): Completable
+
+    /**
+     * Creates list of users with given input array
+     * 
+     * Responses:
+     *  - 0: successful operation
+     * 
+     * @param body List of user object 
+     * @return [Call]<[Unit]>
+     */
+    @POST("user/createWithList")
+    fun createUsersWithListInput(@Body body: kotlin.collections.List<User>): Completable
+
+    /**
+     * Delete user
+     * This can only be done by the logged in user.
+     * Responses:
+     *  - 400: Invalid username supplied
+     *  - 404: User not found
+     * 
+     * @param username The name that needs to be deleted 
+     * @return [Call]<[Unit]>
+     */
+    @DELETE("user/{username}")
+    fun deleteUser(@Path("username") username: kotlin.String): Completable
+
+    /**
+     * Get user by user name
+     * 
+     * Responses:
+     *  - 200: successful operation
+     *  - 400: Invalid username supplied
+     *  - 404: User not found
+     * 
+     * @param username The name that needs to be fetched. Use user1 for testing. 
+     * @return [Call]<[User]>
+     */
+    @GET("user/{username}")
+    fun getUserByName(@Path("username") username: kotlin.String): Single<User>
+
+    /**
+     * Logs user into the system
+     * 
+     * Responses:
+     *  - 200: successful operation
+     *  - 400: Invalid username/password supplied
+     * 
+     * @param username The user name for login 
+     * @param password The password for login in clear text 
+     * @return [Call]<[kotlin.String]>
+     */
+    @GET("user/login")
+    fun loginUser(@Query("username") username: kotlin.String, @Query("password") password: kotlin.String): Single<kotlin.String>
+
+    /**
+     * Logs out current logged in user session
+     * 
+     * Responses:
+     *  - 0: successful operation
+     * 
+     * @return [Call]<[Unit]>
+     */
+    @GET("user/logout")
+    fun logoutUser(): Completable
+
+    /**
+     * Updated user
+     * This can only be done by the logged in user.
+     * Responses:
+     *  - 400: Invalid user supplied
+     *  - 404: User not found
+     * 
+     * @param username name that need to be deleted 
+     * @param body Updated user object 
+     * @return [Call]<[Unit]>
+     */
+    @PUT("user/{username}")
+    fun updateUser(@Path("username") username: kotlin.String, @Body body: User): Completable
+
+}
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt
new file mode 100644
index 0000000000000000000000000000000000000000..524d5190ef8871a8338dc968d55359407548b2b9
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt
@@ -0,0 +1,50 @@
+package org.openapitools.client.auth
+
+import java.io.IOException
+import java.net.URI
+import java.net.URISyntaxException
+
+import okhttp3.Interceptor
+import okhttp3.Response
+
+class ApiKeyAuth(
+        private val location: String = "",
+        private val paramName: String = "",
+        private var apiKey: String = ""
+) : Interceptor {
+    
+    @Throws(IOException::class)
+    override fun intercept(chain: Interceptor.Chain): Response {
+        var request = chain.request()
+
+        if ("query" == location) {
+            var newQuery = request.url.toUri().query
+            val paramValue = "$paramName=$apiKey"
+            if (newQuery == null) {
+                newQuery = paramValue
+            } else {
+                newQuery += "&$paramValue"
+            }
+
+            val newUri: URI
+            try {
+                val oldUri = request.url.toUri()
+                newUri = URI(oldUri.scheme, oldUri.authority,
+                    oldUri.path, newQuery, oldUri.fragment)
+            } catch (e: URISyntaxException) {
+                throw IOException(e)
+            }
+
+            request = request.newBuilder().url(newUri.toURL()).build()
+        } else if ("header" == location) {
+            request = request.newBuilder()
+                    .addHeader(paramName, apiKey)
+                    .build()
+        } else if ("cookie" == location) {
+            request = request.newBuilder()
+                    .addHeader("Cookie", "$paramName=$apiKey")
+                    .build()
+        }
+        return chain.proceed(request)
+    }
+}
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuth.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuth.kt
new file mode 100644
index 0000000000000000000000000000000000000000..311a8f4397948f55baf8a25cc8ca758b51303019
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuth.kt
@@ -0,0 +1,151 @@
+package org.openapitools.client.auth
+
+import java.net.HttpURLConnection.HTTP_UNAUTHORIZED
+import java.net.HttpURLConnection.HTTP_FORBIDDEN
+
+import java.io.IOException
+
+import org.apache.oltu.oauth2.client.OAuthClient
+import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest
+import org.apache.oltu.oauth2.client.request.OAuthClientRequest
+import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder
+import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder
+import org.apache.oltu.oauth2.common.exception.OAuthProblemException
+import org.apache.oltu.oauth2.common.exception.OAuthSystemException
+import org.apache.oltu.oauth2.common.message.types.GrantType
+import org.apache.oltu.oauth2.common.token.BasicOAuthToken
+
+import okhttp3.Interceptor
+import okhttp3.OkHttpClient
+import okhttp3.Response
+
+class OAuth(
+        client: OkHttpClient,
+        var tokenRequestBuilder: TokenRequestBuilder
+) : Interceptor {
+
+    interface AccessTokenListener {
+        fun notify(token: BasicOAuthToken)
+    }
+
+    private var oauthClient: OAuthClient = OAuthClient(OAuthOkHttpClient(client))
+
+    @Volatile 
+    private var accessToken: String? = null
+    var authenticationRequestBuilder: AuthenticationRequestBuilder? = null
+    private var accessTokenListener: AccessTokenListener? = null
+
+    constructor(
+            requestBuilder: TokenRequestBuilder
+    ) : this(
+            OkHttpClient(), 
+            requestBuilder
+    )
+
+    constructor(
+            flow: OAuthFlow, 
+            authorizationUrl: String, 
+            tokenUrl: String, 
+            scopes: String
+    ) : this(
+            OAuthClientRequest.tokenLocation(tokenUrl).setScope(scopes)
+    ) {
+        setFlow(flow);
+        authenticationRequestBuilder = OAuthClientRequest.authorizationLocation(authorizationUrl);
+    }
+
+    fun setFlow(flow: OAuthFlow) {
+        when (flow) {
+            OAuthFlow.accessCode, OAuthFlow.implicit ->
+                tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE)
+            OAuthFlow.password ->
+                tokenRequestBuilder.setGrantType(GrantType.PASSWORD)
+            OAuthFlow.application ->
+                tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS)
+        }            
+    }
+
+    @Throws(IOException::class)
+    override fun intercept(chain: Interceptor.Chain): Response {
+        return retryingIntercept(chain, true)
+    }
+
+    @Throws(IOException::class)
+    private fun retryingIntercept(chain: Interceptor.Chain, updateTokenAndRetryOnAuthorizationFailure: Boolean): Response {
+        var request = chain.request()
+
+        // If the request already have an authorization (eg. Basic auth), do nothing
+        if (request.header("Authorization") != null) {
+            return chain.proceed(request)
+        }
+
+        // If first time, get the token
+        val oAuthRequest: OAuthClientRequest
+        if (accessToken == null) {
+            updateAccessToken(null)
+        }
+
+        if (accessToken != null) {
+            // Build the request
+            val rb = request.newBuilder()
+
+            val requestAccessToken = accessToken
+            try {
+                oAuthRequest = OAuthBearerClientRequest(request.url.toString())
+                        .setAccessToken(requestAccessToken)
+                        .buildHeaderMessage()
+            } catch (e: OAuthSystemException) {
+                throw IOException(e)
+            }
+
+            oAuthRequest.headers.entries.forEach { header ->
+                rb.addHeader(header.key, header.value)
+            }
+            rb.url(oAuthRequest.locationUri)
+
+            //Execute the request
+            val response = chain.proceed(rb.build())
+
+            // 401/403 most likely indicates that access token has expired. Unless it happens two times in a row.
+            if ((response.code == HTTP_UNAUTHORIZED || response.code == HTTP_FORBIDDEN) && updateTokenAndRetryOnAuthorizationFailure) {
+                try {
+                    if (updateAccessToken(requestAccessToken)) {
+                        response.body?.close()
+                        return retryingIntercept(chain, false)
+                    }
+                } catch (e: Exception) {
+                    response.body?.close()
+                    throw e
+                }
+            }
+            return response
+        } else {
+            return chain.proceed(chain.request())
+        }
+    }
+
+    /**
+     * Returns true if the access token has been updated
+     */
+    @Throws(IOException::class)
+    @Synchronized 
+    fun updateAccessToken(requestAccessToken: String?): Boolean {
+        if (accessToken == null || accessToken.equals(requestAccessToken)) {    
+            return try {
+                val accessTokenResponse = oauthClient.accessToken(this.tokenRequestBuilder.buildBodyMessage())
+                if (accessTokenResponse != null && accessTokenResponse.accessToken != null) {
+                    accessToken = accessTokenResponse.accessToken
+                    accessTokenListener?.notify(accessTokenResponse.oAuthToken as BasicOAuthToken)
+                    !accessToken.equals(requestAccessToken)
+                } else {
+                    false
+                }
+            } catch (e: OAuthSystemException) {
+                throw IOException(e)
+            } catch (e: OAuthProblemException) {
+                throw IOException(e)
+            }
+        }
+        return true;
+    }
+}
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthFlow.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthFlow.kt
new file mode 100644
index 0000000000000000000000000000000000000000..bcada9b7a6a2bcfa70a44718cf3766ae02a4204c
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthFlow.kt
@@ -0,0 +1,5 @@
+package org.openapitools.client.auth
+
+enum class OAuthFlow {
+    accessCode, implicit, password, application
+}
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt
new file mode 100644
index 0000000000000000000000000000000000000000..93adbda3fc98535f37b13675ded49bd2f39c6c1e
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt
@@ -0,0 +1,61 @@
+package org.openapitools.client.auth
+
+import java.io.IOException
+
+import org.apache.oltu.oauth2.client.HttpClient
+import org.apache.oltu.oauth2.client.request.OAuthClientRequest
+import org.apache.oltu.oauth2.client.response.OAuthClientResponse
+import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory
+import org.apache.oltu.oauth2.common.exception.OAuthProblemException
+import org.apache.oltu.oauth2.common.exception.OAuthSystemException
+
+import okhttp3.OkHttpClient
+import okhttp3.Request
+import okhttp3.MediaType.Companion.toMediaTypeOrNull
+import okhttp3.RequestBody
+
+
+class OAuthOkHttpClient(
+        private var client: OkHttpClient
+) : HttpClient {
+
+    constructor() : this(OkHttpClient())
+
+    @Throws(OAuthSystemException::class, OAuthProblemException::class)
+    override fun <T : OAuthClientResponse?> execute(
+            request: OAuthClientRequest, 
+            headers: Map<String, String>?,
+            requestMethod: String, 
+            responseClass: Class<T>?): T {
+
+        var mediaType = "application/json".toMediaTypeOrNull()
+        val requestBuilder = Request.Builder().url(request.locationUri)
+
+        headers?.forEach { entry ->
+            if (entry.key.equals("Content-Type", true)) {
+                mediaType = entry.value.toMediaTypeOrNull()
+            } else {
+                requestBuilder.addHeader(entry.key, entry.value)
+            }
+        }
+
+        val body: RequestBody? = if (request.body != null) RequestBody.create(mediaType, request.body) else null
+        requestBuilder.method(requestMethod, body)
+
+        try {
+            val response = client.newCall(requestBuilder.build()).execute()
+            return OAuthClientResponseFactory.createCustomResponse(
+                    response.body?.string(), 
+                    response.body?.contentType()?.toString(),
+                    response.code,
+                    responseClass)
+        } catch (e: IOException) {
+            throw OAuthSystemException(e)
+        }
+    }
+
+    override fun shutdown() {
+        // Nothing to do here
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
new file mode 100644
index 0000000000000000000000000000000000000000..30f649932fc3c118f951f21eee169d2b9b5b5dcd
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
@@ -0,0 +1,203 @@
+package org.openapitools.client.infrastructure
+
+import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder
+import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder
+import org.openapitools.client.auth.ApiKeyAuth
+import org.openapitools.client.auth.OAuth
+import org.openapitools.client.auth.OAuth.AccessTokenListener
+import org.openapitools.client.auth.OAuthFlow
+
+import okhttp3.Interceptor
+import okhttp3.OkHttpClient
+import retrofit2.Retrofit
+import okhttp3.logging.HttpLoggingInterceptor
+import retrofit2.converter.scalars.ScalarsConverterFactory
+import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory
+import com.squareup.moshi.Moshi
+import retrofit2.converter.moshi.MoshiConverterFactory
+
+class ApiClient(
+    private var baseUrl: String = defaultBasePath,
+    private val okHttpClientBuilder: OkHttpClient.Builder? = null,
+    private val serializerBuilder: Moshi.Builder = Serializer.moshiBuilder,
+    private val okHttpClient : OkHttpClient? = null
+) {
+    private val apiAuthorizations = mutableMapOf<String, Interceptor>()
+    var logger: ((String) -> Unit)? = null
+
+    private val retrofitBuilder: Retrofit.Builder by lazy {
+        Retrofit.Builder()
+            .baseUrl(baseUrl)
+            .addConverterFactory(ScalarsConverterFactory.create())
+
+            .addCallAdapterFactory(RxJava3CallAdapterFactory.create())
+            .addConverterFactory(MoshiConverterFactory.create(serializerBuilder.build()))
+    }
+
+    private val clientBuilder: OkHttpClient.Builder by lazy {
+        okHttpClientBuilder ?: defaultClientBuilder
+    }
+
+    private val defaultClientBuilder: OkHttpClient.Builder by lazy {
+        OkHttpClient()
+            .newBuilder()
+            .addInterceptor(HttpLoggingInterceptor(object : HttpLoggingInterceptor.Logger {
+                override fun log(message: String) {
+                    logger?.invoke(message)
+                }
+            }).apply {
+                level = HttpLoggingInterceptor.Level.BODY
+            })
+    }
+
+    init {
+        normalizeBaseUrl()
+    }
+
+    constructor(
+        baseUrl: String = defaultBasePath,
+        okHttpClientBuilder: OkHttpClient.Builder? = null,
+        serializerBuilder: Moshi.Builder = Serializer.moshiBuilder,
+        authNames: Array<String>
+    ) : this(baseUrl, okHttpClientBuilder, serializerBuilder) {
+        authNames.forEach { authName ->
+            val auth = when (authName) {
+                "api_key" -> ApiKeyAuth("header", "api_key")"petstore_auth" -> OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets")
+                else -> throw RuntimeException("auth name $authName not found in available auth names")
+            }
+            addAuthorization(authName, auth);
+        }
+    }
+
+    constructor(
+        baseUrl: String = defaultBasePath,
+        okHttpClientBuilder: OkHttpClient.Builder? = null,
+        serializerBuilder: Moshi.Builder = Serializer.moshiBuilder,
+        authName: String,
+        clientId: String,
+        secret: String,
+        username: String,
+        password: String
+    ) : this(baseUrl, okHttpClientBuilder, serializerBuilder, arrayOf(authName)) {
+        getTokenEndPoint()
+            ?.setClientId(clientId)
+            ?.setClientSecret(secret)
+            ?.setUsername(username)
+            ?.setPassword(password)
+    }
+
+    /**
+    * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one)
+    * @return Token request builder
+    */
+    fun getTokenEndPoint(): TokenRequestBuilder? {
+        var result: TokenRequestBuilder? = null
+        apiAuthorizations.values.runOnFirst<Interceptor, OAuth> {
+            result = tokenRequestBuilder
+        }
+        return result
+    }
+
+    /**
+    * Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
+    * @return Authentication request builder
+    */
+    fun getAuthorizationEndPoint(): AuthenticationRequestBuilder? {
+        var result: AuthenticationRequestBuilder? = null
+        apiAuthorizations.values.runOnFirst<Interceptor, OAuth> {
+            result = authenticationRequestBuilder
+        }
+        return result
+    }
+
+    /**
+    * Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one)
+    * @param accessToken Access token
+    * @return ApiClient
+    */
+    fun setAccessToken(accessToken: String): ApiClient {
+        apiAuthorizations.values.runOnFirst<Interceptor, OAuth> {
+            setAccessToken(accessToken)
+        }
+        return this
+    }
+
+    /**
+    * Helper method to configure the oauth accessCode/implicit flow parameters
+    * @param clientId Client ID
+    * @param clientSecret Client secret
+    * @param redirectURI Redirect URI
+    * @return ApiClient
+    */
+    fun configureAuthorizationFlow(clientId: String, clientSecret: String, redirectURI: String): ApiClient {
+        apiAuthorizations.values.runOnFirst<Interceptor, OAuth> {
+            tokenRequestBuilder
+                .setClientId(clientId)
+                .setClientSecret(clientSecret)
+                .setRedirectURI(redirectURI)
+            authenticationRequestBuilder
+                ?.setClientId(clientId)
+                ?.setRedirectURI(redirectURI)
+        }
+        return this;
+    }
+
+    /**
+    * Configures a listener which is notified when a new access token is received.
+    * @param accessTokenListener Access token listener
+    * @return ApiClient
+    */
+    fun registerAccessTokenListener(accessTokenListener: AccessTokenListener): ApiClient {
+        apiAuthorizations.values.runOnFirst<Interceptor, OAuth> {
+            registerAccessTokenListener(accessTokenListener)
+        }
+        return this;
+    }
+
+    /**
+     * Adds an authorization to be used by the client
+     * @param authName Authentication name
+     * @param authorization Authorization interceptor
+     * @return ApiClient
+     */
+    fun addAuthorization(authName: String, authorization: Interceptor): ApiClient {
+        if (apiAuthorizations.containsKey(authName)) {
+            throw RuntimeException("auth name $authName already in api authorizations")
+        }
+        apiAuthorizations[authName] = authorization
+        clientBuilder.addInterceptor(authorization)
+        return this
+    }
+
+    fun setLogger(logger: (String) -> Unit): ApiClient {
+        this.logger = logger
+        return this
+    }
+
+    fun <S> createService(serviceClass: Class<S>): S {
+        val usedClient = this.okHttpClient ?: clientBuilder.build()
+        return retrofitBuilder.client(usedClient).build().create(serviceClass)
+    }
+
+    private fun normalizeBaseUrl() {
+        if (!baseUrl.endsWith("/")) {
+            baseUrl += "/"
+        }
+    }
+
+    private inline fun <T, reified U> Iterable<T>.runOnFirst(callback: U.() -> Unit) {
+        for (element in this) {
+            if (element is U)  {
+                callback.invoke(element)
+                break
+            }
+        }
+    }
+
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+}
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ff5e2a81ee8ce2677c90a56384c165450f0c5b18
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
@@ -0,0 +1,12 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+
+class ByteArrayAdapter {
+    @ToJson
+    fun toJson(data: ByteArray): String = String(data)
+
+    @FromJson
+    fun fromJson(data: String): ByteArray = data.toByteArray()
+}
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt
new file mode 100644
index 0000000000000000000000000000000000000000..001e99325d2e2af7834611726479c28fb46fc418
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt
@@ -0,0 +1,56 @@
+package org.openapitools.client.infrastructure
+
+class CollectionFormats {
+
+    open class CSVParams {
+
+        var params: List<String>
+
+        constructor(params: List<String>) {
+            this.params = params
+        }
+
+        constructor(vararg params: String) {
+            this.params = listOf(*params)
+        }
+
+        override fun toString(): String {
+            return params.joinToString(",")
+        }
+    }
+
+    open class SSVParams : CSVParams {
+
+        constructor(params: List<String>) : super(params)
+
+        constructor(vararg params: String) : super(*params)
+
+        override fun toString(): String {
+            return params.joinToString(" ")
+        }
+    }
+
+    class TSVParams : CSVParams {
+
+        constructor(params: List<String>) : super(params)
+
+        constructor(vararg params: String) : super(*params)
+
+        override fun toString(): String {
+            return params.joinToString("\t")
+        }
+    }
+
+    class PIPESParams : CSVParams {
+
+        constructor(params: List<String>) : super(params)
+
+        constructor(vararg params: String) : super(*params)
+
+        override fun toString(): String {
+            return params.joinToString("|")
+        }
+    }
+
+    class SPACEParams : SSVParams()
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b2e1654479a01d0c02930408910cc70d93f16c9d
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.LocalDate
+import java.time.format.DateTimeFormatter
+
+class LocalDateAdapter {
+    @ToJson
+    fun toJson(value: LocalDate): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDate {
+        return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..e082db94811d386498db8b1cd56cf58af82bad56
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
+
+class LocalDateTimeAdapter {
+    @ToJson
+    fun toJson(value: LocalDateTime): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDateTime {
+        return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..87437871a31e6ae83dca8573985f7d178ce6f3e6
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.OffsetDateTime
+import java.time.format.DateTimeFormatter
+
+class OffsetDateTimeAdapter {
+    @ToJson
+    fun toJson(value: OffsetDateTime): String {
+        return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): OffsetDateTime {
+        return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt
new file mode 100644
index 0000000000000000000000000000000000000000..1804d1ae2bbd7bb7fda7da1109c82a1ee0cb90ea
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt
@@ -0,0 +1,16 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.JsonDataException
+import com.squareup.moshi.Moshi
+import retrofit2.Response
+
+@Throws(JsonDataException::class)
+inline fun <reified T> Response<*>.getErrorResponse(serializerBuilder: Moshi.Builder = Serializer.moshiBuilder): T? {
+    val serializer = serializerBuilder.build()
+    val parser = serializer.adapter(T::class.java)
+    val response = errorBody()?.string()
+    if(response != null) {
+        return parser.fromJson(response)
+    }
+    return null
+}
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/Serializer.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9a45b67d9b1a435f1ebfa35c6d6c0fd329cea27b
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/Serializer.kt
@@ -0,0 +1,21 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.Moshi
+import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
+import java.util.Date
+
+object Serializer {
+    @JvmStatic
+    val moshiBuilder: Moshi.Builder = Moshi.Builder()
+        .add(OffsetDateTimeAdapter())
+        .add(LocalDateTimeAdapter())
+        .add(LocalDateAdapter())
+        .add(UUIDAdapter())
+        .add(ByteArrayAdapter())
+        .add(KotlinJsonAdapterFactory())
+
+    @JvmStatic
+    val moshi: Moshi by lazy {
+        moshiBuilder.build()
+    }
+}
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a4a44cc18b73e4a0ec722fa385e0276dbfbac670
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
@@ -0,0 +1,13 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.util.UUID
+
+class UUIDAdapter {
+    @ToJson
+    fun toJson(uuid: UUID) = uuid.toString()
+
+    @FromJson
+    fun fromJson(s: String) = UUID.fromString(s)
+}
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/ApiResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..fafca8738f663b840b5a6a005cf320c5f0aa1a68
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/ApiResponse.kt
@@ -0,0 +1,32 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * Describes the result of uploading an image resource
+ * @param code 
+ * @param type 
+ * @param message 
+ */
+
+data class ApiResponse (
+    @Json(name = "code")
+    val code: kotlin.Int? = null,
+    @Json(name = "type")
+    val type: kotlin.String? = null,
+    @Json(name = "message")
+    val message: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Category.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a4c17c3b49ddf7328874d853f6022b5f80ac057c
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Category.kt
@@ -0,0 +1,29 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * A category for a pet
+ * @param id 
+ * @param name 
+ */
+
+data class Category (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "name")
+    val name: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Order.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a66c335904e714f99a07894143f35bb08a602712
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Order.kt
@@ -0,0 +1,54 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * An order for a pets from the pet store
+ * @param id 
+ * @param petId 
+ * @param quantity 
+ * @param shipDate 
+ * @param status Order Status
+ * @param complete 
+ */
+
+data class Order (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "petId")
+    val petId: kotlin.Long? = null,
+    @Json(name = "quantity")
+    val quantity: kotlin.Int? = null,
+    @Json(name = "shipDate")
+    val shipDate: java.time.OffsetDateTime? = null,
+    /* Order Status */
+    @Json(name = "status")
+    val status: Order.Status? = null,
+    @Json(name = "complete")
+    val complete: kotlin.Boolean? = null
+) {
+
+    /**
+    * Order Status
+    * Values: placed,approved,delivered
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @Json(name = "placed") placed("placed"),
+        @Json(name = "approved") approved("approved"),
+        @Json(name = "delivered") delivered("delivered");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Pet.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a3df06cb6eb3c1cd1ab6e0e4e083304f44ddb73e
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Pet.kt
@@ -0,0 +1,56 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+import org.openapitools.client.models.Category
+import org.openapitools.client.models.Tag
+
+import com.squareup.moshi.Json
+
+/**
+ * A pet for sale in the pet store
+ * @param name 
+ * @param photoUrls 
+ * @param id 
+ * @param category 
+ * @param tags 
+ * @param status pet status in the store
+ */
+
+data class Pet (
+    @Json(name = "name")
+    val name: kotlin.String,
+    @Json(name = "photoUrls")
+    val photoUrls: kotlin.collections.List<kotlin.String>,
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "category")
+    val category: Category? = null,
+    @Json(name = "tags")
+    val tags: kotlin.collections.List<Tag>? = null,
+    /* pet status in the store */
+    @Json(name = "status")
+    val status: Pet.Status? = null
+) {
+
+    /**
+    * pet status in the store
+    * Values: available,pending,sold
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @Json(name = "available") available("available"),
+        @Json(name = "pending") pending("pending"),
+        @Json(name = "sold") sold("sold");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Tag.kt
new file mode 100644
index 0000000000000000000000000000000000000000..6e619023a5c95599835a7a618d17f6e6813fae53
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/Tag.kt
@@ -0,0 +1,29 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * A tag for a pet
+ * @param id 
+ * @param name 
+ */
+
+data class Tag (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "name")
+    val name: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/User.kt
new file mode 100644
index 0000000000000000000000000000000000000000..af1e270325de4659cbfaaa68c2074ea309e1ef5b
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2-rx3/bin/main/org/openapitools/client/models/User.kt
@@ -0,0 +1,48 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * A User who is purchasing from the pet store
+ * @param id 
+ * @param username 
+ * @param firstName 
+ * @param lastName 
+ * @param email 
+ * @param password 
+ * @param phone 
+ * @param userStatus User Status
+ */
+
+data class User (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "username")
+    val username: kotlin.String? = null,
+    @Json(name = "firstName")
+    val firstName: kotlin.String? = null,
+    @Json(name = "lastName")
+    val lastName: kotlin.String? = null,
+    @Json(name = "email")
+    val email: kotlin.String? = null,
+    @Json(name = "password")
+    val password: kotlin.String? = null,
+    @Json(name = "phone")
+    val phone: kotlin.String? = null,
+    /* User Status */
+    @Json(name = "userStatus")
+    val userStatus: kotlin.Int? = null
+)
+
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/PetApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..e8b980bc87277fde0d2f3166817a18f115333fce
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/PetApi.kt
@@ -0,0 +1,124 @@
+package org.openapitools.client.apis
+
+import org.openapitools.client.infrastructure.CollectionFormats.*
+import retrofit2.http.*
+import retrofit2.Call
+import okhttp3.RequestBody
+
+import org.openapitools.client.models.ApiResponse
+import org.openapitools.client.models.Pet
+
+import okhttp3.MultipartBody
+
+interface PetApi {
+    /**
+     * Add a new pet to the store
+     * 
+     * Responses:
+     *  - 405: Invalid input
+     * 
+     * @param body Pet object that needs to be added to the store 
+     * @return [Call]<[Unit]>
+     */
+    @POST("pet")
+    fun addPet(@Body body: Pet): Call<Unit>
+
+    /**
+     * Deletes a pet
+     * 
+     * Responses:
+     *  - 400: Invalid pet value
+     * 
+     * @param petId Pet id to delete 
+     * @param apiKey  (optional)
+     * @return [Call]<[Unit]>
+     */
+    @DELETE("pet/{petId}")
+    fun deletePet(@Path("petId") petId: kotlin.Long, @Header("api_key") apiKey: kotlin.String): Call<Unit>
+
+    /**
+     * Finds Pets by status
+     * Multiple status values can be provided with comma separated strings
+     * Responses:
+     *  - 200: successful operation
+     *  - 400: Invalid status value
+     * 
+     * @param status Status values that need to be considered for filter 
+     * @return [Call]<[kotlin.collections.List<Pet>]>
+     */
+    @GET("pet/findByStatus")
+    fun findPetsByStatus(@Query("status") status: CSVParams): Call<kotlin.collections.List<Pet>>
+
+    /**
+     * Finds Pets by tags
+     * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+     * Responses:
+     *  - 200: successful operation
+     *  - 400: Invalid tag value
+     * 
+     * @param tags Tags to filter by 
+     * @return [Call]<[kotlin.collections.List<Pet>]>
+     */
+    @Deprecated("This api was deprecated")
+    @GET("pet/findByTags")
+    fun findPetsByTags(@Query("tags") tags: CSVParams): Call<kotlin.collections.List<Pet>>
+
+    /**
+     * Find pet by ID
+     * Returns a single pet
+     * Responses:
+     *  - 200: successful operation
+     *  - 400: Invalid ID supplied
+     *  - 404: Pet not found
+     * 
+     * @param petId ID of pet to return 
+     * @return [Call]<[Pet]>
+     */
+    @GET("pet/{petId}")
+    fun getPetById(@Path("petId") petId: kotlin.Long): Call<Pet>
+
+    /**
+     * Update an existing pet
+     * 
+     * Responses:
+     *  - 400: Invalid ID supplied
+     *  - 404: Pet not found
+     *  - 405: Validation exception
+     * 
+     * @param body Pet object that needs to be added to the store 
+     * @return [Call]<[Unit]>
+     */
+    @PUT("pet")
+    fun updatePet(@Body body: Pet): Call<Unit>
+
+    /**
+     * Updates a pet in the store with form data
+     * 
+     * Responses:
+     *  - 405: Invalid input
+     * 
+     * @param petId ID of pet that needs to be updated 
+     * @param name Updated name of the pet (optional)
+     * @param status Updated status of the pet (optional)
+     * @return [Call]<[Unit]>
+     */
+    @FormUrlEncoded
+    @POST("pet/{petId}")
+    fun updatePetWithForm(@Path("petId") petId: kotlin.Long, @Field("name") name: kotlin.String, @Field("status") status: kotlin.String): Call<Unit>
+
+    /**
+     * uploads an image
+     * 
+     * Responses:
+     *  - 200: successful operation
+     * 
+     * @param petId ID of pet to update 
+     * @param additionalMetadata Additional data to pass to server (optional)
+     * @param file file to upload (optional)
+     * @return [Call]<[ApiResponse]>
+     */
+    @Multipart
+    @POST("pet/{petId}/uploadImage")
+    fun uploadFile(@Path("petId") petId: kotlin.Long, @Part("additionalMetadata") additionalMetadata: kotlin.String, @Part file: MultipartBody.Part): Call<ApiResponse>
+
+}
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/StoreApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..be05f2bb6968d043c1f838c43ce9f5587ec88e74
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/StoreApi.kt
@@ -0,0 +1,62 @@
+package org.openapitools.client.apis
+
+import org.openapitools.client.infrastructure.CollectionFormats.*
+import retrofit2.http.*
+import retrofit2.Call
+import okhttp3.RequestBody
+
+import org.openapitools.client.models.Order
+
+interface StoreApi {
+    /**
+     * Delete purchase order by ID
+     * For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
+     * Responses:
+     *  - 400: Invalid ID supplied
+     *  - 404: Order not found
+     * 
+     * @param orderId ID of the order that needs to be deleted 
+     * @return [Call]<[Unit]>
+     */
+    @DELETE("store/order/{orderId}")
+    fun deleteOrder(@Path("orderId") orderId: kotlin.String): Call<Unit>
+
+    /**
+     * Returns pet inventories by status
+     * Returns a map of status codes to quantities
+     * Responses:
+     *  - 200: successful operation
+     * 
+     * @return [Call]<[kotlin.collections.Map<kotlin.String, kotlin.Int>]>
+     */
+    @GET("store/inventory")
+    fun getInventory(): Call<kotlin.collections.Map<kotlin.String, kotlin.Int>>
+
+    /**
+     * Find purchase order by ID
+     * For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
+     * Responses:
+     *  - 200: successful operation
+     *  - 400: Invalid ID supplied
+     *  - 404: Order not found
+     * 
+     * @param orderId ID of pet that needs to be fetched 
+     * @return [Call]<[Order]>
+     */
+    @GET("store/order/{orderId}")
+    fun getOrderById(@Path("orderId") orderId: kotlin.Long): Call<Order>
+
+    /**
+     * Place an order for a pet
+     * 
+     * Responses:
+     *  - 200: successful operation
+     *  - 400: Invalid Order
+     * 
+     * @param body order placed for purchasing the pet 
+     * @return [Call]<[Order]>
+     */
+    @POST("store/order")
+    fun placeOrder(@Body body: Order): Call<Order>
+
+}
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/UserApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..66c1e7fbd2646d112c2d6ecf58a19c3c977ad7be
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/apis/UserApi.kt
@@ -0,0 +1,113 @@
+package org.openapitools.client.apis
+
+import org.openapitools.client.infrastructure.CollectionFormats.*
+import retrofit2.http.*
+import retrofit2.Call
+import okhttp3.RequestBody
+
+import org.openapitools.client.models.User
+
+interface UserApi {
+    /**
+     * Create user
+     * This can only be done by the logged in user.
+     * Responses:
+     *  - 0: successful operation
+     * 
+     * @param body Created user object 
+     * @return [Call]<[Unit]>
+     */
+    @POST("user")
+    fun createUser(@Body body: User): Call<Unit>
+
+    /**
+     * Creates list of users with given input array
+     * 
+     * Responses:
+     *  - 0: successful operation
+     * 
+     * @param body List of user object 
+     * @return [Call]<[Unit]>
+     */
+    @POST("user/createWithArray")
+    fun createUsersWithArrayInput(@Body body: kotlin.collections.List<User>): Call<Unit>
+
+    /**
+     * Creates list of users with given input array
+     * 
+     * Responses:
+     *  - 0: successful operation
+     * 
+     * @param body List of user object 
+     * @return [Call]<[Unit]>
+     */
+    @POST("user/createWithList")
+    fun createUsersWithListInput(@Body body: kotlin.collections.List<User>): Call<Unit>
+
+    /**
+     * Delete user
+     * This can only be done by the logged in user.
+     * Responses:
+     *  - 400: Invalid username supplied
+     *  - 404: User not found
+     * 
+     * @param username The name that needs to be deleted 
+     * @return [Call]<[Unit]>
+     */
+    @DELETE("user/{username}")
+    fun deleteUser(@Path("username") username: kotlin.String): Call<Unit>
+
+    /**
+     * Get user by user name
+     * 
+     * Responses:
+     *  - 200: successful operation
+     *  - 400: Invalid username supplied
+     *  - 404: User not found
+     * 
+     * @param username The name that needs to be fetched. Use user1 for testing. 
+     * @return [Call]<[User]>
+     */
+    @GET("user/{username}")
+    fun getUserByName(@Path("username") username: kotlin.String): Call<User>
+
+    /**
+     * Logs user into the system
+     * 
+     * Responses:
+     *  - 200: successful operation
+     *  - 400: Invalid username/password supplied
+     * 
+     * @param username The user name for login 
+     * @param password The password for login in clear text 
+     * @return [Call]<[kotlin.String]>
+     */
+    @GET("user/login")
+    fun loginUser(@Query("username") username: kotlin.String, @Query("password") password: kotlin.String): Call<kotlin.String>
+
+    /**
+     * Logs out current logged in user session
+     * 
+     * Responses:
+     *  - 0: successful operation
+     * 
+     * @return [Call]<[Unit]>
+     */
+    @GET("user/logout")
+    fun logoutUser(): Call<Unit>
+
+    /**
+     * Updated user
+     * This can only be done by the logged in user.
+     * Responses:
+     *  - 400: Invalid user supplied
+     *  - 404: User not found
+     * 
+     * @param username name that need to be deleted 
+     * @param body Updated user object 
+     * @return [Call]<[Unit]>
+     */
+    @PUT("user/{username}")
+    fun updateUser(@Path("username") username: kotlin.String, @Body body: User): Call<Unit>
+
+}
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt
new file mode 100644
index 0000000000000000000000000000000000000000..524d5190ef8871a8338dc968d55359407548b2b9
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/ApiKeyAuth.kt
@@ -0,0 +1,50 @@
+package org.openapitools.client.auth
+
+import java.io.IOException
+import java.net.URI
+import java.net.URISyntaxException
+
+import okhttp3.Interceptor
+import okhttp3.Response
+
+class ApiKeyAuth(
+        private val location: String = "",
+        private val paramName: String = "",
+        private var apiKey: String = ""
+) : Interceptor {
+    
+    @Throws(IOException::class)
+    override fun intercept(chain: Interceptor.Chain): Response {
+        var request = chain.request()
+
+        if ("query" == location) {
+            var newQuery = request.url.toUri().query
+            val paramValue = "$paramName=$apiKey"
+            if (newQuery == null) {
+                newQuery = paramValue
+            } else {
+                newQuery += "&$paramValue"
+            }
+
+            val newUri: URI
+            try {
+                val oldUri = request.url.toUri()
+                newUri = URI(oldUri.scheme, oldUri.authority,
+                    oldUri.path, newQuery, oldUri.fragment)
+            } catch (e: URISyntaxException) {
+                throw IOException(e)
+            }
+
+            request = request.newBuilder().url(newUri.toURL()).build()
+        } else if ("header" == location) {
+            request = request.newBuilder()
+                    .addHeader(paramName, apiKey)
+                    .build()
+        } else if ("cookie" == location) {
+            request = request.newBuilder()
+                    .addHeader("Cookie", "$paramName=$apiKey")
+                    .build()
+        }
+        return chain.proceed(request)
+    }
+}
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuth.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuth.kt
new file mode 100644
index 0000000000000000000000000000000000000000..311a8f4397948f55baf8a25cc8ca758b51303019
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuth.kt
@@ -0,0 +1,151 @@
+package org.openapitools.client.auth
+
+import java.net.HttpURLConnection.HTTP_UNAUTHORIZED
+import java.net.HttpURLConnection.HTTP_FORBIDDEN
+
+import java.io.IOException
+
+import org.apache.oltu.oauth2.client.OAuthClient
+import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest
+import org.apache.oltu.oauth2.client.request.OAuthClientRequest
+import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder
+import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder
+import org.apache.oltu.oauth2.common.exception.OAuthProblemException
+import org.apache.oltu.oauth2.common.exception.OAuthSystemException
+import org.apache.oltu.oauth2.common.message.types.GrantType
+import org.apache.oltu.oauth2.common.token.BasicOAuthToken
+
+import okhttp3.Interceptor
+import okhttp3.OkHttpClient
+import okhttp3.Response
+
+class OAuth(
+        client: OkHttpClient,
+        var tokenRequestBuilder: TokenRequestBuilder
+) : Interceptor {
+
+    interface AccessTokenListener {
+        fun notify(token: BasicOAuthToken)
+    }
+
+    private var oauthClient: OAuthClient = OAuthClient(OAuthOkHttpClient(client))
+
+    @Volatile 
+    private var accessToken: String? = null
+    var authenticationRequestBuilder: AuthenticationRequestBuilder? = null
+    private var accessTokenListener: AccessTokenListener? = null
+
+    constructor(
+            requestBuilder: TokenRequestBuilder
+    ) : this(
+            OkHttpClient(), 
+            requestBuilder
+    )
+
+    constructor(
+            flow: OAuthFlow, 
+            authorizationUrl: String, 
+            tokenUrl: String, 
+            scopes: String
+    ) : this(
+            OAuthClientRequest.tokenLocation(tokenUrl).setScope(scopes)
+    ) {
+        setFlow(flow);
+        authenticationRequestBuilder = OAuthClientRequest.authorizationLocation(authorizationUrl);
+    }
+
+    fun setFlow(flow: OAuthFlow) {
+        when (flow) {
+            OAuthFlow.accessCode, OAuthFlow.implicit ->
+                tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE)
+            OAuthFlow.password ->
+                tokenRequestBuilder.setGrantType(GrantType.PASSWORD)
+            OAuthFlow.application ->
+                tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS)
+        }            
+    }
+
+    @Throws(IOException::class)
+    override fun intercept(chain: Interceptor.Chain): Response {
+        return retryingIntercept(chain, true)
+    }
+
+    @Throws(IOException::class)
+    private fun retryingIntercept(chain: Interceptor.Chain, updateTokenAndRetryOnAuthorizationFailure: Boolean): Response {
+        var request = chain.request()
+
+        // If the request already have an authorization (eg. Basic auth), do nothing
+        if (request.header("Authorization") != null) {
+            return chain.proceed(request)
+        }
+
+        // If first time, get the token
+        val oAuthRequest: OAuthClientRequest
+        if (accessToken == null) {
+            updateAccessToken(null)
+        }
+
+        if (accessToken != null) {
+            // Build the request
+            val rb = request.newBuilder()
+
+            val requestAccessToken = accessToken
+            try {
+                oAuthRequest = OAuthBearerClientRequest(request.url.toString())
+                        .setAccessToken(requestAccessToken)
+                        .buildHeaderMessage()
+            } catch (e: OAuthSystemException) {
+                throw IOException(e)
+            }
+
+            oAuthRequest.headers.entries.forEach { header ->
+                rb.addHeader(header.key, header.value)
+            }
+            rb.url(oAuthRequest.locationUri)
+
+            //Execute the request
+            val response = chain.proceed(rb.build())
+
+            // 401/403 most likely indicates that access token has expired. Unless it happens two times in a row.
+            if ((response.code == HTTP_UNAUTHORIZED || response.code == HTTP_FORBIDDEN) && updateTokenAndRetryOnAuthorizationFailure) {
+                try {
+                    if (updateAccessToken(requestAccessToken)) {
+                        response.body?.close()
+                        return retryingIntercept(chain, false)
+                    }
+                } catch (e: Exception) {
+                    response.body?.close()
+                    throw e
+                }
+            }
+            return response
+        } else {
+            return chain.proceed(chain.request())
+        }
+    }
+
+    /**
+     * Returns true if the access token has been updated
+     */
+    @Throws(IOException::class)
+    @Synchronized 
+    fun updateAccessToken(requestAccessToken: String?): Boolean {
+        if (accessToken == null || accessToken.equals(requestAccessToken)) {    
+            return try {
+                val accessTokenResponse = oauthClient.accessToken(this.tokenRequestBuilder.buildBodyMessage())
+                if (accessTokenResponse != null && accessTokenResponse.accessToken != null) {
+                    accessToken = accessTokenResponse.accessToken
+                    accessTokenListener?.notify(accessTokenResponse.oAuthToken as BasicOAuthToken)
+                    !accessToken.equals(requestAccessToken)
+                } else {
+                    false
+                }
+            } catch (e: OAuthSystemException) {
+                throw IOException(e)
+            } catch (e: OAuthProblemException) {
+                throw IOException(e)
+            }
+        }
+        return true;
+    }
+}
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthFlow.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthFlow.kt
new file mode 100644
index 0000000000000000000000000000000000000000..bcada9b7a6a2bcfa70a44718cf3766ae02a4204c
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthFlow.kt
@@ -0,0 +1,5 @@
+package org.openapitools.client.auth
+
+enum class OAuthFlow {
+    accessCode, implicit, password, application
+}
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt
new file mode 100644
index 0000000000000000000000000000000000000000..93adbda3fc98535f37b13675ded49bd2f39c6c1e
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/auth/OAuthOkHttpClient.kt
@@ -0,0 +1,61 @@
+package org.openapitools.client.auth
+
+import java.io.IOException
+
+import org.apache.oltu.oauth2.client.HttpClient
+import org.apache.oltu.oauth2.client.request.OAuthClientRequest
+import org.apache.oltu.oauth2.client.response.OAuthClientResponse
+import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory
+import org.apache.oltu.oauth2.common.exception.OAuthProblemException
+import org.apache.oltu.oauth2.common.exception.OAuthSystemException
+
+import okhttp3.OkHttpClient
+import okhttp3.Request
+import okhttp3.MediaType.Companion.toMediaTypeOrNull
+import okhttp3.RequestBody
+
+
+class OAuthOkHttpClient(
+        private var client: OkHttpClient
+) : HttpClient {
+
+    constructor() : this(OkHttpClient())
+
+    @Throws(OAuthSystemException::class, OAuthProblemException::class)
+    override fun <T : OAuthClientResponse?> execute(
+            request: OAuthClientRequest, 
+            headers: Map<String, String>?,
+            requestMethod: String, 
+            responseClass: Class<T>?): T {
+
+        var mediaType = "application/json".toMediaTypeOrNull()
+        val requestBuilder = Request.Builder().url(request.locationUri)
+
+        headers?.forEach { entry ->
+            if (entry.key.equals("Content-Type", true)) {
+                mediaType = entry.value.toMediaTypeOrNull()
+            } else {
+                requestBuilder.addHeader(entry.key, entry.value)
+            }
+        }
+
+        val body: RequestBody? = if (request.body != null) RequestBody.create(mediaType, request.body) else null
+        requestBuilder.method(requestMethod, body)
+
+        try {
+            val response = client.newCall(requestBuilder.build()).execute()
+            return OAuthClientResponseFactory.createCustomResponse(
+                    response.body?.string(), 
+                    response.body?.contentType()?.toString(),
+                    response.code,
+                    responseClass)
+        } catch (e: IOException) {
+            throw OAuthSystemException(e)
+        }
+    }
+
+    override fun shutdown() {
+        // Nothing to do here
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
new file mode 100644
index 0000000000000000000000000000000000000000..f19c5861dd70f97d6d266e47474d13ee4e677199
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
@@ -0,0 +1,200 @@
+package org.openapitools.client.infrastructure
+
+import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder
+import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder
+import org.openapitools.client.auth.ApiKeyAuth
+import org.openapitools.client.auth.OAuth
+import org.openapitools.client.auth.OAuth.AccessTokenListener
+import org.openapitools.client.auth.OAuthFlow
+
+import okhttp3.Interceptor
+import okhttp3.OkHttpClient
+import retrofit2.Retrofit
+import okhttp3.logging.HttpLoggingInterceptor
+import retrofit2.converter.scalars.ScalarsConverterFactory
+import com.squareup.moshi.Moshi
+import retrofit2.converter.moshi.MoshiConverterFactory
+
+class ApiClient(
+    private var baseUrl: String = defaultBasePath,
+    private val okHttpClientBuilder: OkHttpClient.Builder? = null,
+    private val serializerBuilder: Moshi.Builder = Serializer.moshiBuilder,
+    private val okHttpClient : OkHttpClient? = null
+) {
+    private val apiAuthorizations = mutableMapOf<String, Interceptor>()
+    var logger: ((String) -> Unit)? = null
+
+    private val retrofitBuilder: Retrofit.Builder by lazy {
+        Retrofit.Builder()
+            .baseUrl(baseUrl)
+            .addConverterFactory(ScalarsConverterFactory.create())
+            .addConverterFactory(MoshiConverterFactory.create(serializerBuilder.build()))
+    }
+
+    private val clientBuilder: OkHttpClient.Builder by lazy {
+        okHttpClientBuilder ?: defaultClientBuilder
+    }
+
+    private val defaultClientBuilder: OkHttpClient.Builder by lazy {
+        OkHttpClient()
+            .newBuilder()
+            .addInterceptor(HttpLoggingInterceptor(object : HttpLoggingInterceptor.Logger {
+                override fun log(message: String) {
+                    logger?.invoke(message)
+                }
+            }).apply {
+                level = HttpLoggingInterceptor.Level.BODY
+            })
+    }
+
+    init {
+        normalizeBaseUrl()
+    }
+
+    constructor(
+        baseUrl: String = defaultBasePath,
+        okHttpClientBuilder: OkHttpClient.Builder? = null,
+        serializerBuilder: Moshi.Builder = Serializer.moshiBuilder,
+        authNames: Array<String>
+    ) : this(baseUrl, okHttpClientBuilder, serializerBuilder) {
+        authNames.forEach { authName ->
+            val auth = when (authName) {
+                "api_key" -> ApiKeyAuth("header", "api_key")"petstore_auth" -> OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets")
+                else -> throw RuntimeException("auth name $authName not found in available auth names")
+            }
+            addAuthorization(authName, auth);
+        }
+    }
+
+    constructor(
+        baseUrl: String = defaultBasePath,
+        okHttpClientBuilder: OkHttpClient.Builder? = null,
+        serializerBuilder: Moshi.Builder = Serializer.moshiBuilder,
+        authName: String,
+        clientId: String,
+        secret: String,
+        username: String,
+        password: String
+    ) : this(baseUrl, okHttpClientBuilder, serializerBuilder, arrayOf(authName)) {
+        getTokenEndPoint()
+            ?.setClientId(clientId)
+            ?.setClientSecret(secret)
+            ?.setUsername(username)
+            ?.setPassword(password)
+    }
+
+    /**
+    * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one)
+    * @return Token request builder
+    */
+    fun getTokenEndPoint(): TokenRequestBuilder? {
+        var result: TokenRequestBuilder? = null
+        apiAuthorizations.values.runOnFirst<Interceptor, OAuth> {
+            result = tokenRequestBuilder
+        }
+        return result
+    }
+
+    /**
+    * Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
+    * @return Authentication request builder
+    */
+    fun getAuthorizationEndPoint(): AuthenticationRequestBuilder? {
+        var result: AuthenticationRequestBuilder? = null
+        apiAuthorizations.values.runOnFirst<Interceptor, OAuth> {
+            result = authenticationRequestBuilder
+        }
+        return result
+    }
+
+    /**
+    * Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one)
+    * @param accessToken Access token
+    * @return ApiClient
+    */
+    fun setAccessToken(accessToken: String): ApiClient {
+        apiAuthorizations.values.runOnFirst<Interceptor, OAuth> {
+            setAccessToken(accessToken)
+        }
+        return this
+    }
+
+    /**
+    * Helper method to configure the oauth accessCode/implicit flow parameters
+    * @param clientId Client ID
+    * @param clientSecret Client secret
+    * @param redirectURI Redirect URI
+    * @return ApiClient
+    */
+    fun configureAuthorizationFlow(clientId: String, clientSecret: String, redirectURI: String): ApiClient {
+        apiAuthorizations.values.runOnFirst<Interceptor, OAuth> {
+            tokenRequestBuilder
+                .setClientId(clientId)
+                .setClientSecret(clientSecret)
+                .setRedirectURI(redirectURI)
+            authenticationRequestBuilder
+                ?.setClientId(clientId)
+                ?.setRedirectURI(redirectURI)
+        }
+        return this;
+    }
+
+    /**
+    * Configures a listener which is notified when a new access token is received.
+    * @param accessTokenListener Access token listener
+    * @return ApiClient
+    */
+    fun registerAccessTokenListener(accessTokenListener: AccessTokenListener): ApiClient {
+        apiAuthorizations.values.runOnFirst<Interceptor, OAuth> {
+            registerAccessTokenListener(accessTokenListener)
+        }
+        return this;
+    }
+
+    /**
+     * Adds an authorization to be used by the client
+     * @param authName Authentication name
+     * @param authorization Authorization interceptor
+     * @return ApiClient
+     */
+    fun addAuthorization(authName: String, authorization: Interceptor): ApiClient {
+        if (apiAuthorizations.containsKey(authName)) {
+            throw RuntimeException("auth name $authName already in api authorizations")
+        }
+        apiAuthorizations[authName] = authorization
+        clientBuilder.addInterceptor(authorization)
+        return this
+    }
+
+    fun setLogger(logger: (String) -> Unit): ApiClient {
+        this.logger = logger
+        return this
+    }
+
+    fun <S> createService(serviceClass: Class<S>): S {
+        val usedClient = this.okHttpClient ?: clientBuilder.build()
+        return retrofitBuilder.client(usedClient).build().create(serviceClass)
+    }
+
+    private fun normalizeBaseUrl() {
+        if (!baseUrl.endsWith("/")) {
+            baseUrl += "/"
+        }
+    }
+
+    private inline fun <T, reified U> Iterable<T>.runOnFirst(callback: U.() -> Unit) {
+        for (element in this) {
+            if (element is U)  {
+                callback.invoke(element)
+                break
+            }
+        }
+    }
+
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+}
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ff5e2a81ee8ce2677c90a56384c165450f0c5b18
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
@@ -0,0 +1,12 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+
+class ByteArrayAdapter {
+    @ToJson
+    fun toJson(data: ByteArray): String = String(data)
+
+    @FromJson
+    fun fromJson(data: String): ByteArray = data.toByteArray()
+}
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt
new file mode 100644
index 0000000000000000000000000000000000000000..001e99325d2e2af7834611726479c28fb46fc418
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/CollectionFormats.kt
@@ -0,0 +1,56 @@
+package org.openapitools.client.infrastructure
+
+class CollectionFormats {
+
+    open class CSVParams {
+
+        var params: List<String>
+
+        constructor(params: List<String>) {
+            this.params = params
+        }
+
+        constructor(vararg params: String) {
+            this.params = listOf(*params)
+        }
+
+        override fun toString(): String {
+            return params.joinToString(",")
+        }
+    }
+
+    open class SSVParams : CSVParams {
+
+        constructor(params: List<String>) : super(params)
+
+        constructor(vararg params: String) : super(*params)
+
+        override fun toString(): String {
+            return params.joinToString(" ")
+        }
+    }
+
+    class TSVParams : CSVParams {
+
+        constructor(params: List<String>) : super(params)
+
+        constructor(vararg params: String) : super(*params)
+
+        override fun toString(): String {
+            return params.joinToString("\t")
+        }
+    }
+
+    class PIPESParams : CSVParams {
+
+        constructor(params: List<String>) : super(params)
+
+        constructor(vararg params: String) : super(*params)
+
+        override fun toString(): String {
+            return params.joinToString("|")
+        }
+    }
+
+    class SPACEParams : SSVParams()
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b2e1654479a01d0c02930408910cc70d93f16c9d
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.LocalDate
+import java.time.format.DateTimeFormatter
+
+class LocalDateAdapter {
+    @ToJson
+    fun toJson(value: LocalDate): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDate {
+        return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..e082db94811d386498db8b1cd56cf58af82bad56
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
+
+class LocalDateTimeAdapter {
+    @ToJson
+    fun toJson(value: LocalDateTime): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDateTime {
+        return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..87437871a31e6ae83dca8573985f7d178ce6f3e6
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.OffsetDateTime
+import java.time.format.DateTimeFormatter
+
+class OffsetDateTimeAdapter {
+    @ToJson
+    fun toJson(value: OffsetDateTime): String {
+        return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): OffsetDateTime {
+        return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt
new file mode 100644
index 0000000000000000000000000000000000000000..1804d1ae2bbd7bb7fda7da1109c82a1ee0cb90ea
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/ResponseExt.kt
@@ -0,0 +1,16 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.JsonDataException
+import com.squareup.moshi.Moshi
+import retrofit2.Response
+
+@Throws(JsonDataException::class)
+inline fun <reified T> Response<*>.getErrorResponse(serializerBuilder: Moshi.Builder = Serializer.moshiBuilder): T? {
+    val serializer = serializerBuilder.build()
+    val parser = serializer.adapter(T::class.java)
+    val response = errorBody()?.string()
+    if(response != null) {
+        return parser.fromJson(response)
+    }
+    return null
+}
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/Serializer.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9a45b67d9b1a435f1ebfa35c6d6c0fd329cea27b
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/Serializer.kt
@@ -0,0 +1,21 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.Moshi
+import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
+import java.util.Date
+
+object Serializer {
+    @JvmStatic
+    val moshiBuilder: Moshi.Builder = Moshi.Builder()
+        .add(OffsetDateTimeAdapter())
+        .add(LocalDateTimeAdapter())
+        .add(LocalDateAdapter())
+        .add(UUIDAdapter())
+        .add(ByteArrayAdapter())
+        .add(KotlinJsonAdapterFactory())
+
+    @JvmStatic
+    val moshi: Moshi by lazy {
+        moshiBuilder.build()
+    }
+}
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a4a44cc18b73e4a0ec722fa385e0276dbfbac670
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
@@ -0,0 +1,13 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.util.UUID
+
+class UUIDAdapter {
+    @ToJson
+    fun toJson(uuid: UUID) = uuid.toString()
+
+    @FromJson
+    fun fromJson(s: String) = UUID.fromString(s)
+}
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/ApiResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..fafca8738f663b840b5a6a005cf320c5f0aa1a68
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/ApiResponse.kt
@@ -0,0 +1,32 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * Describes the result of uploading an image resource
+ * @param code 
+ * @param type 
+ * @param message 
+ */
+
+data class ApiResponse (
+    @Json(name = "code")
+    val code: kotlin.Int? = null,
+    @Json(name = "type")
+    val type: kotlin.String? = null,
+    @Json(name = "message")
+    val message: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Category.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a4c17c3b49ddf7328874d853f6022b5f80ac057c
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Category.kt
@@ -0,0 +1,29 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * A category for a pet
+ * @param id 
+ * @param name 
+ */
+
+data class Category (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "name")
+    val name: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Order.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a66c335904e714f99a07894143f35bb08a602712
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Order.kt
@@ -0,0 +1,54 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * An order for a pets from the pet store
+ * @param id 
+ * @param petId 
+ * @param quantity 
+ * @param shipDate 
+ * @param status Order Status
+ * @param complete 
+ */
+
+data class Order (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "petId")
+    val petId: kotlin.Long? = null,
+    @Json(name = "quantity")
+    val quantity: kotlin.Int? = null,
+    @Json(name = "shipDate")
+    val shipDate: java.time.OffsetDateTime? = null,
+    /* Order Status */
+    @Json(name = "status")
+    val status: Order.Status? = null,
+    @Json(name = "complete")
+    val complete: kotlin.Boolean? = null
+) {
+
+    /**
+    * Order Status
+    * Values: placed,approved,delivered
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @Json(name = "placed") placed("placed"),
+        @Json(name = "approved") approved("approved"),
+        @Json(name = "delivered") delivered("delivered");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Pet.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a3df06cb6eb3c1cd1ab6e0e4e083304f44ddb73e
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Pet.kt
@@ -0,0 +1,56 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+import org.openapitools.client.models.Category
+import org.openapitools.client.models.Tag
+
+import com.squareup.moshi.Json
+
+/**
+ * A pet for sale in the pet store
+ * @param name 
+ * @param photoUrls 
+ * @param id 
+ * @param category 
+ * @param tags 
+ * @param status pet status in the store
+ */
+
+data class Pet (
+    @Json(name = "name")
+    val name: kotlin.String,
+    @Json(name = "photoUrls")
+    val photoUrls: kotlin.collections.List<kotlin.String>,
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "category")
+    val category: Category? = null,
+    @Json(name = "tags")
+    val tags: kotlin.collections.List<Tag>? = null,
+    /* pet status in the store */
+    @Json(name = "status")
+    val status: Pet.Status? = null
+) {
+
+    /**
+    * pet status in the store
+    * Values: available,pending,sold
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @Json(name = "available") available("available"),
+        @Json(name = "pending") pending("pending"),
+        @Json(name = "sold") sold("sold");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Tag.kt
new file mode 100644
index 0000000000000000000000000000000000000000..6e619023a5c95599835a7a618d17f6e6813fae53
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/Tag.kt
@@ -0,0 +1,29 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * A tag for a pet
+ * @param id 
+ * @param name 
+ */
+
+data class Tag (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "name")
+    val name: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/User.kt
new file mode 100644
index 0000000000000000000000000000000000000000..af1e270325de4659cbfaaa68c2074ea309e1ef5b
--- /dev/null
+++ b/samples/client/petstore/kotlin-retrofit2/bin/main/org/openapitools/client/models/User.kt
@@ -0,0 +1,48 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * A User who is purchasing from the pet store
+ * @param id 
+ * @param username 
+ * @param firstName 
+ * @param lastName 
+ * @param email 
+ * @param password 
+ * @param phone 
+ * @param userStatus User Status
+ */
+
+data class User (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "username")
+    val username: kotlin.String? = null,
+    @Json(name = "firstName")
+    val firstName: kotlin.String? = null,
+    @Json(name = "lastName")
+    val lastName: kotlin.String? = null,
+    @Json(name = "email")
+    val email: kotlin.String? = null,
+    @Json(name = "password")
+    val password: kotlin.String? = null,
+    @Json(name = "phone")
+    val phone: kotlin.String? = null,
+    /* User Status */
+    @Json(name = "userStatus")
+    val userStatus: kotlin.Int? = null
+)
+
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/PetApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..4fbeccdbc00aaa654dac4966621ba7b89823ccb8
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/PetApi.kt
@@ -0,0 +1,492 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.ApiResponse
+import org.openapitools.client.models.Pet
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Add a new pet to the store
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun addPet(body: Pet) : Unit {
+        val localVariableConfig = addPetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation addPet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun addPetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Deletes a pet
+    * 
+    * @param apiKey  (optional)
+    * @param petId Pet id to delete 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deletePet(apiKey: kotlin.String?, petId: kotlin.Long) : Unit {
+        val localVariableConfig = deletePetRequestConfig(apiKey = apiKey, petId = petId)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deletePet
+    *
+    * @param apiKey  (optional)
+    * @param petId Pet id to delete 
+    * @return RequestConfig
+    */
+    fun deletePetRequestConfig(apiKey: kotlin.String?, petId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by status
+    * Multiple status values can be provided with comma separated strings
+    * @param status Status values that need to be considered for filter 
+    * @return kotlin.collections.List<Pet>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
+        val localVariableConfig = findPetsByStatusRequestConfig(status = status)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByStatus
+    *
+    * @param status Status values that need to be considered for filter 
+    * @return RequestConfig
+    */
+    fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("status", toMultiValue(status.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByStatus",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by tags
+    * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+    * @param tags Tags to filter by 
+    * @return kotlin.collections.List<Pet>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
+        val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByTags
+    *
+    * @param tags Tags to filter by 
+    * @return RequestConfig
+    */
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("tags", toMultiValue(tags.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByTags",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find pet by ID
+    * Returns a single pet
+    * @param petId ID of pet to return 
+    * @return Pet
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getPetById(petId: kotlin.Long) : Pet {
+        val localVariableConfig = getPetByIdRequestConfig(petId = petId)
+
+        val localVarResponse = request<Pet>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Pet
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getPetById
+    *
+    * @param petId ID of pet to return 
+    * @return RequestConfig
+    */
+    fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Update an existing pet
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updatePet(body: Pet) : Unit {
+        val localVariableConfig = updatePetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun updatePetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updates a pet in the store with form data
+    * 
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
+        val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePetWithForm
+    *
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return RequestConfig
+    */
+    fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * uploads an image
+    * 
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return ApiResponse
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
+        val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
+
+        val localVarResponse = request<ApiResponse>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation uploadFile
+    *
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return RequestConfig
+    */
+    fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/StoreApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..215ed63420c9d538efe258fcc1244627caa4b8e1
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/StoreApi.kt
@@ -0,0 +1,253 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.Order
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Delete purchase order by ID
+    * For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
+    * @param orderId ID of the order that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deleteOrder(orderId: kotlin.String) : Unit {
+        val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteOrder
+    *
+    * @param orderId ID of the order that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Returns pet inventories by status
+    * Returns a map of status codes to quantities
+    * @return kotlin.collections.Map<kotlin.String, kotlin.Int>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
+        val localVariableConfig = getInventoryRequestConfig()
+
+        val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map<kotlin.String, kotlin.Int>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getInventory
+    *
+    * @return RequestConfig
+    */
+    fun getInventoryRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/inventory",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find purchase order by ID
+    * For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
+    * @param orderId ID of pet that needs to be fetched 
+    * @return Order
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getOrderById(orderId: kotlin.Long) : Order {
+        val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getOrderById
+    *
+    * @param orderId ID of pet that needs to be fetched 
+    * @return RequestConfig
+    */
+    fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Place an order for a pet
+    * 
+    * @param body order placed for purchasing the pet 
+    * @return Order
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun placeOrder(body: Order) : Order {
+        val localVariableConfig = placeOrderRequestConfig(body = body)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation placeOrder
+    *
+    * @param body order placed for purchasing the pet 
+    * @return RequestConfig
+    */
+    fun placeOrderRequestConfig(body: Order) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/store/order",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/UserApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..53748b934636efed3e534dcce15de3d659631c0e
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/apis/UserApi.kt
@@ -0,0 +1,476 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.User
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Create user
+    * This can only be done by the logged in user.
+    * @param body Created user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUser(body: User) : Unit {
+        val localVariableConfig = createUserRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUser
+    *
+    * @param body Created user object 
+    * @return RequestConfig
+    */
+    fun createUserRequestConfig(body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithArrayInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithArray",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithListInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithList",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Delete user
+    * This can only be done by the logged in user.
+    * @param username The name that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deleteUser(username: kotlin.String) : Unit {
+        val localVariableConfig = deleteUserRequestConfig(username = username)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteUser
+    *
+    * @param username The name that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Get user by user name
+    * 
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return User
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getUserByName(username: kotlin.String) : User {
+        val localVariableConfig = getUserByNameRequestConfig(username = username)
+
+        val localVarResponse = request<User>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as User
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getUserByName
+    *
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return RequestConfig
+    */
+    fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs user into the system
+    * 
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return kotlin.String
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
+        val localVariableConfig = loginUserRequestConfig(username = username, password = password)
+
+        val localVarResponse = request<kotlin.String>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation loginUser
+    *
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return RequestConfig
+    */
+    fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("username", listOf(username.toString()))
+                put("password", listOf(password.toString()))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/login",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs out current logged in user session
+    * 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun logoutUser() : Unit {
+        val localVariableConfig = logoutUserRequestConfig()
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation logoutUser
+    *
+    * @return RequestConfig
+    */
+    fun logoutUserRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/logout",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updated user
+    * This can only be done by the logged in user.
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updateUser(username: kotlin.String, body: User) : Unit {
+        val localVariableConfig = updateUserRequestConfig(username = username, body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updateUser
+    *
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return RequestConfig
+    */
+    fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ef7a8f1e1a625f7efdbea17077de86da8e09f805
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
@@ -0,0 +1,23 @@
+package org.openapitools.client.infrastructure
+
+typealias MultiValueMap = MutableMap<String,List<String>>
+
+fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
+    "csv" -> ","
+    "tsv" -> "\t"
+    "pipe" -> "|"
+    "space" -> " "
+    else -> ""
+}
+
+val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
+
+fun <T : Any?> toMultiValue(items: Array<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter)
+        = toMultiValue(items.asIterable(), collectionFormat, map)
+
+fun <T : Any?> toMultiValue(items: Iterable<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String> {
+    return when(collectionFormat) {
+        "multi" -> items.map(map)
+        else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map))
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
new file mode 100644
index 0000000000000000000000000000000000000000..7a8dcc91cd4b42efec03e777faa270456888e1e5
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
@@ -0,0 +1,251 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Credentials
+import okhttp3.OkHttpClient
+import okhttp3.RequestBody
+import okhttp3.RequestBody.Companion.asRequestBody
+import okhttp3.RequestBody.Companion.toRequestBody
+import okhttp3.FormBody
+import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
+import okhttp3.ResponseBody
+import okhttp3.MediaType.Companion.toMediaTypeOrNull
+import okhttp3.Request
+import okhttp3.Headers
+import okhttp3.MultipartBody
+import java.io.File
+import java.net.URLConnection
+import java.util.Date
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.LocalTime
+import java.time.OffsetDateTime
+import java.time.OffsetTime
+
+open class ApiClient(val baseUrl: String) {
+    companion object {
+        protected const val ContentType = "Content-Type"
+        protected const val Accept = "Accept"
+        protected const val Authorization = "Authorization"
+        protected const val JsonMediaType = "application/json"
+        protected const val FormDataMediaType = "multipart/form-data"
+        protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded"
+        protected const val XmlMediaType = "application/xml"
+
+        val apiKey: MutableMap<String, String> = mutableMapOf()
+        val apiKeyPrefix: MutableMap<String, String> = mutableMapOf()
+        var username: String? = null
+        var password: String? = null
+        var accessToken: String? = null
+
+        @JvmStatic
+        val client: OkHttpClient by lazy {
+            builder.build()
+        }
+
+        @JvmStatic
+        val builder: OkHttpClient.Builder = OkHttpClient.Builder()
+    }
+
+    /**
+     * Guess Content-Type header from the given file (defaults to "application/octet-stream").
+     *
+     * @param file The given file
+     * @return The guessed Content-Type
+     */
+    protected fun guessContentTypeFromFile(file: File): String {
+        val contentType = URLConnection.guessContentTypeFromName(file.name)
+        return contentType ?: "application/octet-stream"
+    }
+
+    protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
+        when {
+            content is File -> content.asRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == FormDataMediaType -> {
+                MultipartBody.Builder()
+                    .setType(MultipartBody.FORM)
+                    .apply {
+                        // content's type *must* be Map<String, Any?>
+                        @Suppress("UNCHECKED_CAST")
+                        (content as Map<String, Any?>).forEach { (key, value) ->
+                            if (value is File) {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\"; filename=\"${value.name}\""
+                                )
+                                val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull()
+                                addPart(partHeaders, value.asRequestBody(fileMediaType))
+                            } else {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\""
+                                )
+                                addPart(
+                                    partHeaders,
+                                    parameterToString(value).toRequestBody(null)
+                                )
+                            }
+                        }
+                    }.build()
+            }
+            mediaType == FormUrlEncMediaType -> {
+                FormBody.Builder().apply {
+                    // content's type *must* be Map<String, Any?>
+                    @Suppress("UNCHECKED_CAST")
+                    (content as Map<String, Any?>).forEach { (key, value) ->
+                        add(key, parameterToString(value))
+                    }
+                }.build()
+            }
+            mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
+            // TODO: this should be extended with other serializers
+            else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.")
+        }
+
+    protected inline fun <reified T: Any?> responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? {
+        if(body == null) {
+            return null
+        }
+        val bodyContent = body.string()
+        if (bodyContent.isEmpty()) {
+            return null
+        }
+        return when(mediaType) {
+            JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent)
+            else ->  throw UnsupportedOperationException("responseBody currently only supports JSON body.")
+        }
+    }
+
+    protected fun updateAuthParams(requestConfig: RequestConfig) {
+        if (requestConfig.headers["api_key"].isNullOrEmpty()) {
+            if (apiKey["api_key"] != null) {
+                if (apiKeyPrefix["api_key"] != null) {
+                    requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!
+                } else {
+                    requestConfig.headers["api_key"] = apiKey["api_key"]!!
+                }
+            }
+        }
+        if (requestConfig.headers[Authorization].isNullOrEmpty()) {
+            accessToken?.let { accessToken ->
+                requestConfig.headers[Authorization] = "Bearer $accessToken "
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
+        val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
+
+        // take authMethod from operation
+        updateAuthParams(requestConfig)
+
+        val url = httpUrl.newBuilder()
+            .addPathSegments(requestConfig.path.trimStart('/'))
+            .apply {
+                requestConfig.query.forEach { query ->
+                    query.value.forEach { queryValue ->
+                        addQueryParameter(query.key, queryValue)
+                    }
+                }
+            }.build()
+
+        // take content-type/accept from spec or set to default (application/json) if not defined
+        if (requestConfig.headers[ContentType].isNullOrEmpty()) {
+            requestConfig.headers[ContentType] = JsonMediaType
+        }
+        if (requestConfig.headers[Accept].isNullOrEmpty()) {
+            requestConfig.headers[Accept] = JsonMediaType
+        }
+        val headers = requestConfig.headers
+
+        if(headers[ContentType] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Content-Type header. This is required.")
+        }
+
+        if(headers[Accept] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Accept header. This is required.")
+        }
+
+        // TODO: support multiple contentType options here.
+        val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
+
+        val request = when (requestConfig.method) {
+            RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
+            RequestMethod.GET -> Request.Builder().url(url)
+            RequestMethod.HEAD -> Request.Builder().url(url).head()
+            RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
+            RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
+            RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
+            RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
+        }.apply {
+            headers.forEach { header -> addHeader(header.key, header.value) }
+        }.build()
+
+        val response = client.newCall(request).execute()
+        val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
+
+        // TODO: handle specific mapping types. e.g. Map<int, Class<?>>
+        when {
+            response.isRedirect -> return Redirection(
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isInformational -> return Informational(
+                    response.message,
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isSuccessful -> return Success(
+                    responseBody(response.body, accept),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isClientError -> return ClientError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            else -> return ServerError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+        }
+    }
+
+    protected fun parameterToString(value: Any?): String {
+        when (value) {
+            null -> {
+                return ""
+            }
+            is Array<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is Iterable<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
+                return parseDateToQueryString<Any>(value)
+            }
+            else -> {
+                return value.toString()
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any> 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.moshi.adapter(T::class.java).toJson(value).replace("\"", "")
+    }
+}
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9dc8d8dbbfaaef4f86a4f65b8a908ba9e4507060
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
@@ -0,0 +1,43 @@
+package org.openapitools.client.infrastructure
+
+enum class ResponseType {
+    Success, Informational, Redirection, ClientError, ServerError
+}
+
+interface Response
+
+abstract class ApiInfrastructureResponse<T>(val responseType: ResponseType): Response {
+    abstract val statusCode: Int
+    abstract val headers: Map<String,List<String>>
+}
+
+class Success<T>(
+    val data: T,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+): ApiInfrastructureResponse<T>(ResponseType.Success)
+
+class Informational<T>(
+    val statusText: String,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Informational)
+
+class Redirection<T>(
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Redirection)
+
+class ClientError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.ClientError)
+
+class ServerError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>>
+): ApiInfrastructureResponse<T>(ResponseType.ServerError)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
new file mode 100644
index 0000000000000000000000000000000000000000..dd34bd48b2c01a3b2cc449fd1952635bfb9c0c85
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
@@ -0,0 +1,29 @@
+package org.openapitools.client.infrastructure
+
+import kotlin.properties.ReadWriteProperty
+import kotlin.reflect.KProperty
+
+object ApplicationDelegates {
+    /**
+     * Provides a property delegate, allowing the property to be set once and only once.
+     *
+     * If unset (no default value), a get on the property will throw [IllegalStateException].
+     */
+    fun <T> setOnce(defaultValue: T? = null) : ReadWriteProperty<Any?, T> = SetOnce(defaultValue)
+
+    private class SetOnce<T>(defaultValue: T? = null) : ReadWriteProperty<Any?, T> {
+        private var isSet = false
+        private var value: T? = defaultValue
+
+        override fun getValue(thisRef: Any?, property: KProperty<*>): T {
+            return value ?: throw IllegalStateException("${property.name} not initialized")
+        }
+
+        override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) {
+            if (!isSet) {
+                this.value = value
+                isSet = true
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ff5e2a81ee8ce2677c90a56384c165450f0c5b18
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
@@ -0,0 +1,12 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+
+class ByteArrayAdapter {
+    @ToJson
+    fun toJson(data: ByteArray): String = String(data)
+
+    @FromJson
+    fun fromJson(data: String): ByteArray = data.toByteArray()
+}
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Errors.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b5310e71f13c7e7fb874be998af37dd424d9cd11
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Errors.kt
@@ -0,0 +1,18 @@
+@file:Suppress("unused")
+package org.openapitools.client.infrastructure
+
+import java.lang.RuntimeException
+
+open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 123L
+    }
+}
+
+open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 456L
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b2e1654479a01d0c02930408910cc70d93f16c9d
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.LocalDate
+import java.time.format.DateTimeFormatter
+
+class LocalDateAdapter {
+    @ToJson
+    fun toJson(value: LocalDate): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDate {
+        return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..e082db94811d386498db8b1cd56cf58af82bad56
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
+
+class LocalDateTimeAdapter {
+    @ToJson
+    fun toJson(value: LocalDateTime): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDateTime {
+        return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..87437871a31e6ae83dca8573985f7d178ce6f3e6
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.OffsetDateTime
+import java.time.format.DateTimeFormatter
+
+class OffsetDateTimeAdapter {
+    @ToJson
+    fun toJson(value: OffsetDateTime): String {
+        return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): OffsetDateTime {
+        return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
new file mode 100644
index 0000000000000000000000000000000000000000..0f2790f370e29d3fceb044c2309dd945cd562eeb
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
@@ -0,0 +1,17 @@
+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<String,String> because rfc2616 defines
+ *       multi-valued headers as csv-only.
+ */
+data class RequestConfig(
+    val method: RequestMethod,
+    val path: String,
+    val headers: MutableMap<String, String> = mutableMapOf(),
+    val query: MutableMap<String, List<String>> = mutableMapOf(),
+    val body: kotlin.Any? = null
+)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt
new file mode 100644
index 0000000000000000000000000000000000000000..931b12b8bd7a6dba7362eaafc490edf709d14616
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/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
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9bd2790dc144a3794c7957fdff86c114e5570c99
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
@@ -0,0 +1,24 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Response
+
+/**
+ * Provides an extension to evaluation whether the response is a 1xx code
+ */
+val Response.isInformational : Boolean get() = this.code in 100..199
+
+/**
+ * Provides an extension to evaluation whether the response is a 3xx code
+ */
+@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
+val Response.isRedirect : Boolean get() = this.code in 300..399
+
+/**
+ * Provides an extension to evaluation whether the response is a 4xx code
+ */
+val Response.isClientError : Boolean get() = this.code in 400..499
+
+/**
+ * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code
+ */
+val Response.isServerError : Boolean get() = this.code in 500..999
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9a45b67d9b1a435f1ebfa35c6d6c0fd329cea27b
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/Serializer.kt
@@ -0,0 +1,21 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.Moshi
+import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
+import java.util.Date
+
+object Serializer {
+    @JvmStatic
+    val moshiBuilder: Moshi.Builder = Moshi.Builder()
+        .add(OffsetDateTimeAdapter())
+        .add(LocalDateTimeAdapter())
+        .add(LocalDateAdapter())
+        .add(UUIDAdapter())
+        .add(ByteArrayAdapter())
+        .add(KotlinJsonAdapterFactory())
+
+    @JvmStatic
+    val moshi: Moshi by lazy {
+        moshiBuilder.build()
+    }
+}
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a4a44cc18b73e4a0ec722fa385e0276dbfbac670
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
@@ -0,0 +1,13 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.util.UUID
+
+class UUIDAdapter {
+    @ToJson
+    fun toJson(uuid: UUID) = uuid.toString()
+
+    @FromJson
+    fun fromJson(s: String) = UUID.fromString(s)
+}
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/ApiResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..7d40c8efbc2f02676165dc9c33c00667df36cb87
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/ApiResponse.kt
@@ -0,0 +1,38 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+import java.io.Serializable
+
+/**
+ * Describes the result of uploading an image resource
+ * @param code 
+ * @param type 
+ * @param message 
+ */
+
+data class ApiResponse (
+    @Json(name = "code")
+    val code: kotlin.Int? = null,
+    @Json(name = "type")
+    val type: kotlin.String? = null,
+    @Json(name = "message")
+    val message: kotlin.String? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+}
+
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Category.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ceb0fbc8fe6087d846ab9681db045aacdafe6d9a
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Category.kt
@@ -0,0 +1,35 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+import java.io.Serializable
+
+/**
+ * A category for a pet
+ * @param id 
+ * @param name 
+ */
+
+data class Category (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "name")
+    val name: kotlin.String? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+}
+
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Order.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ec768d1acefd0aadbbfb6f70cde01fa8f4729bf5
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Order.kt
@@ -0,0 +1,58 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+import java.io.Serializable
+
+/**
+ * An order for a pets from the pet store
+ * @param id 
+ * @param petId 
+ * @param quantity 
+ * @param shipDate 
+ * @param status Order Status
+ * @param complete 
+ */
+
+data class Order (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "petId")
+    val petId: kotlin.Long? = null,
+    @Json(name = "quantity")
+    val quantity: kotlin.Int? = null,
+    @Json(name = "shipDate")
+    val shipDate: kotlin.String? = null,
+    /* Order Status */
+    @Json(name = "status")
+    val status: Order.Status? = null,
+    @Json(name = "complete")
+    val complete: kotlin.Boolean? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+    /**
+    * Order Status
+    * Values: placed,approved,delivered
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @Json(name = "placed") placed("placed"),
+        @Json(name = "approved") approved("approved"),
+        @Json(name = "delivered") delivered("delivered");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Pet.kt
new file mode 100644
index 0000000000000000000000000000000000000000..66667bf07cd13b0d9eecf977f781fe851ac2d59f
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Pet.kt
@@ -0,0 +1,60 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+import org.openapitools.client.models.Category
+import org.openapitools.client.models.Tag
+
+import com.squareup.moshi.Json
+import java.io.Serializable
+
+/**
+ * A pet for sale in the pet store
+ * @param id 
+ * @param category 
+ * @param name 
+ * @param photoUrls 
+ * @param tags 
+ * @param status pet status in the store
+ */
+
+data class Pet (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "category")
+    val category: Category? = null,
+    @Json(name = "name")
+    val name: kotlin.String,
+    @Json(name = "photoUrls")
+    val photoUrls: kotlin.collections.List<kotlin.String>,
+    @Json(name = "tags")
+    val tags: kotlin.collections.List<Tag>? = null,
+    /* pet status in the store */
+    @Json(name = "status")
+    val status: Pet.Status? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+    /**
+    * pet status in the store
+    * Values: available,pending,sold
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @Json(name = "available") available("available"),
+        @Json(name = "pending") pending("pending"),
+        @Json(name = "sold") sold("sold");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Tag.kt
new file mode 100644
index 0000000000000000000000000000000000000000..944b1cd0a141546f8e31f284f522276edc1f299b
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/Tag.kt
@@ -0,0 +1,35 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+import java.io.Serializable
+
+/**
+ * A tag for a pet
+ * @param id 
+ * @param name 
+ */
+
+data class Tag (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "name")
+    val name: kotlin.String? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+}
+
diff --git a/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/User.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9697f07d5bf881ae0ca1f808a4a00866b7030603
--- /dev/null
+++ b/samples/client/petstore/kotlin-string/bin/main/org/openapitools/client/models/User.kt
@@ -0,0 +1,54 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+import java.io.Serializable
+
+/**
+ * A User who is purchasing from the pet store
+ * @param id 
+ * @param username 
+ * @param firstName 
+ * @param lastName 
+ * @param email 
+ * @param password 
+ * @param phone 
+ * @param userStatus User Status
+ */
+
+data class User (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "username")
+    val username: kotlin.String? = null,
+    @Json(name = "firstName")
+    val firstName: kotlin.String? = null,
+    @Json(name = "lastName")
+    val lastName: kotlin.String? = null,
+    @Json(name = "email")
+    val email: kotlin.String? = null,
+    @Json(name = "password")
+    val password: kotlin.String? = null,
+    @Json(name = "phone")
+    val phone: kotlin.String? = null,
+    /* User Status */
+    @Json(name = "userStatus")
+    val userStatus: kotlin.Int? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+}
+
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/PetApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..c8b93b33bf6f60435de09774f61ab084f7fafd04
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/PetApi.kt
@@ -0,0 +1,492 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.ApiResponse
+import org.openapitools.client.models.Pet
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Add a new pet to the store
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun addPet(body: Pet) : Unit {
+        val localVariableConfig = addPetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation addPet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun addPetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Deletes a pet
+    * 
+    * @param petId Pet id to delete 
+    * @param apiKey  (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
+        val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deletePet
+    *
+    * @param petId Pet id to delete 
+    * @param apiKey  (optional)
+    * @return RequestConfig
+    */
+    fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by status
+    * Multiple status values can be provided with comma separated strings
+    * @param status Status values that need to be considered for filter 
+    * @return kotlin.collections.List<Pet>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
+        val localVariableConfig = findPetsByStatusRequestConfig(status = status)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByStatus
+    *
+    * @param status Status values that need to be considered for filter 
+    * @return RequestConfig
+    */
+    fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("status", toMultiValue(status.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByStatus",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by tags
+    * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+    * @param tags Tags to filter by 
+    * @return kotlin.collections.List<Pet>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
+        val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByTags
+    *
+    * @param tags Tags to filter by 
+    * @return RequestConfig
+    */
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("tags", toMultiValue(tags.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByTags",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find pet by ID
+    * Returns a single pet
+    * @param petId ID of pet to return 
+    * @return Pet
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getPetById(petId: kotlin.Long) : Pet {
+        val localVariableConfig = getPetByIdRequestConfig(petId = petId)
+
+        val localVarResponse = request<Pet>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Pet
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getPetById
+    *
+    * @param petId ID of pet to return 
+    * @return RequestConfig
+    */
+    fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Update an existing pet
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updatePet(body: Pet) : Unit {
+        val localVariableConfig = updatePetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun updatePetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updates a pet in the store with form data
+    * 
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
+        val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePetWithForm
+    *
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return RequestConfig
+    */
+    fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * uploads an image
+    * 
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return ApiResponse
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
+        val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
+
+        val localVarResponse = request<ApiResponse>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation uploadFile
+    *
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return RequestConfig
+    */
+    fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/StoreApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..215ed63420c9d538efe258fcc1244627caa4b8e1
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/StoreApi.kt
@@ -0,0 +1,253 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.Order
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Delete purchase order by ID
+    * For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
+    * @param orderId ID of the order that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deleteOrder(orderId: kotlin.String) : Unit {
+        val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteOrder
+    *
+    * @param orderId ID of the order that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Returns pet inventories by status
+    * Returns a map of status codes to quantities
+    * @return kotlin.collections.Map<kotlin.String, kotlin.Int>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
+        val localVariableConfig = getInventoryRequestConfig()
+
+        val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map<kotlin.String, kotlin.Int>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getInventory
+    *
+    * @return RequestConfig
+    */
+    fun getInventoryRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/inventory",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find purchase order by ID
+    * For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
+    * @param orderId ID of pet that needs to be fetched 
+    * @return Order
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getOrderById(orderId: kotlin.Long) : Order {
+        val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getOrderById
+    *
+    * @param orderId ID of pet that needs to be fetched 
+    * @return RequestConfig
+    */
+    fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Place an order for a pet
+    * 
+    * @param body order placed for purchasing the pet 
+    * @return Order
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun placeOrder(body: Order) : Order {
+        val localVariableConfig = placeOrderRequestConfig(body = body)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation placeOrder
+    *
+    * @param body order placed for purchasing the pet 
+    * @return RequestConfig
+    */
+    fun placeOrderRequestConfig(body: Order) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/store/order",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/UserApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..53748b934636efed3e534dcce15de3d659631c0e
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/apis/UserApi.kt
@@ -0,0 +1,476 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.User
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Create user
+    * This can only be done by the logged in user.
+    * @param body Created user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUser(body: User) : Unit {
+        val localVariableConfig = createUserRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUser
+    *
+    * @param body Created user object 
+    * @return RequestConfig
+    */
+    fun createUserRequestConfig(body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithArrayInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithArray",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithListInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithList",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Delete user
+    * This can only be done by the logged in user.
+    * @param username The name that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deleteUser(username: kotlin.String) : Unit {
+        val localVariableConfig = deleteUserRequestConfig(username = username)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteUser
+    *
+    * @param username The name that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Get user by user name
+    * 
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return User
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getUserByName(username: kotlin.String) : User {
+        val localVariableConfig = getUserByNameRequestConfig(username = username)
+
+        val localVarResponse = request<User>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as User
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getUserByName
+    *
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return RequestConfig
+    */
+    fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs user into the system
+    * 
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return kotlin.String
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
+        val localVariableConfig = loginUserRequestConfig(username = username, password = password)
+
+        val localVarResponse = request<kotlin.String>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation loginUser
+    *
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return RequestConfig
+    */
+    fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("username", listOf(username.toString()))
+                put("password", listOf(password.toString()))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/login",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs out current logged in user session
+    * 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun logoutUser() : Unit {
+        val localVariableConfig = logoutUserRequestConfig()
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation logoutUser
+    *
+    * @return RequestConfig
+    */
+    fun logoutUserRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/logout",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updated user
+    * This can only be done by the logged in user.
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updateUser(username: kotlin.String, body: User) : Unit {
+        val localVariableConfig = updateUserRequestConfig(username = username, body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updateUser
+    *
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return RequestConfig
+    */
+    fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ef7a8f1e1a625f7efdbea17077de86da8e09f805
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
@@ -0,0 +1,23 @@
+package org.openapitools.client.infrastructure
+
+typealias MultiValueMap = MutableMap<String,List<String>>
+
+fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
+    "csv" -> ","
+    "tsv" -> "\t"
+    "pipe" -> "|"
+    "space" -> " "
+    else -> ""
+}
+
+val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
+
+fun <T : Any?> toMultiValue(items: Array<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter)
+        = toMultiValue(items.asIterable(), collectionFormat, map)
+
+fun <T : Any?> toMultiValue(items: Iterable<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String> {
+    return when(collectionFormat) {
+        "multi" -> items.map(map)
+        else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map))
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
new file mode 100644
index 0000000000000000000000000000000000000000..135bcdc790e1633e9dc7f32e1d0f4981097ee29f
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
@@ -0,0 +1,251 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Credentials
+import okhttp3.OkHttpClient
+import okhttp3.RequestBody
+import okhttp3.RequestBody.Companion.asRequestBody
+import okhttp3.RequestBody.Companion.toRequestBody
+import okhttp3.FormBody
+import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
+import okhttp3.ResponseBody
+import okhttp3.MediaType.Companion.toMediaTypeOrNull
+import okhttp3.Request
+import okhttp3.Headers
+import okhttp3.MultipartBody
+import java.io.File
+import java.net.URLConnection
+import java.util.Date
+import org.threeten.bp.LocalDate
+import org.threeten.bp.LocalDateTime
+import org.threeten.bp.LocalTime
+import org.threeten.bp.OffsetDateTime
+import org.threeten.bp.OffsetTime
+
+open class ApiClient(val baseUrl: String) {
+    companion object {
+        protected const val ContentType = "Content-Type"
+        protected const val Accept = "Accept"
+        protected const val Authorization = "Authorization"
+        protected const val JsonMediaType = "application/json"
+        protected const val FormDataMediaType = "multipart/form-data"
+        protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded"
+        protected const val XmlMediaType = "application/xml"
+
+        val apiKey: MutableMap<String, String> = mutableMapOf()
+        val apiKeyPrefix: MutableMap<String, String> = mutableMapOf()
+        var username: String? = null
+        var password: String? = null
+        var accessToken: String? = null
+
+        @JvmStatic
+        val client: OkHttpClient by lazy {
+            builder.build()
+        }
+
+        @JvmStatic
+        val builder: OkHttpClient.Builder = OkHttpClient.Builder()
+    }
+
+    /**
+     * Guess Content-Type header from the given file (defaults to "application/octet-stream").
+     *
+     * @param file The given file
+     * @return The guessed Content-Type
+     */
+    protected fun guessContentTypeFromFile(file: File): String {
+        val contentType = URLConnection.guessContentTypeFromName(file.name)
+        return contentType ?: "application/octet-stream"
+    }
+
+    protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
+        when {
+            content is File -> content.asRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == FormDataMediaType -> {
+                MultipartBody.Builder()
+                    .setType(MultipartBody.FORM)
+                    .apply {
+                        // content's type *must* be Map<String, Any?>
+                        @Suppress("UNCHECKED_CAST")
+                        (content as Map<String, Any?>).forEach { (key, value) ->
+                            if (value is File) {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\"; filename=\"${value.name}\""
+                                )
+                                val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull()
+                                addPart(partHeaders, value.asRequestBody(fileMediaType))
+                            } else {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\""
+                                )
+                                addPart(
+                                    partHeaders,
+                                    parameterToString(value).toRequestBody(null)
+                                )
+                            }
+                        }
+                    }.build()
+            }
+            mediaType == FormUrlEncMediaType -> {
+                FormBody.Builder().apply {
+                    // content's type *must* be Map<String, Any?>
+                    @Suppress("UNCHECKED_CAST")
+                    (content as Map<String, Any?>).forEach { (key, value) ->
+                        add(key, parameterToString(value))
+                    }
+                }.build()
+            }
+            mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
+            // TODO: this should be extended with other serializers
+            else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.")
+        }
+
+    protected inline fun <reified T: Any?> responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? {
+        if(body == null) {
+            return null
+        }
+        val bodyContent = body.string()
+        if (bodyContent.isEmpty()) {
+            return null
+        }
+        return when(mediaType) {
+            JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent)
+            else ->  throw UnsupportedOperationException("responseBody currently only supports JSON body.")
+        }
+    }
+
+    protected fun updateAuthParams(requestConfig: RequestConfig) {
+        if (requestConfig.headers["api_key"].isNullOrEmpty()) {
+            if (apiKey["api_key"] != null) {
+                if (apiKeyPrefix["api_key"] != null) {
+                    requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!
+                } else {
+                    requestConfig.headers["api_key"] = apiKey["api_key"]!!
+                }
+            }
+        }
+        if (requestConfig.headers[Authorization].isNullOrEmpty()) {
+            accessToken?.let { accessToken ->
+                requestConfig.headers[Authorization] = "Bearer $accessToken "
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
+        val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
+
+        // take authMethod from operation
+        updateAuthParams(requestConfig)
+
+        val url = httpUrl.newBuilder()
+            .addPathSegments(requestConfig.path.trimStart('/'))
+            .apply {
+                requestConfig.query.forEach { query ->
+                    query.value.forEach { queryValue ->
+                        addQueryParameter(query.key, queryValue)
+                    }
+                }
+            }.build()
+
+        // take content-type/accept from spec or set to default (application/json) if not defined
+        if (requestConfig.headers[ContentType].isNullOrEmpty()) {
+            requestConfig.headers[ContentType] = JsonMediaType
+        }
+        if (requestConfig.headers[Accept].isNullOrEmpty()) {
+            requestConfig.headers[Accept] = JsonMediaType
+        }
+        val headers = requestConfig.headers
+
+        if(headers[ContentType] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Content-Type header. This is required.")
+        }
+
+        if(headers[Accept] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Accept header. This is required.")
+        }
+
+        // TODO: support multiple contentType options here.
+        val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
+
+        val request = when (requestConfig.method) {
+            RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
+            RequestMethod.GET -> Request.Builder().url(url)
+            RequestMethod.HEAD -> Request.Builder().url(url).head()
+            RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
+            RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
+            RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
+            RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
+        }.apply {
+            headers.forEach { header -> addHeader(header.key, header.value) }
+        }.build()
+
+        val response = client.newCall(request).execute()
+        val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
+
+        // TODO: handle specific mapping types. e.g. Map<int, Class<?>>
+        when {
+            response.isRedirect -> return Redirection(
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isInformational -> return Informational(
+                    response.message,
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isSuccessful -> return Success(
+                    responseBody(response.body, accept),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isClientError -> return ClientError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            else -> return ServerError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+        }
+    }
+
+    protected fun parameterToString(value: Any?): String {
+        when (value) {
+            null -> {
+                return ""
+            }
+            is Array<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is Iterable<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
+                return parseDateToQueryString<Any>(value)
+            }
+            else -> {
+                return value.toString()
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any> 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.moshi.adapter(T::class.java).toJson(value).replace("\"", "")
+    }
+}
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9dc8d8dbbfaaef4f86a4f65b8a908ba9e4507060
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
@@ -0,0 +1,43 @@
+package org.openapitools.client.infrastructure
+
+enum class ResponseType {
+    Success, Informational, Redirection, ClientError, ServerError
+}
+
+interface Response
+
+abstract class ApiInfrastructureResponse<T>(val responseType: ResponseType): Response {
+    abstract val statusCode: Int
+    abstract val headers: Map<String,List<String>>
+}
+
+class Success<T>(
+    val data: T,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+): ApiInfrastructureResponse<T>(ResponseType.Success)
+
+class Informational<T>(
+    val statusText: String,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Informational)
+
+class Redirection<T>(
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Redirection)
+
+class ClientError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.ClientError)
+
+class ServerError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>>
+): ApiInfrastructureResponse<T>(ResponseType.ServerError)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
new file mode 100644
index 0000000000000000000000000000000000000000..dd34bd48b2c01a3b2cc449fd1952635bfb9c0c85
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
@@ -0,0 +1,29 @@
+package org.openapitools.client.infrastructure
+
+import kotlin.properties.ReadWriteProperty
+import kotlin.reflect.KProperty
+
+object ApplicationDelegates {
+    /**
+     * Provides a property delegate, allowing the property to be set once and only once.
+     *
+     * If unset (no default value), a get on the property will throw [IllegalStateException].
+     */
+    fun <T> setOnce(defaultValue: T? = null) : ReadWriteProperty<Any?, T> = SetOnce(defaultValue)
+
+    private class SetOnce<T>(defaultValue: T? = null) : ReadWriteProperty<Any?, T> {
+        private var isSet = false
+        private var value: T? = defaultValue
+
+        override fun getValue(thisRef: Any?, property: KProperty<*>): T {
+            return value ?: throw IllegalStateException("${property.name} not initialized")
+        }
+
+        override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) {
+            if (!isSet) {
+                this.value = value
+                isSet = true
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ff5e2a81ee8ce2677c90a56384c165450f0c5b18
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
@@ -0,0 +1,12 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+
+class ByteArrayAdapter {
+    @ToJson
+    fun toJson(data: ByteArray): String = String(data)
+
+    @FromJson
+    fun fromJson(data: String): ByteArray = data.toByteArray()
+}
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Errors.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b5310e71f13c7e7fb874be998af37dd424d9cd11
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Errors.kt
@@ -0,0 +1,18 @@
+@file:Suppress("unused")
+package org.openapitools.client.infrastructure
+
+import java.lang.RuntimeException
+
+open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 123L
+    }
+}
+
+open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 456L
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ff5439aeb42ff6419983de6dd341734a43bc4567
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import org.threeten.bp.LocalDate
+import org.threeten.bp.format.DateTimeFormatter
+
+class LocalDateAdapter {
+    @ToJson
+    fun toJson(value: LocalDate): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDate {
+        return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..710a9cc1317885c2ab723c48574ae9e1dadec086
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import org.threeten.bp.LocalDateTime
+import org.threeten.bp.format.DateTimeFormatter
+
+class LocalDateTimeAdapter {
+    @ToJson
+    fun toJson(value: LocalDateTime): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDateTime {
+        return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..28b3eb3cd70a68bf58250d28a23ebf52e4ee226e
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import org.threeten.bp.OffsetDateTime
+import org.threeten.bp.format.DateTimeFormatter
+
+class OffsetDateTimeAdapter {
+    @ToJson
+    fun toJson(value: OffsetDateTime): String {
+        return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): OffsetDateTime {
+        return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
new file mode 100644
index 0000000000000000000000000000000000000000..0f2790f370e29d3fceb044c2309dd945cd562eeb
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
@@ -0,0 +1,17 @@
+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<String,String> because rfc2616 defines
+ *       multi-valued headers as csv-only.
+ */
+data class RequestConfig(
+    val method: RequestMethod,
+    val path: String,
+    val headers: MutableMap<String, String> = mutableMapOf(),
+    val query: MutableMap<String, List<String>> = mutableMapOf(),
+    val body: kotlin.Any? = null
+)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt
new file mode 100644
index 0000000000000000000000000000000000000000..931b12b8bd7a6dba7362eaafc490edf709d14616
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/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
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9bd2790dc144a3794c7957fdff86c114e5570c99
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
@@ -0,0 +1,24 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Response
+
+/**
+ * Provides an extension to evaluation whether the response is a 1xx code
+ */
+val Response.isInformational : Boolean get() = this.code in 100..199
+
+/**
+ * Provides an extension to evaluation whether the response is a 3xx code
+ */
+@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
+val Response.isRedirect : Boolean get() = this.code in 300..399
+
+/**
+ * Provides an extension to evaluation whether the response is a 4xx code
+ */
+val Response.isClientError : Boolean get() = this.code in 400..499
+
+/**
+ * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code
+ */
+val Response.isServerError : Boolean get() = this.code in 500..999
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Serializer.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9a45b67d9b1a435f1ebfa35c6d6c0fd329cea27b
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/Serializer.kt
@@ -0,0 +1,21 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.Moshi
+import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
+import java.util.Date
+
+object Serializer {
+    @JvmStatic
+    val moshiBuilder: Moshi.Builder = Moshi.Builder()
+        .add(OffsetDateTimeAdapter())
+        .add(LocalDateTimeAdapter())
+        .add(LocalDateAdapter())
+        .add(UUIDAdapter())
+        .add(ByteArrayAdapter())
+        .add(KotlinJsonAdapterFactory())
+
+    @JvmStatic
+    val moshi: Moshi by lazy {
+        moshiBuilder.build()
+    }
+}
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a4a44cc18b73e4a0ec722fa385e0276dbfbac670
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
@@ -0,0 +1,13 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.util.UUID
+
+class UUIDAdapter {
+    @ToJson
+    fun toJson(uuid: UUID) = uuid.toString()
+
+    @FromJson
+    fun fromJson(s: String) = UUID.fromString(s)
+}
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/ApiResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..fafca8738f663b840b5a6a005cf320c5f0aa1a68
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/ApiResponse.kt
@@ -0,0 +1,32 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * Describes the result of uploading an image resource
+ * @param code 
+ * @param type 
+ * @param message 
+ */
+
+data class ApiResponse (
+    @Json(name = "code")
+    val code: kotlin.Int? = null,
+    @Json(name = "type")
+    val type: kotlin.String? = null,
+    @Json(name = "message")
+    val message: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Category.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a4c17c3b49ddf7328874d853f6022b5f80ac057c
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Category.kt
@@ -0,0 +1,29 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * A category for a pet
+ * @param id 
+ * @param name 
+ */
+
+data class Category (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "name")
+    val name: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Order.kt
new file mode 100644
index 0000000000000000000000000000000000000000..300f94d8545ffc75740decb4f7df561cc7a44708
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Order.kt
@@ -0,0 +1,54 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * An order for a pets from the pet store
+ * @param id 
+ * @param petId 
+ * @param quantity 
+ * @param shipDate 
+ * @param status Order Status
+ * @param complete 
+ */
+
+data class Order (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "petId")
+    val petId: kotlin.Long? = null,
+    @Json(name = "quantity")
+    val quantity: kotlin.Int? = null,
+    @Json(name = "shipDate")
+    val shipDate: org.threeten.bp.OffsetDateTime? = null,
+    /* Order Status */
+    @Json(name = "status")
+    val status: Order.Status? = null,
+    @Json(name = "complete")
+    val complete: kotlin.Boolean? = null
+) {
+
+    /**
+    * Order Status
+    * Values: placed,approved,delivered
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @Json(name = "placed") placed("placed"),
+        @Json(name = "approved") approved("approved"),
+        @Json(name = "delivered") delivered("delivered");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Pet.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a3df06cb6eb3c1cd1ab6e0e4e083304f44ddb73e
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Pet.kt
@@ -0,0 +1,56 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+import org.openapitools.client.models.Category
+import org.openapitools.client.models.Tag
+
+import com.squareup.moshi.Json
+
+/**
+ * A pet for sale in the pet store
+ * @param name 
+ * @param photoUrls 
+ * @param id 
+ * @param category 
+ * @param tags 
+ * @param status pet status in the store
+ */
+
+data class Pet (
+    @Json(name = "name")
+    val name: kotlin.String,
+    @Json(name = "photoUrls")
+    val photoUrls: kotlin.collections.List<kotlin.String>,
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "category")
+    val category: Category? = null,
+    @Json(name = "tags")
+    val tags: kotlin.collections.List<Tag>? = null,
+    /* pet status in the store */
+    @Json(name = "status")
+    val status: Pet.Status? = null
+) {
+
+    /**
+    * pet status in the store
+    * Values: available,pending,sold
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @Json(name = "available") available("available"),
+        @Json(name = "pending") pending("pending"),
+        @Json(name = "sold") sold("sold");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Tag.kt
new file mode 100644
index 0000000000000000000000000000000000000000..6e619023a5c95599835a7a618d17f6e6813fae53
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/Tag.kt
@@ -0,0 +1,29 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * A tag for a pet
+ * @param id 
+ * @param name 
+ */
+
+data class Tag (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "name")
+    val name: kotlin.String? = null
+)
+
diff --git a/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/User.kt
new file mode 100644
index 0000000000000000000000000000000000000000..af1e270325de4659cbfaaa68c2074ea309e1ef5b
--- /dev/null
+++ b/samples/client/petstore/kotlin-threetenbp/bin/main/org/openapitools/client/models/User.kt
@@ -0,0 +1,48 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+ * A User who is purchasing from the pet store
+ * @param id 
+ * @param username 
+ * @param firstName 
+ * @param lastName 
+ * @param email 
+ * @param password 
+ * @param phone 
+ * @param userStatus User Status
+ */
+
+data class User (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "username")
+    val username: kotlin.String? = null,
+    @Json(name = "firstName")
+    val firstName: kotlin.String? = null,
+    @Json(name = "lastName")
+    val lastName: kotlin.String? = null,
+    @Json(name = "email")
+    val email: kotlin.String? = null,
+    @Json(name = "password")
+    val password: kotlin.String? = null,
+    @Json(name = "phone")
+    val phone: kotlin.String? = null,
+    /* User Status */
+    @Json(name = "userStatus")
+    val userStatus: kotlin.Int? = null
+)
+
diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/apis/EnumApi.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/apis/EnumApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..e504c876ce65d4801bc14832693adb6c510b03f8
--- /dev/null
+++ b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/apis/EnumApi.kt
@@ -0,0 +1,89 @@
+/**
+* OpenAPI Petstore
+* Test for issue 4062
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.PetEnum
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class EnumApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Get enums
+    * 
+    * @return PetEnum
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getEnum() : PetEnum {
+        val localVariableConfig = getEnumRequestConfig()
+
+        val localVarResponse = request<PetEnum>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as PetEnum
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getEnum
+    *
+    * @return RequestConfig
+    */
+    fun getEnumRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/enum",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ef7a8f1e1a625f7efdbea17077de86da8e09f805
--- /dev/null
+++ b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
@@ -0,0 +1,23 @@
+package org.openapitools.client.infrastructure
+
+typealias MultiValueMap = MutableMap<String,List<String>>
+
+fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
+    "csv" -> ","
+    "tsv" -> "\t"
+    "pipe" -> "|"
+    "space" -> " "
+    else -> ""
+}
+
+val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
+
+fun <T : Any?> toMultiValue(items: Array<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter)
+        = toMultiValue(items.asIterable(), collectionFormat, map)
+
+fun <T : Any?> toMultiValue(items: Iterable<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String> {
+    return when(collectionFormat) {
+        "multi" -> items.map(map)
+        else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map))
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
new file mode 100644
index 0000000000000000000000000000000000000000..c34e9e42d08c18d3ec47bd3d2a53977b6cc48140
--- /dev/null
+++ b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
@@ -0,0 +1,232 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Credentials
+import okhttp3.OkHttpClient
+import okhttp3.RequestBody
+import okhttp3.RequestBody.Companion.asRequestBody
+import okhttp3.RequestBody.Companion.toRequestBody
+import okhttp3.FormBody
+import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
+import okhttp3.ResponseBody
+import okhttp3.MediaType.Companion.toMediaTypeOrNull
+import okhttp3.Request
+import okhttp3.Headers
+import okhttp3.MultipartBody
+import java.io.File
+import java.net.URLConnection
+import java.util.Date
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.LocalTime
+import java.time.OffsetDateTime
+import java.time.OffsetTime
+
+open class ApiClient(val baseUrl: String) {
+    companion object {
+        protected const val ContentType = "Content-Type"
+        protected const val Accept = "Accept"
+        protected const val Authorization = "Authorization"
+        protected const val JsonMediaType = "application/json"
+        protected const val FormDataMediaType = "multipart/form-data"
+        protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded"
+        protected const val XmlMediaType = "application/xml"
+
+        val apiKey: MutableMap<String, String> = mutableMapOf()
+        val apiKeyPrefix: MutableMap<String, String> = mutableMapOf()
+        var username: String? = null
+        var password: String? = null
+        var accessToken: String? = null
+
+        @JvmStatic
+        val client: OkHttpClient by lazy {
+            builder.build()
+        }
+
+        @JvmStatic
+        val builder: OkHttpClient.Builder = OkHttpClient.Builder()
+    }
+
+    /**
+     * Guess Content-Type header from the given file (defaults to "application/octet-stream").
+     *
+     * @param file The given file
+     * @return The guessed Content-Type
+     */
+    protected fun guessContentTypeFromFile(file: File): String {
+        val contentType = URLConnection.guessContentTypeFromName(file.name)
+        return contentType ?: "application/octet-stream"
+    }
+
+    protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
+        when {
+            content is File -> content.asRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == FormDataMediaType -> {
+                MultipartBody.Builder()
+                    .setType(MultipartBody.FORM)
+                    .apply {
+                        // content's type *must* be Map<String, Any?>
+                        @Suppress("UNCHECKED_CAST")
+                        (content as Map<String, Any?>).forEach { (key, value) ->
+                            if (value is File) {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\"; filename=\"${value.name}\""
+                                )
+                                val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull()
+                                addPart(partHeaders, value.asRequestBody(fileMediaType))
+                            } else {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\""
+                                )
+                                addPart(
+                                    partHeaders,
+                                    parameterToString(value).toRequestBody(null)
+                                )
+                            }
+                        }
+                    }.build()
+            }
+            mediaType == FormUrlEncMediaType -> {
+                FormBody.Builder().apply {
+                    // content's type *must* be Map<String, Any?>
+                    @Suppress("UNCHECKED_CAST")
+                    (content as Map<String, Any?>).forEach { (key, value) ->
+                        add(key, parameterToString(value))
+                    }
+                }.build()
+            }
+            mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
+            // TODO: this should be extended with other serializers
+            else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.")
+        }
+
+    protected inline fun <reified T: Any?> responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? {
+        if(body == null) {
+            return null
+        }
+        val bodyContent = body.string()
+        if (bodyContent.isEmpty()) {
+            return null
+        }
+        return when(mediaType) {
+            JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent)
+            else ->  throw UnsupportedOperationException("responseBody currently only supports JSON body.")
+        }
+    }
+
+
+    protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
+        val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
+
+        val url = httpUrl.newBuilder()
+            .addPathSegments(requestConfig.path.trimStart('/'))
+            .apply {
+                requestConfig.query.forEach { query ->
+                    query.value.forEach { queryValue ->
+                        addQueryParameter(query.key, queryValue)
+                    }
+                }
+            }.build()
+
+        // take content-type/accept from spec or set to default (application/json) if not defined
+        if (requestConfig.headers[ContentType].isNullOrEmpty()) {
+            requestConfig.headers[ContentType] = JsonMediaType
+        }
+        if (requestConfig.headers[Accept].isNullOrEmpty()) {
+            requestConfig.headers[Accept] = JsonMediaType
+        }
+        val headers = requestConfig.headers
+
+        if(headers[ContentType] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Content-Type header. This is required.")
+        }
+
+        if(headers[Accept] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Accept header. This is required.")
+        }
+
+        // TODO: support multiple contentType options here.
+        val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
+
+        val request = when (requestConfig.method) {
+            RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
+            RequestMethod.GET -> Request.Builder().url(url)
+            RequestMethod.HEAD -> Request.Builder().url(url).head()
+            RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
+            RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
+            RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
+            RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
+        }.apply {
+            headers.forEach { header -> addHeader(header.key, header.value) }
+        }.build()
+
+        val response = client.newCall(request).execute()
+        val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
+
+        // TODO: handle specific mapping types. e.g. Map<int, Class<?>>
+        when {
+            response.isRedirect -> return Redirection(
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isInformational -> return Informational(
+                    response.message,
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isSuccessful -> return Success(
+                    responseBody(response.body, accept),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isClientError -> return ClientError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            else -> return ServerError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+        }
+    }
+
+    protected fun parameterToString(value: Any?): String {
+        when (value) {
+            null -> {
+                return ""
+            }
+            is Array<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is Iterable<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
+                return parseDateToQueryString<Any>(value)
+            }
+            else -> {
+                return value.toString()
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any> 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.moshi.adapter(T::class.java).toJson(value).replace("\"", "")
+    }
+}
diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9dc8d8dbbfaaef4f86a4f65b8a908ba9e4507060
--- /dev/null
+++ b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
@@ -0,0 +1,43 @@
+package org.openapitools.client.infrastructure
+
+enum class ResponseType {
+    Success, Informational, Redirection, ClientError, ServerError
+}
+
+interface Response
+
+abstract class ApiInfrastructureResponse<T>(val responseType: ResponseType): Response {
+    abstract val statusCode: Int
+    abstract val headers: Map<String,List<String>>
+}
+
+class Success<T>(
+    val data: T,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+): ApiInfrastructureResponse<T>(ResponseType.Success)
+
+class Informational<T>(
+    val statusText: String,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Informational)
+
+class Redirection<T>(
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Redirection)
+
+class ClientError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.ClientError)
+
+class ServerError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>>
+): ApiInfrastructureResponse<T>(ResponseType.ServerError)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
new file mode 100644
index 0000000000000000000000000000000000000000..dd34bd48b2c01a3b2cc449fd1952635bfb9c0c85
--- /dev/null
+++ b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
@@ -0,0 +1,29 @@
+package org.openapitools.client.infrastructure
+
+import kotlin.properties.ReadWriteProperty
+import kotlin.reflect.KProperty
+
+object ApplicationDelegates {
+    /**
+     * Provides a property delegate, allowing the property to be set once and only once.
+     *
+     * If unset (no default value), a get on the property will throw [IllegalStateException].
+     */
+    fun <T> setOnce(defaultValue: T? = null) : ReadWriteProperty<Any?, T> = SetOnce(defaultValue)
+
+    private class SetOnce<T>(defaultValue: T? = null) : ReadWriteProperty<Any?, T> {
+        private var isSet = false
+        private var value: T? = defaultValue
+
+        override fun getValue(thisRef: Any?, property: KProperty<*>): T {
+            return value ?: throw IllegalStateException("${property.name} not initialized")
+        }
+
+        override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) {
+            if (!isSet) {
+                this.value = value
+                isSet = true
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ff5e2a81ee8ce2677c90a56384c165450f0c5b18
--- /dev/null
+++ b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
@@ -0,0 +1,12 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+
+class ByteArrayAdapter {
+    @ToJson
+    fun toJson(data: ByteArray): String = String(data)
+
+    @FromJson
+    fun fromJson(data: String): ByteArray = data.toByteArray()
+}
diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/Errors.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b5310e71f13c7e7fb874be998af37dd424d9cd11
--- /dev/null
+++ b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/Errors.kt
@@ -0,0 +1,18 @@
+@file:Suppress("unused")
+package org.openapitools.client.infrastructure
+
+import java.lang.RuntimeException
+
+open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 123L
+    }
+}
+
+open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 456L
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b2e1654479a01d0c02930408910cc70d93f16c9d
--- /dev/null
+++ b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.LocalDate
+import java.time.format.DateTimeFormatter
+
+class LocalDateAdapter {
+    @ToJson
+    fun toJson(value: LocalDate): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDate {
+        return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..e082db94811d386498db8b1cd56cf58af82bad56
--- /dev/null
+++ b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
+
+class LocalDateTimeAdapter {
+    @ToJson
+    fun toJson(value: LocalDateTime): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDateTime {
+        return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..87437871a31e6ae83dca8573985f7d178ce6f3e6
--- /dev/null
+++ b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.OffsetDateTime
+import java.time.format.DateTimeFormatter
+
+class OffsetDateTimeAdapter {
+    @ToJson
+    fun toJson(value: OffsetDateTime): String {
+        return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): OffsetDateTime {
+        return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
new file mode 100644
index 0000000000000000000000000000000000000000..0f2790f370e29d3fceb044c2309dd945cd562eeb
--- /dev/null
+++ b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
@@ -0,0 +1,17 @@
+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<String,String> because rfc2616 defines
+ *       multi-valued headers as csv-only.
+ */
+data class RequestConfig(
+    val method: RequestMethod,
+    val path: String,
+    val headers: MutableMap<String, String> = mutableMapOf(),
+    val query: MutableMap<String, List<String>> = mutableMapOf(),
+    val body: kotlin.Any? = null
+)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt
new file mode 100644
index 0000000000000000000000000000000000000000..931b12b8bd7a6dba7362eaafc490edf709d14616
--- /dev/null
+++ b/samples/client/petstore/kotlin-uppercase-enum/bin/main/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
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9bd2790dc144a3794c7957fdff86c114e5570c99
--- /dev/null
+++ b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
@@ -0,0 +1,24 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Response
+
+/**
+ * Provides an extension to evaluation whether the response is a 1xx code
+ */
+val Response.isInformational : Boolean get() = this.code in 100..199
+
+/**
+ * Provides an extension to evaluation whether the response is a 3xx code
+ */
+@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
+val Response.isRedirect : Boolean get() = this.code in 300..399
+
+/**
+ * Provides an extension to evaluation whether the response is a 4xx code
+ */
+val Response.isClientError : Boolean get() = this.code in 400..499
+
+/**
+ * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code
+ */
+val Response.isServerError : Boolean get() = this.code in 500..999
diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/Serializer.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9a45b67d9b1a435f1ebfa35c6d6c0fd329cea27b
--- /dev/null
+++ b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/Serializer.kt
@@ -0,0 +1,21 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.Moshi
+import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
+import java.util.Date
+
+object Serializer {
+    @JvmStatic
+    val moshiBuilder: Moshi.Builder = Moshi.Builder()
+        .add(OffsetDateTimeAdapter())
+        .add(LocalDateTimeAdapter())
+        .add(LocalDateAdapter())
+        .add(UUIDAdapter())
+        .add(ByteArrayAdapter())
+        .add(KotlinJsonAdapterFactory())
+
+    @JvmStatic
+    val moshi: Moshi by lazy {
+        moshiBuilder.build()
+    }
+}
diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a4a44cc18b73e4a0ec722fa385e0276dbfbac670
--- /dev/null
+++ b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
@@ -0,0 +1,13 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.util.UUID
+
+class UUIDAdapter {
+    @ToJson
+    fun toJson(uuid: UUID) = uuid.toString()
+
+    @FromJson
+    fun fromJson(s: String) = UUID.fromString(s)
+}
diff --git a/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/models/PetEnum.kt b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/models/PetEnum.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a447bf920529737039cc61d91b1a86b3886612cc
--- /dev/null
+++ b/samples/client/petstore/kotlin-uppercase-enum/bin/main/org/openapitools/client/models/PetEnum.kt
@@ -0,0 +1,43 @@
+/**
+* OpenAPI Petstore
+* Test for issue 4062
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+
+/**
+* An enum with complex-ish naming
+* Values: MY_FIRST_VALUE,MY_SECOND_VALUE
+*/
+
+enum class PetEnum(val value: kotlin.String){
+
+
+    @Json(name = "myFirstValue")
+    MY_FIRST_VALUE("myFirstValue"),
+
+
+    @Json(name = "MY_SECOND_VALUE")
+    MY_SECOND_VALUE("MY_SECOND_VALUE");
+
+
+
+    /**
+    This override toString avoids using the enum var name and uses the actual api value instead.
+    In cases the var name and value are different, the client would send incorrect enums to the server.
+    **/
+    override fun toString(): String {
+        return value
+    }
+
+}
+
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/PetApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..c8b93b33bf6f60435de09774f61ab084f7fafd04
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/PetApi.kt
@@ -0,0 +1,492 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.ApiResponse
+import org.openapitools.client.models.Pet
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class PetApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Add a new pet to the store
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun addPet(body: Pet) : Unit {
+        val localVariableConfig = addPetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation addPet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun addPetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Deletes a pet
+    * 
+    * @param petId Pet id to delete 
+    * @param apiKey  (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?) : Unit {
+        val localVariableConfig = deletePetRequestConfig(petId = petId, apiKey = apiKey)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deletePet
+    *
+    * @param petId Pet id to delete 
+    * @param apiKey  (optional)
+    * @return RequestConfig
+    */
+    fun deletePetRequestConfig(petId: kotlin.Long, apiKey: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        apiKey?.apply { localVariableHeaders["api_key"] = this.toString() }
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by status
+    * Multiple status values can be provided with comma separated strings
+    * @param status Status values that need to be considered for filter 
+    * @return kotlin.collections.List<Pet>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun findPetsByStatus(status: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
+        val localVariableConfig = findPetsByStatusRequestConfig(status = status)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByStatus
+    *
+    * @param status Status values that need to be considered for filter 
+    * @return RequestConfig
+    */
+    fun findPetsByStatusRequestConfig(status: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("status", toMultiValue(status.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByStatus",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Finds Pets by tags
+    * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+    * @param tags Tags to filter by 
+    * @return kotlin.collections.List<Pet>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTags(tags: kotlin.collections.List<kotlin.String>) : kotlin.collections.List<Pet> {
+        val localVariableConfig = findPetsByTagsRequestConfig(tags = tags)
+
+        val localVarResponse = request<kotlin.collections.List<Pet>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.List<Pet>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation findPetsByTags
+    *
+    * @param tags Tags to filter by 
+    * @return RequestConfig
+    */
+    @Deprecated(message = "This operation is deprecated.")
+    fun findPetsByTagsRequestConfig(tags: kotlin.collections.List<kotlin.String>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("tags", toMultiValue(tags.toList(), "csv"))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/findByTags",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find pet by ID
+    * Returns a single pet
+    * @param petId ID of pet to return 
+    * @return Pet
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getPetById(petId: kotlin.Long) : Pet {
+        val localVariableConfig = getPetByIdRequestConfig(petId = petId)
+
+        val localVarResponse = request<Pet>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Pet
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getPetById
+    *
+    * @param petId ID of pet to return 
+    * @return RequestConfig
+    */
+    fun getPetByIdRequestConfig(petId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Update an existing pet
+    * 
+    * @param body Pet object that needs to be added to the store 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updatePet(body: Pet) : Unit {
+        val localVariableConfig = updatePetRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePet
+    *
+    * @param body Pet object that needs to be added to the store 
+    * @return RequestConfig
+    */
+    fun updatePetRequestConfig(body: Pet) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/pet",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updates a pet in the store with form data
+    * 
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : Unit {
+        val localVariableConfig = updatePetWithFormRequestConfig(petId = petId, name = name, status = status)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updatePetWithForm
+    *
+    * @param petId ID of pet that needs to be updated 
+    * @param name Updated name of the pet (optional)
+    * @param status Updated status of the pet (optional)
+    * @return RequestConfig
+    */
+    fun updatePetWithFormRequestConfig(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("name" to name, "status" to status)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "application/x-www-form-urlencoded")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * uploads an image
+    * 
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return ApiResponse
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : ApiResponse {
+        val localVariableConfig = uploadFileRequestConfig(petId = petId, additionalMetadata = additionalMetadata, file = file)
+
+        val localVarResponse = request<ApiResponse>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as ApiResponse
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation uploadFile
+    *
+    * @param petId ID of pet to update 
+    * @param additionalMetadata Additional data to pass to server (optional)
+    * @param file file to upload (optional)
+    * @return RequestConfig
+    */
+    fun uploadFileRequestConfig(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: java.io.File?) : RequestConfig {
+        val localVariableBody: kotlin.Any? = mapOf("additionalMetadata" to additionalMetadata, "file" to file)
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf("Content-Type" to "multipart/form-data")
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/pet/{petId}/uploadImage".replace("{"+"petId"+"}", "$petId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/StoreApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..215ed63420c9d538efe258fcc1244627caa4b8e1
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/StoreApi.kt
@@ -0,0 +1,253 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.Order
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class StoreApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Delete purchase order by ID
+    * For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
+    * @param orderId ID of the order that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deleteOrder(orderId: kotlin.String) : Unit {
+        val localVariableConfig = deleteOrderRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteOrder
+    *
+    * @param orderId ID of the order that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteOrderRequestConfig(orderId: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Returns pet inventories by status
+    * Returns a map of status codes to quantities
+    * @return kotlin.collections.Map<kotlin.String, kotlin.Int>
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getInventory() : kotlin.collections.Map<kotlin.String, kotlin.Int> {
+        val localVariableConfig = getInventoryRequestConfig()
+
+        val localVarResponse = request<kotlin.collections.Map<kotlin.String, kotlin.Int>>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.collections.Map<kotlin.String, kotlin.Int>
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getInventory
+    *
+    * @return RequestConfig
+    */
+    fun getInventoryRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/inventory",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Find purchase order by ID
+    * For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
+    * @param orderId ID of pet that needs to be fetched 
+    * @return Order
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getOrderById(orderId: kotlin.Long) : Order {
+        val localVariableConfig = getOrderByIdRequestConfig(orderId = orderId)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getOrderById
+    *
+    * @param orderId ID of pet that needs to be fetched 
+    * @return RequestConfig
+    */
+    fun getOrderByIdRequestConfig(orderId: kotlin.Long) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/store/order/{orderId}".replace("{"+"orderId"+"}", "$orderId"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Place an order for a pet
+    * 
+    * @param body order placed for purchasing the pet 
+    * @return Order
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun placeOrder(body: Order) : Order {
+        val localVariableConfig = placeOrderRequestConfig(body = body)
+
+        val localVarResponse = request<Order>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as Order
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation placeOrder
+    *
+    * @param body order placed for purchasing the pet 
+    * @return RequestConfig
+    */
+    fun placeOrderRequestConfig(body: Order) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/store/order",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/UserApi.kt
new file mode 100644
index 0000000000000000000000000000000000000000..53748b934636efed3e534dcce15de3d659631c0e
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/apis/UserApi.kt
@@ -0,0 +1,476 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.apis
+
+import org.openapitools.client.models.User
+
+import org.openapitools.client.infrastructure.ApiClient
+import org.openapitools.client.infrastructure.ClientException
+import org.openapitools.client.infrastructure.ClientError
+import org.openapitools.client.infrastructure.ServerException
+import org.openapitools.client.infrastructure.ServerError
+import org.openapitools.client.infrastructure.MultiValueMap
+import org.openapitools.client.infrastructure.RequestConfig
+import org.openapitools.client.infrastructure.RequestMethod
+import org.openapitools.client.infrastructure.ResponseType
+import org.openapitools.client.infrastructure.Success
+import org.openapitools.client.infrastructure.toMultiValue
+
+class UserApi(basePath: kotlin.String = defaultBasePath) : ApiClient(basePath) {
+    companion object {
+        @JvmStatic
+        val defaultBasePath: String by lazy {
+            System.getProperties().getProperty("org.openapitools.client.baseUrl", "http://petstore.swagger.io/v2")
+        }
+    }
+
+    /**
+    * Create user
+    * This can only be done by the logged in user.
+    * @param body Created user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUser(body: User) : Unit {
+        val localVariableConfig = createUserRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUser
+    *
+    * @param body Created user object 
+    * @return RequestConfig
+    */
+    fun createUserRequestConfig(body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUsersWithArrayInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithArrayInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithArray",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Creates list of users with given input array
+    * 
+    * @param body List of user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun createUsersWithListInput(body: kotlin.collections.List<User>) : Unit {
+        val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation createUsersWithListInput
+    *
+    * @param body List of user object 
+    * @return RequestConfig
+    */
+    fun createUsersWithListInputRequestConfig(body: kotlin.collections.List<User>) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.POST,
+            path = "/user/createWithList",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Delete user
+    * This can only be done by the logged in user.
+    * @param username The name that needs to be deleted 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun deleteUser(username: kotlin.String) : Unit {
+        val localVariableConfig = deleteUserRequestConfig(username = username)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation deleteUser
+    *
+    * @param username The name that needs to be deleted 
+    * @return RequestConfig
+    */
+    fun deleteUserRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.DELETE,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Get user by user name
+    * 
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return User
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun getUserByName(username: kotlin.String) : User {
+        val localVariableConfig = getUserByNameRequestConfig(username = username)
+
+        val localVarResponse = request<User>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as User
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation getUserByName
+    *
+    * @param username The name that needs to be fetched. Use user1 for testing. 
+    * @return RequestConfig
+    */
+    fun getUserByNameRequestConfig(username: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs user into the system
+    * 
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return kotlin.String
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Suppress("UNCHECKED_CAST")
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun loginUser(username: kotlin.String, password: kotlin.String) : kotlin.String {
+        val localVariableConfig = loginUserRequestConfig(username = username, password = password)
+
+        val localVarResponse = request<kotlin.String>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> (localVarResponse as Success<*>).data as kotlin.String
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation loginUser
+    *
+    * @param username The user name for login 
+    * @param password The password for login in clear text 
+    * @return RequestConfig
+    */
+    fun loginUserRequestConfig(username: kotlin.String, password: kotlin.String) : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf<kotlin.String, List<kotlin.String>>()
+            .apply {
+                put("username", listOf(username.toString()))
+                put("password", listOf(password.toString()))
+            }
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/login",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Logs out current logged in user session
+    * 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun logoutUser() : Unit {
+        val localVariableConfig = logoutUserRequestConfig()
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation logoutUser
+    *
+    * @return RequestConfig
+    */
+    fun logoutUserRequestConfig() : RequestConfig {
+        val localVariableBody: kotlin.Any? = null
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.GET,
+            path = "/user/logout",
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+    /**
+    * Updated user
+    * This can only be done by the logged in user.
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return void
+    * @throws UnsupportedOperationException If the API returns an informational or redirection response
+    * @throws ClientException If the API returns a client error response
+    * @throws ServerException If the API returns a server error response
+    */
+    @Throws(UnsupportedOperationException::class, ClientException::class, ServerException::class)
+    fun updateUser(username: kotlin.String, body: User) : Unit {
+        val localVariableConfig = updateUserRequestConfig(username = username, body = body)
+
+        val localVarResponse = request<Any?>(
+            localVariableConfig
+        )
+
+        return when (localVarResponse.responseType) {
+            ResponseType.Success -> Unit
+            ResponseType.Informational -> throw UnsupportedOperationException("Client does not support Informational responses.")
+            ResponseType.Redirection -> throw UnsupportedOperationException("Client does not support Redirection responses.")
+            ResponseType.ClientError -> {
+                val localVarError = localVarResponse as ClientError<*>
+                throw ClientException("Client error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+            ResponseType.ServerError -> {
+                val localVarError = localVarResponse as ServerError<*>
+                throw ServerException("Server error : ${localVarError.statusCode} ${localVarError.message.orEmpty()}", localVarError.statusCode, localVarResponse)
+            }
+        }
+    }
+
+    /**
+    * To obtain the request config of the operation updateUser
+    *
+    * @param username name that need to be deleted 
+    * @param body Updated user object 
+    * @return RequestConfig
+    */
+    fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
+        val localVariableBody: kotlin.Any? = body
+        val localVariableQuery: MultiValueMap = mutableMapOf()
+        val localVariableHeaders: MutableMap<String, String> = mutableMapOf()
+        
+        val localVariableConfig = RequestConfig(
+            method = RequestMethod.PUT,
+            path = "/user/{username}".replace("{"+"username"+"}", "$username"),
+            query = localVariableQuery,
+            headers = localVariableHeaders,
+            body = localVariableBody
+        )
+
+        return localVariableConfig
+    }
+
+}
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ef7a8f1e1a625f7efdbea17077de86da8e09f805
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiAbstractions.kt
@@ -0,0 +1,23 @@
+package org.openapitools.client.infrastructure
+
+typealias MultiValueMap = MutableMap<String,List<String>>
+
+fun collectionDelimiter(collectionFormat: String) = when(collectionFormat) {
+    "csv" -> ","
+    "tsv" -> "\t"
+    "pipe" -> "|"
+    "space" -> " "
+    else -> ""
+}
+
+val defaultMultiValueConverter: (item: Any?) -> String = { item -> "$item" }
+
+fun <T : Any?> toMultiValue(items: Array<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter)
+        = toMultiValue(items.asIterable(), collectionFormat, map)
+
+fun <T : Any?> toMultiValue(items: Iterable<T>, collectionFormat: String, map: (item: T) -> String = defaultMultiValueConverter): List<String> {
+    return when(collectionFormat) {
+        "multi" -> items.map(map)
+        else -> listOf(items.joinToString(separator = collectionDelimiter(collectionFormat), transform = map))
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiClient.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
new file mode 100644
index 0000000000000000000000000000000000000000..7a8dcc91cd4b42efec03e777faa270456888e1e5
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiClient.kt
@@ -0,0 +1,251 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Credentials
+import okhttp3.OkHttpClient
+import okhttp3.RequestBody
+import okhttp3.RequestBody.Companion.asRequestBody
+import okhttp3.RequestBody.Companion.toRequestBody
+import okhttp3.FormBody
+import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
+import okhttp3.ResponseBody
+import okhttp3.MediaType.Companion.toMediaTypeOrNull
+import okhttp3.Request
+import okhttp3.Headers
+import okhttp3.MultipartBody
+import java.io.File
+import java.net.URLConnection
+import java.util.Date
+import java.time.LocalDate
+import java.time.LocalDateTime
+import java.time.LocalTime
+import java.time.OffsetDateTime
+import java.time.OffsetTime
+
+open class ApiClient(val baseUrl: String) {
+    companion object {
+        protected const val ContentType = "Content-Type"
+        protected const val Accept = "Accept"
+        protected const val Authorization = "Authorization"
+        protected const val JsonMediaType = "application/json"
+        protected const val FormDataMediaType = "multipart/form-data"
+        protected const val FormUrlEncMediaType = "application/x-www-form-urlencoded"
+        protected const val XmlMediaType = "application/xml"
+
+        val apiKey: MutableMap<String, String> = mutableMapOf()
+        val apiKeyPrefix: MutableMap<String, String> = mutableMapOf()
+        var username: String? = null
+        var password: String? = null
+        var accessToken: String? = null
+
+        @JvmStatic
+        val client: OkHttpClient by lazy {
+            builder.build()
+        }
+
+        @JvmStatic
+        val builder: OkHttpClient.Builder = OkHttpClient.Builder()
+    }
+
+    /**
+     * Guess Content-Type header from the given file (defaults to "application/octet-stream").
+     *
+     * @param file The given file
+     * @return The guessed Content-Type
+     */
+    protected fun guessContentTypeFromFile(file: File): String {
+        val contentType = URLConnection.guessContentTypeFromName(file.name)
+        return contentType ?: "application/octet-stream"
+    }
+
+    protected inline fun <reified T> requestBody(content: T, mediaType: String = JsonMediaType): RequestBody =
+        when {
+            content is File -> content.asRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == FormDataMediaType -> {
+                MultipartBody.Builder()
+                    .setType(MultipartBody.FORM)
+                    .apply {
+                        // content's type *must* be Map<String, Any?>
+                        @Suppress("UNCHECKED_CAST")
+                        (content as Map<String, Any?>).forEach { (key, value) ->
+                            if (value is File) {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\"; filename=\"${value.name}\""
+                                )
+                                val fileMediaType = guessContentTypeFromFile(value).toMediaTypeOrNull()
+                                addPart(partHeaders, value.asRequestBody(fileMediaType))
+                            } else {
+                                val partHeaders = Headers.headersOf(
+                                    "Content-Disposition",
+                                    "form-data; name=\"$key\""
+                                )
+                                addPart(
+                                    partHeaders,
+                                    parameterToString(value).toRequestBody(null)
+                                )
+                            }
+                        }
+                    }.build()
+            }
+            mediaType == FormUrlEncMediaType -> {
+                FormBody.Builder().apply {
+                    // content's type *must* be Map<String, Any?>
+                    @Suppress("UNCHECKED_CAST")
+                    (content as Map<String, Any?>).forEach { (key, value) ->
+                        add(key, parameterToString(value))
+                    }
+                }.build()
+            }
+            mediaType == JsonMediaType -> Serializer.moshi.adapter(T::class.java).toJson(content).toRequestBody(
+                mediaType.toMediaTypeOrNull()
+            )
+            mediaType == XmlMediaType -> throw UnsupportedOperationException("xml not currently supported.")
+            // TODO: this should be extended with other serializers
+            else -> throw UnsupportedOperationException("requestBody currently only supports JSON body and File body.")
+        }
+
+    protected inline fun <reified T: Any?> responseBody(body: ResponseBody?, mediaType: String? = JsonMediaType): T? {
+        if(body == null) {
+            return null
+        }
+        val bodyContent = body.string()
+        if (bodyContent.isEmpty()) {
+            return null
+        }
+        return when(mediaType) {
+            JsonMediaType -> Serializer.moshi.adapter(T::class.java).fromJson(bodyContent)
+            else ->  throw UnsupportedOperationException("responseBody currently only supports JSON body.")
+        }
+    }
+
+    protected fun updateAuthParams(requestConfig: RequestConfig) {
+        if (requestConfig.headers["api_key"].isNullOrEmpty()) {
+            if (apiKey["api_key"] != null) {
+                if (apiKeyPrefix["api_key"] != null) {
+                    requestConfig.headers["api_key"] = apiKeyPrefix["api_key"]!! + " " + apiKey["api_key"]!!
+                } else {
+                    requestConfig.headers["api_key"] = apiKey["api_key"]!!
+                }
+            }
+        }
+        if (requestConfig.headers[Authorization].isNullOrEmpty()) {
+            accessToken?.let { accessToken ->
+                requestConfig.headers[Authorization] = "Bearer $accessToken "
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any?> request(requestConfig: RequestConfig): ApiInfrastructureResponse<T?> {
+        val httpUrl = baseUrl.toHttpUrlOrNull() ?: throw IllegalStateException("baseUrl is invalid.")
+
+        // take authMethod from operation
+        updateAuthParams(requestConfig)
+
+        val url = httpUrl.newBuilder()
+            .addPathSegments(requestConfig.path.trimStart('/'))
+            .apply {
+                requestConfig.query.forEach { query ->
+                    query.value.forEach { queryValue ->
+                        addQueryParameter(query.key, queryValue)
+                    }
+                }
+            }.build()
+
+        // take content-type/accept from spec or set to default (application/json) if not defined
+        if (requestConfig.headers[ContentType].isNullOrEmpty()) {
+            requestConfig.headers[ContentType] = JsonMediaType
+        }
+        if (requestConfig.headers[Accept].isNullOrEmpty()) {
+            requestConfig.headers[Accept] = JsonMediaType
+        }
+        val headers = requestConfig.headers
+
+        if(headers[ContentType] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Content-Type header. This is required.")
+        }
+
+        if(headers[Accept] ?: "" == "") {
+            throw kotlin.IllegalStateException("Missing Accept header. This is required.")
+        }
+
+        // TODO: support multiple contentType options here.
+        val contentType = (headers[ContentType] as String).substringBefore(";").toLowerCase()
+
+        val request = when (requestConfig.method) {
+            RequestMethod.DELETE -> Request.Builder().url(url).delete(requestBody(requestConfig.body, contentType))
+            RequestMethod.GET -> Request.Builder().url(url)
+            RequestMethod.HEAD -> Request.Builder().url(url).head()
+            RequestMethod.PATCH -> Request.Builder().url(url).patch(requestBody(requestConfig.body, contentType))
+            RequestMethod.PUT -> Request.Builder().url(url).put(requestBody(requestConfig.body, contentType))
+            RequestMethod.POST -> Request.Builder().url(url).post(requestBody(requestConfig.body, contentType))
+            RequestMethod.OPTIONS -> Request.Builder().url(url).method("OPTIONS", null)
+        }.apply {
+            headers.forEach { header -> addHeader(header.key, header.value) }
+        }.build()
+
+        val response = client.newCall(request).execute()
+        val accept = response.header(ContentType)?.substringBefore(";")?.toLowerCase()
+
+        // TODO: handle specific mapping types. e.g. Map<int, Class<?>>
+        when {
+            response.isRedirect -> return Redirection(
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isInformational -> return Informational(
+                    response.message,
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isSuccessful -> return Success(
+                    responseBody(response.body, accept),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            response.isClientError -> return ClientError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+            else -> return ServerError(
+                    response.message,
+                    response.body?.string(),
+                    response.code,
+                    response.headers.toMultimap()
+            )
+        }
+    }
+
+    protected fun parameterToString(value: Any?): String {
+        when (value) {
+            null -> {
+                return ""
+            }
+            is Array<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is Iterable<*> -> {
+                return toMultiValue(value, "csv").toString()
+            }
+            is OffsetDateTime, is OffsetTime, is LocalDateTime, is LocalDate, is LocalTime, is Date -> {
+                return parseDateToQueryString<Any>(value)
+            }
+            else -> {
+                return value.toString()
+            }
+        }
+    }
+
+    protected inline fun <reified T: Any> 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.moshi.adapter(T::class.java).toJson(value).replace("\"", "")
+    }
+}
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9dc8d8dbbfaaef4f86a4f65b8a908ba9e4507060
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApiInfrastructureResponse.kt
@@ -0,0 +1,43 @@
+package org.openapitools.client.infrastructure
+
+enum class ResponseType {
+    Success, Informational, Redirection, ClientError, ServerError
+}
+
+interface Response
+
+abstract class ApiInfrastructureResponse<T>(val responseType: ResponseType): Response {
+    abstract val statusCode: Int
+    abstract val headers: Map<String,List<String>>
+}
+
+class Success<T>(
+    val data: T,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+): ApiInfrastructureResponse<T>(ResponseType.Success)
+
+class Informational<T>(
+    val statusText: String,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Informational)
+
+class Redirection<T>(
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.Redirection)
+
+class ClientError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>> = mapOf()
+) : ApiInfrastructureResponse<T>(ResponseType.ClientError)
+
+class ServerError<T>(
+    val message: String? = null,
+    val body: Any? = null,
+    override val statusCode: Int = -1,
+    override val headers: Map<String, List<String>>
+): ApiInfrastructureResponse<T>(ResponseType.ServerError)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
new file mode 100644
index 0000000000000000000000000000000000000000..dd34bd48b2c01a3b2cc449fd1952635bfb9c0c85
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ApplicationDelegates.kt
@@ -0,0 +1,29 @@
+package org.openapitools.client.infrastructure
+
+import kotlin.properties.ReadWriteProperty
+import kotlin.reflect.KProperty
+
+object ApplicationDelegates {
+    /**
+     * Provides a property delegate, allowing the property to be set once and only once.
+     *
+     * If unset (no default value), a get on the property will throw [IllegalStateException].
+     */
+    fun <T> setOnce(defaultValue: T? = null) : ReadWriteProperty<Any?, T> = SetOnce(defaultValue)
+
+    private class SetOnce<T>(defaultValue: T? = null) : ReadWriteProperty<Any?, T> {
+        private var isSet = false
+        private var value: T? = defaultValue
+
+        override fun getValue(thisRef: Any?, property: KProperty<*>): T {
+            return value ?: throw IllegalStateException("${property.name} not initialized")
+        }
+
+        override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = synchronized(this) {
+            if (!isSet) {
+                this.value = value
+                isSet = true
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ff5e2a81ee8ce2677c90a56384c165450f0c5b18
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ByteArrayAdapter.kt
@@ -0,0 +1,12 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+
+class ByteArrayAdapter {
+    @ToJson
+    fun toJson(data: ByteArray): String = String(data)
+
+    @FromJson
+    fun fromJson(data: String): ByteArray = data.toByteArray()
+}
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/Errors.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/Errors.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b5310e71f13c7e7fb874be998af37dd424d9cd11
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/Errors.kt
@@ -0,0 +1,18 @@
+@file:Suppress("unused")
+package org.openapitools.client.infrastructure
+
+import java.lang.RuntimeException
+
+open class ClientException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 123L
+    }
+}
+
+open class ServerException(message: kotlin.String? = null, val statusCode: Int = -1, val response: Response? = null) : RuntimeException(message) {
+
+    companion object {
+        private const val serialVersionUID: Long = 456L
+    }
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b2e1654479a01d0c02930408910cc70d93f16c9d
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/LocalDateAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.LocalDate
+import java.time.format.DateTimeFormatter
+
+class LocalDateAdapter {
+    @ToJson
+    fun toJson(value: LocalDate): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDate {
+        return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..e082db94811d386498db8b1cd56cf58af82bad56
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/LocalDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
+
+class LocalDateTimeAdapter {
+    @ToJson
+    fun toJson(value: LocalDateTime): String {
+        return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): LocalDateTime {
+        return LocalDateTime.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..87437871a31e6ae83dca8573985f7d178ce6f3e6
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/OffsetDateTimeAdapter.kt
@@ -0,0 +1,19 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.time.OffsetDateTime
+import java.time.format.DateTimeFormatter
+
+class OffsetDateTimeAdapter {
+    @ToJson
+    fun toJson(value: OffsetDateTime): String {
+        return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(value)
+    }
+
+    @FromJson
+    fun fromJson(value: String): OffsetDateTime {
+        return OffsetDateTime.parse(value, DateTimeFormatter.ISO_OFFSET_DATE_TIME)
+    }
+
+}
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
new file mode 100644
index 0000000000000000000000000000000000000000..0f2790f370e29d3fceb044c2309dd945cd562eeb
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/RequestConfig.kt
@@ -0,0 +1,17 @@
+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<String,String> because rfc2616 defines
+ *       multi-valued headers as csv-only.
+ */
+data class RequestConfig(
+    val method: RequestMethod,
+    val path: String,
+    val headers: MutableMap<String, String> = mutableMapOf(),
+    val query: MutableMap<String, List<String>> = mutableMapOf(),
+    val body: kotlin.Any? = null
+)
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/RequestMethod.kt
new file mode 100644
index 0000000000000000000000000000000000000000..931b12b8bd7a6dba7362eaafc490edf709d14616
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/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
+}
\ No newline at end of file
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9bd2790dc144a3794c7957fdff86c114e5570c99
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/ResponseExtensions.kt
@@ -0,0 +1,24 @@
+package org.openapitools.client.infrastructure
+
+import okhttp3.Response
+
+/**
+ * Provides an extension to evaluation whether the response is a 1xx code
+ */
+val Response.isInformational : Boolean get() = this.code in 100..199
+
+/**
+ * Provides an extension to evaluation whether the response is a 3xx code
+ */
+@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
+val Response.isRedirect : Boolean get() = this.code in 300..399
+
+/**
+ * Provides an extension to evaluation whether the response is a 4xx code
+ */
+val Response.isClientError : Boolean get() = this.code in 400..499
+
+/**
+ * Provides an extension to evaluation whether the response is a 5xx (Standard) through 999 (non-standard) code
+ */
+val Response.isServerError : Boolean get() = this.code in 500..999
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/Serializer.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/Serializer.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9a45b67d9b1a435f1ebfa35c6d6c0fd329cea27b
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/Serializer.kt
@@ -0,0 +1,21 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.Moshi
+import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
+import java.util.Date
+
+object Serializer {
+    @JvmStatic
+    val moshiBuilder: Moshi.Builder = Moshi.Builder()
+        .add(OffsetDateTimeAdapter())
+        .add(LocalDateTimeAdapter())
+        .add(LocalDateAdapter())
+        .add(UUIDAdapter())
+        .add(ByteArrayAdapter())
+        .add(KotlinJsonAdapterFactory())
+
+    @JvmStatic
+    val moshi: Moshi by lazy {
+        moshiBuilder.build()
+    }
+}
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
new file mode 100644
index 0000000000000000000000000000000000000000..a4a44cc18b73e4a0ec722fa385e0276dbfbac670
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/infrastructure/UUIDAdapter.kt
@@ -0,0 +1,13 @@
+package org.openapitools.client.infrastructure
+
+import com.squareup.moshi.FromJson
+import com.squareup.moshi.ToJson
+import java.util.UUID
+
+class UUIDAdapter {
+    @ToJson
+    fun toJson(uuid: UUID) = uuid.toString()
+
+    @FromJson
+    fun fromJson(s: String) = UUID.fromString(s)
+}
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/ApiResponse.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/ApiResponse.kt
new file mode 100644
index 0000000000000000000000000000000000000000..7d40c8efbc2f02676165dc9c33c00667df36cb87
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/ApiResponse.kt
@@ -0,0 +1,38 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+import java.io.Serializable
+
+/**
+ * Describes the result of uploading an image resource
+ * @param code 
+ * @param type 
+ * @param message 
+ */
+
+data class ApiResponse (
+    @Json(name = "code")
+    val code: kotlin.Int? = null,
+    @Json(name = "type")
+    val type: kotlin.String? = null,
+    @Json(name = "message")
+    val message: kotlin.String? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+}
+
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Category.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ceb0fbc8fe6087d846ab9681db045aacdafe6d9a
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Category.kt
@@ -0,0 +1,35 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+import java.io.Serializable
+
+/**
+ * A category for a pet
+ * @param id 
+ * @param name 
+ */
+
+data class Category (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "name")
+    val name: kotlin.String? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+}
+
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Order.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ed8f8b13a43bbd6ec2676bde2e3efd0dbaefa2cd
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Order.kt
@@ -0,0 +1,58 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+import java.io.Serializable
+
+/**
+ * An order for a pets from the pet store
+ * @param id 
+ * @param petId 
+ * @param quantity 
+ * @param shipDate 
+ * @param status Order Status
+ * @param complete 
+ */
+
+data class Order (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "petId")
+    val petId: kotlin.Long? = null,
+    @Json(name = "quantity")
+    val quantity: kotlin.Int? = null,
+    @Json(name = "shipDate")
+    val shipDate: java.time.OffsetDateTime? = null,
+    /* Order Status */
+    @Json(name = "status")
+    val status: Order.Status? = null,
+    @Json(name = "complete")
+    val complete: kotlin.Boolean? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+    /**
+    * Order Status
+    * Values: placed,approved,delivered
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @Json(name = "placed") placed("placed"),
+        @Json(name = "approved") approved("approved"),
+        @Json(name = "delivered") delivered("delivered");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Pet.kt
new file mode 100644
index 0000000000000000000000000000000000000000..105f485f021d0465393491221f926e9246331fb1
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Pet.kt
@@ -0,0 +1,60 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+import org.openapitools.client.models.Category
+import org.openapitools.client.models.Tag
+
+import com.squareup.moshi.Json
+import java.io.Serializable
+
+/**
+ * A pet for sale in the pet store
+ * @param name 
+ * @param photoUrls 
+ * @param id 
+ * @param category 
+ * @param tags 
+ * @param status pet status in the store
+ */
+
+data class Pet (
+    @Json(name = "name")
+    val name: kotlin.String,
+    @Json(name = "photoUrls")
+    val photoUrls: kotlin.collections.List<kotlin.String>,
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "category")
+    val category: Category? = null,
+    @Json(name = "tags")
+    val tags: kotlin.collections.List<Tag>? = null,
+    /* pet status in the store */
+    @Json(name = "status")
+    val status: Pet.Status? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+    /**
+    * pet status in the store
+    * Values: available,pending,sold
+    */
+    
+    enum class Status(val value: kotlin.String){
+        @Json(name = "available") available("available"),
+        @Json(name = "pending") pending("pending"),
+        @Json(name = "sold") sold("sold");
+    }
+}
+
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Tag.kt
new file mode 100644
index 0000000000000000000000000000000000000000..944b1cd0a141546f8e31f284f522276edc1f299b
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/Tag.kt
@@ -0,0 +1,35 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+import java.io.Serializable
+
+/**
+ * A tag for a pet
+ * @param id 
+ * @param name 
+ */
+
+data class Tag (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "name")
+    val name: kotlin.String? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+}
+
diff --git a/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/User.kt
new file mode 100644
index 0000000000000000000000000000000000000000..9697f07d5bf881ae0ca1f808a4a00866b7030603
--- /dev/null
+++ b/samples/client/petstore/kotlin/bin/main/org/openapitools/client/models/User.kt
@@ -0,0 +1,54 @@
+/**
+* OpenAPI Petstore
+* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+*
+* The version of the OpenAPI document: 1.0.0
+* 
+*
+* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+* https://openapi-generator.tech
+* Do not edit the class manually.
+*/
+package org.openapitools.client.models
+
+
+import com.squareup.moshi.Json
+import java.io.Serializable
+
+/**
+ * A User who is purchasing from the pet store
+ * @param id 
+ * @param username 
+ * @param firstName 
+ * @param lastName 
+ * @param email 
+ * @param password 
+ * @param phone 
+ * @param userStatus User Status
+ */
+
+data class User (
+    @Json(name = "id")
+    val id: kotlin.Long? = null,
+    @Json(name = "username")
+    val username: kotlin.String? = null,
+    @Json(name = "firstName")
+    val firstName: kotlin.String? = null,
+    @Json(name = "lastName")
+    val lastName: kotlin.String? = null,
+    @Json(name = "email")
+    val email: kotlin.String? = null,
+    @Json(name = "password")
+    val password: kotlin.String? = null,
+    @Json(name = "phone")
+    val phone: kotlin.String? = null,
+    /* User Status */
+    @Json(name = "userStatus")
+    val userStatus: kotlin.Int? = null
+) : Serializable {
+    companion object {
+        private const val serialVersionUID: Long = 123
+    }
+
+}
+
diff --git a/samples/client/petstore/perl/.openapi-generator/FILES b/samples/client/petstore/perl/.openapi-generator/FILES
index bcb69b109567f51073a674b5c098ffb26b0d2e87..b3338f2161be62c35ea9fb99f97a49385c4186f5 100644
--- a/samples/client/petstore/perl/.openapi-generator/FILES
+++ b/samples/client/petstore/perl/.openapi-generator/FILES
@@ -44,6 +44,7 @@ docs/OuterEnum.md
 docs/OuterEnumDefaultValue.md
 docs/OuterEnumInteger.md
 docs/OuterEnumIntegerDefaultValue.md
+docs/OuterObjectWithEnumProperty.md
 docs/Pet.md
 docs/PetApi.md
 docs/ReadOnlyFirst.md
@@ -98,6 +99,7 @@ lib/WWW/OpenAPIClient/Object/OuterEnum.pm
 lib/WWW/OpenAPIClient/Object/OuterEnumDefaultValue.pm
 lib/WWW/OpenAPIClient/Object/OuterEnumInteger.pm
 lib/WWW/OpenAPIClient/Object/OuterEnumIntegerDefaultValue.pm
+lib/WWW/OpenAPIClient/Object/OuterObjectWithEnumProperty.pm
 lib/WWW/OpenAPIClient/Object/Pet.pm
 lib/WWW/OpenAPIClient/Object/ReadOnlyFirst.pm
 lib/WWW/OpenAPIClient/Object/SpecialModelName.pm
@@ -108,3 +110,4 @@ lib/WWW/OpenAPIClient/Role.pm
 lib/WWW/OpenAPIClient/Role/AutoDoc.pm
 lib/WWW/OpenAPIClient/StoreApi.pm
 lib/WWW/OpenAPIClient/UserApi.pm
+t/OuterObjectWithEnumPropertyTest.t
diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md
index 69d1869c143d42cf766e432894e4f8c6c8d0054c..7f6ca19b21f7e134b877ea3f0896ecd2debb3614 100644
--- a/samples/client/petstore/perl/README.md
+++ b/samples/client/petstore/perl/README.md
@@ -271,6 +271,7 @@ use WWW::OpenAPIClient::Object::OuterEnum;
 use WWW::OpenAPIClient::Object::OuterEnumDefaultValue;
 use WWW::OpenAPIClient::Object::OuterEnumInteger;
 use WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue;
+use WWW::OpenAPIClient::Object::OuterObjectWithEnumProperty;
 use WWW::OpenAPIClient::Object::Pet;
 use WWW::OpenAPIClient::Object::ReadOnlyFirst;
 use WWW::OpenAPIClient::Object::SpecialModelName;
@@ -334,6 +335,7 @@ use WWW::OpenAPIClient::Object::OuterEnum;
 use WWW::OpenAPIClient::Object::OuterEnumDefaultValue;
 use WWW::OpenAPIClient::Object::OuterEnumInteger;
 use WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue;
+use WWW::OpenAPIClient::Object::OuterObjectWithEnumProperty;
 use WWW::OpenAPIClient::Object::Pet;
 use WWW::OpenAPIClient::Object::ReadOnlyFirst;
 use WWW::OpenAPIClient::Object::SpecialModelName;
@@ -373,6 +375,7 @@ Class | Method | HTTP request | Description
 *FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | 
 *FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | 
 *FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | 
+*FakeApi* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | 
 *FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | 
 *FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | 
 *FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model
@@ -445,6 +448,7 @@ Class | Method | HTTP request | Description
  - [WWW::OpenAPIClient::Object::OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md)
  - [WWW::OpenAPIClient::Object::OuterEnumInteger](docs/OuterEnumInteger.md)
  - [WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
+ - [WWW::OpenAPIClient::Object::OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md)
  - [WWW::OpenAPIClient::Object::Pet](docs/Pet.md)
  - [WWW::OpenAPIClient::Object::ReadOnlyFirst](docs/ReadOnlyFirst.md)
  - [WWW::OpenAPIClient::Object::SpecialModelName](docs/SpecialModelName.md)
diff --git a/samples/client/petstore/perl/docs/FakeApi.md b/samples/client/petstore/perl/docs/FakeApi.md
index be76016b63ec2919f3d14d57b810faa3366aaadf..d1696217c5946b81a39a5f4fc2ce279d07361eed 100644
--- a/samples/client/petstore/perl/docs/FakeApi.md
+++ b/samples/client/petstore/perl/docs/FakeApi.md
@@ -15,6 +15,7 @@ Method | HTTP request | Description
 [**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | 
 [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | 
 [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | 
+[**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | 
 [**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | 
 [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | 
 [**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model
@@ -300,6 +301,52 @@ No authorization required
 
 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
 
+# **fake_property_enum_integer_serialize**
+> OuterObjectWithEnumProperty fake_property_enum_integer_serialize(outer_object_with_enum_property => $outer_object_with_enum_property)
+
+
+
+Test serialization of enum (int) properties with examples
+
+### Example 
+```perl
+use Data::Dumper;
+use WWW::OpenAPIClient::FakeApi;
+my $api_instance = WWW::OpenAPIClient::FakeApi->new(
+);
+
+my $outer_object_with_enum_property = WWW::OpenAPIClient::Object::OuterObjectWithEnumProperty->new(); # OuterObjectWithEnumProperty | Input enum (int) as post body
+
+eval { 
+    my $result = $api_instance->fake_property_enum_integer_serialize(outer_object_with_enum_property => $outer_object_with_enum_property);
+    print Dumper($result);
+};
+if ($@) {
+    warn "Exception when calling FakeApi->fake_property_enum_integer_serialize: $@\n";
+}
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **outer_object_with_enum_property** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | 
+
+### Return type
+
+[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: */*
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
 # **test_body_with_file_schema**
 > test_body_with_file_schema(file_schema_test_class => $file_schema_test_class)
 
diff --git a/samples/client/petstore/perl/docs/OuterObjectWithEnumProperty.md b/samples/client/petstore/perl/docs/OuterObjectWithEnumProperty.md
new file mode 100644
index 0000000000000000000000000000000000000000..93885100ebb6c226883d67dd5e4202d5ca5a2c86
--- /dev/null
+++ b/samples/client/petstore/perl/docs/OuterObjectWithEnumProperty.md
@@ -0,0 +1,15 @@
+# WWW::OpenAPIClient::Object::OuterObjectWithEnumProperty
+
+## Load the model package
+```perl
+use WWW::OpenAPIClient::Object::OuterObjectWithEnumProperty;
+```
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**value** | [**OuterEnumInteger**](OuterEnumInteger.md) |  | 
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm
index 4debb5412ca341fe5dbc8b71a324c7372a6cc577..8646aa3cc078c18e9ad6099fc05a5ee7611460b9 100644
--- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm
+++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm
@@ -420,6 +420,71 @@ sub fake_outer_string_serialize {
     return $_response_object;
 }
 
+#
+# fake_property_enum_integer_serialize
+#
+# 
+# 
+# @param OuterObjectWithEnumProperty $outer_object_with_enum_property Input enum (int) as post body (required)
+{
+    my $params = {
+    'outer_object_with_enum_property' => {
+        data_type => 'OuterObjectWithEnumProperty',
+        description => 'Input enum (int) as post body',
+        required => '1',
+    },
+    };
+    __PACKAGE__->method_documentation->{ 'fake_property_enum_integer_serialize' } = { 
+        summary => '',
+        params => $params,
+        returns => 'OuterObjectWithEnumProperty',
+        };
+}
+# @return OuterObjectWithEnumProperty
+#
+sub fake_property_enum_integer_serialize {
+    my ($self, %args) = @_;
+
+    # verify the required parameter 'outer_object_with_enum_property' is set
+    unless (exists $args{'outer_object_with_enum_property'}) {
+      croak("Missing the required parameter 'outer_object_with_enum_property' when calling fake_property_enum_integer_serialize");
+    }
+
+    # parse inputs
+    my $_resource_path = '/fake/property/enum-int';
+
+    my $_method = 'POST';
+    my $query_params = {};
+    my $header_params = {};
+    my $form_params = {};
+
+    # 'Accept' and 'Content-Type' header
+    my $_header_accept = $self->{api_client}->select_header_accept('*/*');
+    if ($_header_accept) {
+        $header_params->{'Accept'} = $_header_accept;
+    }
+    $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json');
+
+    my $_body_data;
+    # body params
+    if ( exists $args{'outer_object_with_enum_property'}) {
+        $_body_data = $args{'outer_object_with_enum_property'};
+    }
+
+    # authentication setting, if any
+    my $auth_settings = [qw()];
+
+    # make the API Call
+    my $response = $self->{api_client}->call_api($_resource_path, $_method,
+                                           $query_params, $form_params,
+                                           $header_params, $_body_data, $auth_settings);
+    if (!$response) {
+        return;
+    }
+    my $_response_object = $self->{api_client}->deserialize('OuterObjectWithEnumProperty', $response);
+    return $_response_object;
+}
+
 #
 # test_body_with_file_schema
 #
diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterObjectWithEnumProperty.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterObjectWithEnumProperty.pm
new file mode 100644
index 0000000000000000000000000000000000000000..39644d24d5c2b21ed4c0139e091bc93b7fea8d2a
--- /dev/null
+++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterObjectWithEnumProperty.pm
@@ -0,0 +1,185 @@
+=begin comment
+
+OpenAPI Petstore
+
+This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+
+The version of the OpenAPI document: 1.0.0
+
+Generated by: https://openapi-generator.tech
+
+=end comment
+
+=cut
+
+#
+# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+# Do not edit the class manually.
+# Ref: https://openapi-generator.tech
+#
+package WWW::OpenAPIClient::Object::OuterObjectWithEnumProperty;
+
+require 5.6.0;
+use strict;
+use warnings;
+use utf8;
+use JSON qw(decode_json);
+use Data::Dumper;
+use Module::Runtime qw(use_module);
+use Log::Any qw($log);
+use Date::Parse;
+use DateTime;
+
+use WWW::OpenAPIClient::Object::OuterEnumInteger;
+
+use base ("Class::Accessor", "Class::Data::Inheritable");
+
+#
+#
+#
+# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually.
+# REF: https://openapi-generator.tech
+#
+
+=begin comment
+
+OpenAPI Petstore
+
+This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+
+The version of the OpenAPI document: 1.0.0
+
+Generated by: https://openapi-generator.tech
+
+=end comment
+
+=cut
+
+#
+# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+# Do not edit the class manually.
+# Ref: https://openapi-generator.tech
+#
+__PACKAGE__->mk_classdata('attribute_map' => {});
+__PACKAGE__->mk_classdata('openapi_types' => {});
+__PACKAGE__->mk_classdata('method_documentation' => {}); 
+__PACKAGE__->mk_classdata('class_documentation' => {});
+
+# new plain object
+sub new { 
+    my ($class, %args) = @_; 
+
+    my $self = bless {}, $class;
+
+    $self->init(%args);
+    
+    return $self;
+}
+
+# initialize the object
+sub init
+{
+    my ($self, %args) = @_;
+
+    foreach my $attribute (keys %{$self->attribute_map}) {
+        my $args_key = $self->attribute_map->{$attribute};
+        $self->$attribute( $args{ $args_key } );
+    }
+}
+
+# return perl hash
+sub to_hash {
+    my $self = shift;
+    my $_hash = decode_json(JSON->new->convert_blessed->encode($self));
+
+    return $_hash;
+}
+
+# used by JSON for serialization
+sub TO_JSON { 
+    my $self = shift;
+    my $_data = {};
+    foreach my $_key (keys %{$self->attribute_map}) {
+        if (defined $self->{$_key}) {
+            $_data->{$self->attribute_map->{$_key}} = $self->{$_key};
+        }
+    }
+
+    return $_data;
+}
+
+# from Perl hashref
+sub from_hash {
+    my ($self, $hash) = @_;
+
+    # loop through attributes and use openapi_types to deserialize the data
+    while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
+        my $_json_attribute = $self->attribute_map->{$_key}; 
+        if ($_type =~ /^array\[(.+)\]$/i) { # array
+            my $_subclass = $1;
+            my @_array = ();
+            foreach my $_element (@{$hash->{$_json_attribute}}) {
+                push @_array, $self->_deserialize($_subclass, $_element);
+            }
+            $self->{$_key} = \@_array;
+        } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash
+            my $_subclass = $1;
+            my %_hash = ();
+            while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) {
+                $_hash{$_key} = $self->_deserialize($_subclass, $_element);
+            }
+            $self->{$_key} = \%_hash;
+        } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
+            $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
+        } else {
+            $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
+        }
+    }
+  
+    return $self;
+}
+
+# deserialize non-array data
+sub _deserialize {
+    my ($self, $type, $data) = @_;
+    $log->debugf("deserializing %s with %s",Dumper($data), $type);
+
+    if ($type eq 'DateTime') {
+        return DateTime->from_epoch(epoch => str2time($data));
+    } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) {
+        return $data;
+    } else { # hash(model)
+        my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()";
+        return $_instance->from_hash($data);
+    }
+}
+
+
+
+__PACKAGE__->class_documentation({description => '',
+                                  class => 'OuterObjectWithEnumProperty',
+                                  required => [], # TODO
+}                                 );
+
+__PACKAGE__->method_documentation({
+    'value' => {
+        datatype => 'OuterEnumInteger',
+        base_name => 'value',
+        description => '',
+        format => '',
+        read_only => '',
+            },
+});
+
+__PACKAGE__->openapi_types( {
+    'value' => 'OuterEnumInteger'
+} );
+
+__PACKAGE__->attribute_map( {
+    'value' => 'value'
+} );
+
+__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
+
+
+1;
diff --git a/samples/client/petstore/perl/t/OuterObjectWithEnumPropertyTest.t b/samples/client/petstore/perl/t/OuterObjectWithEnumPropertyTest.t
new file mode 100644
index 0000000000000000000000000000000000000000..ee2a31d89da847c337f3e0e2ff1744ccc0a7d73a
--- /dev/null
+++ b/samples/client/petstore/perl/t/OuterObjectWithEnumPropertyTest.t
@@ -0,0 +1,33 @@
+=begin comment
+
+OpenAPI Petstore
+
+This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+
+The version of the OpenAPI document: 1.0.0
+
+Generated by: https://openapi-generator.tech
+
+=end comment
+
+=cut
+
+#
+# NOTE: This class is auto generated by the OpenAPI Generator
+# Please update the test cases below to test the model.
+# Ref: https://openapi-generator.tech
+#
+use Test::More tests => 2;
+use Test::Exception;
+
+use lib 'lib';
+use strict;
+use warnings;
+
+
+use_ok('WWW::OpenAPIClient::Object::OuterObjectWithEnumProperty');
+
+my $instance = WWW::OpenAPIClient::Object::OuterObjectWithEnumProperty->new();
+
+isa_ok($instance, 'WWW::OpenAPIClient::Object::OuterObjectWithEnumProperty');
+
diff --git a/samples/client/petstore/php/OpenAPIClient-php/.openapi-generator/FILES b/samples/client/petstore/php/OpenAPIClient-php/.openapi-generator/FILES
index dc5379a47ec24314362c3346739425b63bd810fc..f08b2a607731d4220db062d0d2639bebd76763cd 100644
--- a/samples/client/petstore/php/OpenAPIClient-php/.openapi-generator/FILES
+++ b/samples/client/petstore/php/OpenAPIClient-php/.openapi-generator/FILES
@@ -48,6 +48,7 @@ docs/Model/OuterEnum.md
 docs/Model/OuterEnumDefaultValue.md
 docs/Model/OuterEnumInteger.md
 docs/Model/OuterEnumIntegerDefaultValue.md
+docs/Model/OuterObjectWithEnumProperty.md
 docs/Model/Pet.md
 docs/Model/ReadOnlyFirst.md
 docs/Model/SpecialModelName.md
@@ -103,6 +104,7 @@ lib/Model/OuterEnum.php
 lib/Model/OuterEnumDefaultValue.php
 lib/Model/OuterEnumInteger.php
 lib/Model/OuterEnumIntegerDefaultValue.php
+lib/Model/OuterObjectWithEnumProperty.php
 lib/Model/Pet.php
 lib/Model/ReadOnlyFirst.php
 lib/Model/SpecialModelName.php
@@ -110,3 +112,4 @@ lib/Model/Tag.php
 lib/Model/User.php
 lib/ObjectSerializer.php
 phpunit.xml.dist
+test/Model/OuterObjectWithEnumPropertyTest.php
diff --git a/samples/client/petstore/php/OpenAPIClient-php/README.md b/samples/client/petstore/php/OpenAPIClient-php/README.md
index 88a572629bb3ea876c1a51a84c01475a935da11d..2f4807ddee0b6e91b61e72865f8e4122b4bcc76b 100644
--- a/samples/client/petstore/php/OpenAPIClient-php/README.md
+++ b/samples/client/petstore/php/OpenAPIClient-php/README.md
@@ -79,6 +79,7 @@ Class | Method | HTTP request | Description
 *FakeApi* | [**fakeOuterCompositeSerialize**](docs/Api/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | 
 *FakeApi* | [**fakeOuterNumberSerialize**](docs/Api/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | 
 *FakeApi* | [**fakeOuterStringSerialize**](docs/Api/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | 
+*FakeApi* | [**fakePropertyEnumIntegerSerialize**](docs/Api/FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | 
 *FakeApi* | [**testBodyWithFileSchema**](docs/Api/FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | 
 *FakeApi* | [**testBodyWithQueryParams**](docs/Api/FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | 
 *FakeApi* | [**testClientModel**](docs/Api/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \&quot;client\&quot; model
@@ -151,6 +152,7 @@ Class | Method | HTTP request | Description
 - [OuterEnumDefaultValue](docs/Model/OuterEnumDefaultValue.md)
 - [OuterEnumInteger](docs/Model/OuterEnumInteger.md)
 - [OuterEnumIntegerDefaultValue](docs/Model/OuterEnumIntegerDefaultValue.md)
+- [OuterObjectWithEnumProperty](docs/Model/OuterObjectWithEnumProperty.md)
 - [Pet](docs/Model/Pet.md)
 - [ReadOnlyFirst](docs/Model/ReadOnlyFirst.md)
 - [SpecialModelName](docs/Model/SpecialModelName.md)
diff --git a/samples/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md b/samples/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md
index 30baf73838b0104894d2359f0e2080f3fbd6e05d..4319d48a4083125bedd2da3554c496e3abe01ff0 100644
--- a/samples/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md
+++ b/samples/client/petstore/php/OpenAPIClient-php/docs/Api/FakeApi.md
@@ -10,6 +10,7 @@ Method | HTTP request | Description
 [**fakeOuterCompositeSerialize()**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | 
 [**fakeOuterNumberSerialize()**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | 
 [**fakeOuterStringSerialize()**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | 
+[**fakePropertyEnumIntegerSerialize()**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | 
 [**testBodyWithFileSchema()**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | 
 [**testBodyWithQueryParams()**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | 
 [**testClientModel()**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model
@@ -355,6 +356,62 @@ No authorization required
 [[Back to Model list]](../../README.md#models)
 [[Back to README]](../../README.md)
 
+## `fakePropertyEnumIntegerSerialize()`
+
+```php
+fakePropertyEnumIntegerSerialize($outer_object_with_enum_property): \OpenAPI\Client\Model\OuterObjectWithEnumProperty
+```
+
+
+
+Test serialization of enum (int) properties with examples
+
+### Example
+
+```php
+<?php
+require_once(__DIR__ . '/vendor/autoload.php');
+
+
+
+$apiInstance = new OpenAPI\Client\Api\FakeApi(
+    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
+    // This is optional, `GuzzleHttp\Client` will be used as default.
+    new GuzzleHttp\Client()
+);
+$outer_object_with_enum_property = new \OpenAPI\Client\Model\OuterObjectWithEnumProperty(); // \OpenAPI\Client\Model\OuterObjectWithEnumProperty | Input enum (int) as post body
+
+try {
+    $result = $apiInstance->fakePropertyEnumIntegerSerialize($outer_object_with_enum_property);
+    print_r($result);
+} catch (Exception $e) {
+    echo 'Exception when calling FakeApi->fakePropertyEnumIntegerSerialize: ', $e->getMessage(), PHP_EOL;
+}
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **outer_object_with_enum_property** | [**\OpenAPI\Client\Model\OuterObjectWithEnumProperty**](../Model/OuterObjectWithEnumProperty.md)| Input enum (int) as post body |
+
+### Return type
+
+[**\OpenAPI\Client\Model\OuterObjectWithEnumProperty**](../Model/OuterObjectWithEnumProperty.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: `application/json`
+- **Accept**: `*/*`
+
+[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
+[[Back to Model list]](../../README.md#models)
+[[Back to README]](../../README.md)
+
 ## `testBodyWithFileSchema()`
 
 ```php
diff --git a/samples/client/petstore/php/OpenAPIClient-php/docs/Model/OuterObjectWithEnumProperty.md b/samples/client/petstore/php/OpenAPIClient-php/docs/Model/OuterObjectWithEnumProperty.md
new file mode 100644
index 0000000000000000000000000000000000000000..f2455a1972fb52338cb102ac5b7ea654b0f6abc9
--- /dev/null
+++ b/samples/client/petstore/php/OpenAPIClient-php/docs/Model/OuterObjectWithEnumProperty.md
@@ -0,0 +1,9 @@
+# # OuterObjectWithEnumProperty
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**value** | [**\OpenAPI\Client\Model\OuterEnumInteger**](OuterEnumInteger.md) |  |
+
+[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php
index f3797675f008a7309b2c7448c51ef84822b364cc..8b8f17d3acfdb26fe9b3ff8fde57332914897029 100644
--- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php
+++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php
@@ -1625,6 +1625,267 @@ class FakeApi
         );
     }
 
+    /**
+     * Operation fakePropertyEnumIntegerSerialize
+     *
+     * @param  \OpenAPI\Client\Model\OuterObjectWithEnumProperty $outer_object_with_enum_property Input enum (int) as post body (required)
+     *
+     * @throws \OpenAPI\Client\ApiException on non-2xx response
+     * @throws \InvalidArgumentException
+     * @return \OpenAPI\Client\Model\OuterObjectWithEnumProperty
+     */
+    public function fakePropertyEnumIntegerSerialize($outer_object_with_enum_property)
+    {
+        list($response) = $this->fakePropertyEnumIntegerSerializeWithHttpInfo($outer_object_with_enum_property);
+        return $response;
+    }
+
+    /**
+     * Operation fakePropertyEnumIntegerSerializeWithHttpInfo
+     *
+     * @param  \OpenAPI\Client\Model\OuterObjectWithEnumProperty $outer_object_with_enum_property Input enum (int) as post body (required)
+     *
+     * @throws \OpenAPI\Client\ApiException on non-2xx response
+     * @throws \InvalidArgumentException
+     * @return array of \OpenAPI\Client\Model\OuterObjectWithEnumProperty, HTTP status code, HTTP response headers (array of strings)
+     */
+    public function fakePropertyEnumIntegerSerializeWithHttpInfo($outer_object_with_enum_property)
+    {
+        $request = $this->fakePropertyEnumIntegerSerializeRequest($outer_object_with_enum_property);
+
+        try {
+            $options = $this->createHttpClientOption();
+            try {
+                $response = $this->client->send($request, $options);
+            } catch (RequestException $e) {
+                throw new ApiException(
+                    "[{$e->getCode()}] {$e->getMessage()}",
+                    $e->getCode(),
+                    $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+                    $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+                );
+            }
+
+            $statusCode = $response->getStatusCode();
+
+            if ($statusCode < 200 || $statusCode > 299) {
+                throw new ApiException(
+                    sprintf(
+                        '[%d] Error connecting to the API (%s)',
+                        $statusCode,
+                        $request->getUri()
+                    ),
+                    $statusCode,
+                    $response->getHeaders(),
+                    $response->getBody()
+                );
+            }
+
+            $responseBody = $response->getBody();
+            switch($statusCode) {
+                case 200:
+                    if ('\OpenAPI\Client\Model\OuterObjectWithEnumProperty' === '\SplFileObject') {
+                        $content = $responseBody; //stream goes to serializer
+                    } else {
+                        $content = (string) $responseBody;
+                    }
+
+                    return [
+                        ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\OuterObjectWithEnumProperty', []),
+                        $response->getStatusCode(),
+                        $response->getHeaders()
+                    ];
+            }
+
+            $returnType = '\OpenAPI\Client\Model\OuterObjectWithEnumProperty';
+            $responseBody = $response->getBody();
+            if ($returnType === '\SplFileObject') {
+                $content = $responseBody; //stream goes to serializer
+            } else {
+                $content = (string) $responseBody;
+            }
+
+            return [
+                ObjectSerializer::deserialize($content, $returnType, []),
+                $response->getStatusCode(),
+                $response->getHeaders()
+            ];
+
+        } catch (ApiException $e) {
+            switch ($e->getCode()) {
+                case 200:
+                    $data = ObjectSerializer::deserialize(
+                        $e->getResponseBody(),
+                        '\OpenAPI\Client\Model\OuterObjectWithEnumProperty',
+                        $e->getResponseHeaders()
+                    );
+                    $e->setResponseObject($data);
+                    break;
+            }
+            throw $e;
+        }
+    }
+
+    /**
+     * Operation fakePropertyEnumIntegerSerializeAsync
+     *
+     * 
+     *
+     * @param  \OpenAPI\Client\Model\OuterObjectWithEnumProperty $outer_object_with_enum_property Input enum (int) as post body (required)
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function fakePropertyEnumIntegerSerializeAsync($outer_object_with_enum_property)
+    {
+        return $this->fakePropertyEnumIntegerSerializeAsyncWithHttpInfo($outer_object_with_enum_property)
+            ->then(
+                function ($response) {
+                    return $response[0];
+                }
+            );
+    }
+
+    /**
+     * Operation fakePropertyEnumIntegerSerializeAsyncWithHttpInfo
+     *
+     * 
+     *
+     * @param  \OpenAPI\Client\Model\OuterObjectWithEnumProperty $outer_object_with_enum_property Input enum (int) as post body (required)
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Promise\PromiseInterface
+     */
+    public function fakePropertyEnumIntegerSerializeAsyncWithHttpInfo($outer_object_with_enum_property)
+    {
+        $returnType = '\OpenAPI\Client\Model\OuterObjectWithEnumProperty';
+        $request = $this->fakePropertyEnumIntegerSerializeRequest($outer_object_with_enum_property);
+
+        return $this->client
+            ->sendAsync($request, $this->createHttpClientOption())
+            ->then(
+                function ($response) use ($returnType) {
+                    $responseBody = $response->getBody();
+                    if ($returnType === '\SplFileObject') {
+                        $content = $responseBody; //stream goes to serializer
+                    } else {
+                        $content = (string) $responseBody;
+                    }
+
+                    return [
+                        ObjectSerializer::deserialize($content, $returnType, []),
+                        $response->getStatusCode(),
+                        $response->getHeaders()
+                    ];
+                },
+                function ($exception) {
+                    $response = $exception->getResponse();
+                    $statusCode = $response->getStatusCode();
+                    throw new ApiException(
+                        sprintf(
+                            '[%d] Error connecting to the API (%s)',
+                            $statusCode,
+                            $exception->getRequest()->getUri()
+                        ),
+                        $statusCode,
+                        $response->getHeaders(),
+                        $response->getBody()
+                    );
+                }
+            );
+    }
+
+    /**
+     * Create request for operation 'fakePropertyEnumIntegerSerialize'
+     *
+     * @param  \OpenAPI\Client\Model\OuterObjectWithEnumProperty $outer_object_with_enum_property Input enum (int) as post body (required)
+     *
+     * @throws \InvalidArgumentException
+     * @return \GuzzleHttp\Psr7\Request
+     */
+    public function fakePropertyEnumIntegerSerializeRequest($outer_object_with_enum_property)
+    {
+        // verify the required parameter 'outer_object_with_enum_property' is set
+        if ($outer_object_with_enum_property === null || (is_array($outer_object_with_enum_property) && count($outer_object_with_enum_property) === 0)) {
+            throw new \InvalidArgumentException(
+                'Missing the required parameter $outer_object_with_enum_property when calling fakePropertyEnumIntegerSerialize'
+            );
+        }
+
+        $resourcePath = '/fake/property/enum-int';
+        $formParams = [];
+        $queryParams = [];
+        $headerParams = [];
+        $httpBody = '';
+        $multipart = false;
+
+
+
+
+
+        if ($multipart) {
+            $headers = $this->headerSelector->selectHeadersForMultipart(
+                ['*/*']
+            );
+        } else {
+            $headers = $this->headerSelector->selectHeaders(
+                ['*/*'],
+                ['application/json']
+            );
+        }
+
+        // for model (json/xml)
+        if (isset($outer_object_with_enum_property)) {
+            if ($headers['Content-Type'] === 'application/json') {
+                $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($outer_object_with_enum_property));
+            } else {
+                $httpBody = $outer_object_with_enum_property;
+            }
+        } elseif (count($formParams) > 0) {
+            if ($multipart) {
+                $multipartContents = [];
+                foreach ($formParams as $formParamName => $formParamValue) {
+                    $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+                    foreach ($formParamValueItems as $formParamValueItem) {
+                        $multipartContents[] = [
+                            'name' => $formParamName,
+                            'contents' => $formParamValueItem
+                        ];
+                    }
+                }
+                // for HTTP post (form)
+                $httpBody = new MultipartStream($multipartContents);
+
+            } elseif ($headers['Content-Type'] === 'application/json') {
+                $httpBody = \GuzzleHttp\json_encode($formParams);
+
+            } else {
+                // for HTTP post (form)
+                $httpBody = \GuzzleHttp\Psr7\build_query($formParams);
+            }
+        }
+
+
+        $defaultHeaders = [];
+        if ($this->config->getUserAgent()) {
+            $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+        }
+
+        $headers = array_merge(
+            $defaultHeaders,
+            $headerParams,
+            $headers
+        );
+
+        $query = \GuzzleHttp\Psr7\build_query($queryParams);
+        return new Request(
+            'POST',
+            $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''),
+            $headers,
+            $httpBody
+        );
+    }
+
     /**
      * Operation testBodyWithFileSchema
      *
diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterObjectWithEnumProperty.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterObjectWithEnumProperty.php
new file mode 100644
index 0000000000000000000000000000000000000000..f735350238cf2107c015c4bf647ef633afed944f
--- /dev/null
+++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/OuterObjectWithEnumProperty.php
@@ -0,0 +1,327 @@
+<?php
+/**
+ * OuterObjectWithEnumProperty
+ *
+ * PHP version 7.2
+ *
+ * @category Class
+ * @package  OpenAPI\Client
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * 
+ * Generated by: https://openapi-generator.tech
+ * OpenAPI Generator version: 5.1.0-SNAPSHOT
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace OpenAPI\Client\Model;
+
+use \ArrayAccess;
+use \OpenAPI\Client\ObjectSerializer;
+
+/**
+ * OuterObjectWithEnumProperty Class Doc Comment
+ *
+ * @category Class
+ * @package  OpenAPI\Client
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<TKey, TValue>
+ * @template TKey int|null
+ * @template TValue mixed|null  
+ */
+class OuterObjectWithEnumProperty implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+      * The original name of the model.
+      *
+      * @var string
+      */
+    protected static $openAPIModelName = 'OuterObjectWithEnumProperty';
+
+    /**
+      * Array of property to type mappings. Used for (de)serialization
+      *
+      * @var string[]
+      */
+    protected static $openAPITypes = [
+        'value' => '\OpenAPI\Client\Model\OuterEnumInteger'
+    ];
+
+    /**
+      * Array of property to format mappings. Used for (de)serialization
+      *
+      * @var string[]
+      * @phpstan-var array<string, string|null>
+      * @psalm-var array<string, string|null>
+      */
+    protected static $openAPIFormats = [
+        'value' => null
+    ];
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPITypes()
+    {
+        return self::$openAPITypes;
+    }
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPIFormats()
+    {
+        return self::$openAPIFormats;
+    }
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @var string[]
+     */
+    protected static $attributeMap = [
+        'value' => 'value'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'value' => 'setValue'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'value' => 'getValue'
+    ];
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @return array
+     */
+    public static function attributeMap()
+    {
+        return self::$attributeMap;
+    }
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @return array
+     */
+    public static function setters()
+    {
+        return self::$setters;
+    }
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @return array
+     */
+    public static function getters()
+    {
+        return self::$getters;
+    }
+
+    /**
+     * The original name of the model.
+     *
+     * @return string
+     */
+    public function getModelName()
+    {
+        return self::$openAPIModelName;
+    }
+
+    
+
+    
+
+    /**
+     * Associative array for storing property values
+     *
+     * @var mixed[]
+     */
+    protected $container = [];
+
+    /**
+     * Constructor
+     *
+     * @param mixed[] $data Associated array of property values
+     *                      initializing the model
+     */
+    public function __construct(array $data = null)
+    {
+        $this->container['value'] = $data['value'] ?? null;
+    }
+
+    /**
+     * Show all the invalid properties with reasons.
+     *
+     * @return array invalid properties with reasons
+     */
+    public function listInvalidProperties()
+    {
+        $invalidProperties = [];
+
+        if ($this->container['value'] === null) {
+            $invalidProperties[] = "'value' can't be null";
+        }
+        return $invalidProperties;
+    }
+
+    /**
+     * Validate all the properties in the model
+     * return true if all passed
+     *
+     * @return bool True if all properties are valid
+     */
+    public function valid()
+    {
+        return count($this->listInvalidProperties()) === 0;
+    }
+
+
+    /**
+     * Gets value
+     *
+     * @return \OpenAPI\Client\Model\OuterEnumInteger
+     */
+    public function getValue()
+    {
+        return $this->container['value'];
+    }
+
+    /**
+     * Sets value
+     *
+     * @param \OpenAPI\Client\Model\OuterEnumInteger $value value
+     *
+     * @return self
+     */
+    public function setValue($value)
+    {
+        $this->container['value'] = $value;
+
+        return $this;
+    }
+    /**
+     * Returns true if offset exists. False otherwise.
+     *
+     * @param integer $offset Offset
+     *
+     * @return boolean
+     */
+    public function offsetExists($offset)
+    {
+        return isset($this->container[$offset]);
+    }
+
+    /**
+     * Gets offset.
+     *
+     * @param integer $offset Offset
+     *
+     * @return mixed|null
+     */
+    public function offsetGet($offset)
+    {
+        return $this->container[$offset] ?? null;
+    }
+
+    /**
+     * Sets value based on offset.
+     *
+     * @param int|null $offset Offset
+     * @param mixed    $value  Value to be set
+     *
+     * @return void
+     */
+    public function offsetSet($offset, $value)
+    {
+        if (is_null($offset)) {
+            $this->container[] = $value;
+        } else {
+            $this->container[$offset] = $value;
+        }
+    }
+
+    /**
+     * Unsets offset.
+     *
+     * @param integer $offset Offset
+     *
+     * @return void
+     */
+    public function offsetUnset($offset)
+    {
+        unset($this->container[$offset]);
+    }
+
+    /**
+     * Serializes the object to a value that can be serialized natively by json_encode().
+     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+     *
+     * @return mixed Returns data which can be serialized by json_encode(), which is a value
+     * of any type other than a resource.
+     */
+    public function jsonSerialize()
+    {
+       return ObjectSerializer::sanitizeForSerialization($this);
+    }
+
+    /**
+     * Gets the string presentation of the object
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return json_encode(
+            ObjectSerializer::sanitizeForSerialization($this),
+            JSON_PRETTY_PRINT
+        );
+    }
+
+    /**
+     * Gets a header-safe presentation of the object
+     *
+     * @return string
+     */
+    public function toHeaderValue()
+    {
+        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+    }
+}
+
+
diff --git a/samples/client/petstore/php/OpenAPIClient-php/test/Model/OuterObjectWithEnumPropertyTest.php b/samples/client/petstore/php/OpenAPIClient-php/test/Model/OuterObjectWithEnumPropertyTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..9b186f93f6c33c23740c0bb5551e6499620b7c6a
--- /dev/null
+++ b/samples/client/petstore/php/OpenAPIClient-php/test/Model/OuterObjectWithEnumPropertyTest.php
@@ -0,0 +1,91 @@
+<?php
+/**
+ * OuterObjectWithEnumPropertyTest
+ *
+ * PHP version 7.2
+ *
+ * @category Class
+ * @package  OpenAPI\Client
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * 
+ * Generated by: https://openapi-generator.tech
+ * OpenAPI Generator version: 5.1.0-SNAPSHOT
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Please update the test case below to test the model.
+ */
+
+namespace OpenAPI\Client\Test\Model;
+
+use PHPUnit\Framework\TestCase;
+
+/**
+ * OuterObjectWithEnumPropertyTest Class Doc Comment
+ *
+ * @category    Class
+ * @description OuterObjectWithEnumProperty
+ * @package     OpenAPI\Client
+ * @author      OpenAPI Generator team
+ * @link        https://openapi-generator.tech
+ */
+class OuterObjectWithEnumPropertyTest extends TestCase
+{
+
+    /**
+     * Setup before running any test case
+     */
+    public static function setUpBeforeClass(): void
+    {
+    }
+
+    /**
+     * Setup before running each test case
+     */
+    public function setUp(): void
+    {
+    }
+
+    /**
+     * Clean up after running each test case
+     */
+    public function tearDown(): void
+    {
+    }
+
+    /**
+     * Clean up after running all test cases
+     */
+    public static function tearDownAfterClass(): void
+    {
+    }
+
+    /**
+     * Test "OuterObjectWithEnumProperty"
+     */
+    public function testOuterObjectWithEnumProperty()
+    {
+        // TODO: implement
+        $this->markTestIncomplete('Not implemented');
+    }
+
+    /**
+     * Test attribute "value"
+     */
+    public function testPropertyValue()
+    {
+        // TODO: implement
+        $this->markTestIncomplete('Not implemented');
+    }
+}
diff --git a/samples/client/petstore/ruby-faraday/.openapi-generator/FILES b/samples/client/petstore/ruby-faraday/.openapi-generator/FILES
index e6cc5300c83a795c3957c9c6462a90aabd666f17..e674f45cce917344e5460c1cd52d285bd7f64c81 100644
--- a/samples/client/petstore/ruby-faraday/.openapi-generator/FILES
+++ b/samples/client/petstore/ruby-faraday/.openapi-generator/FILES
@@ -47,6 +47,7 @@ docs/OuterEnum.md
 docs/OuterEnumDefaultValue.md
 docs/OuterEnumInteger.md
 docs/OuterEnumIntegerDefaultValue.md
+docs/OuterObjectWithEnumProperty.md
 docs/Pet.md
 docs/PetApi.md
 docs/ReadOnlyFirst.md
@@ -106,6 +107,7 @@ lib/petstore/models/outer_enum.rb
 lib/petstore/models/outer_enum_default_value.rb
 lib/petstore/models/outer_enum_integer.rb
 lib/petstore/models/outer_enum_integer_default_value.rb
+lib/petstore/models/outer_object_with_enum_property.rb
 lib/petstore/models/pet.rb
 lib/petstore/models/read_only_first.rb
 lib/petstore/models/special_model_name.rb
@@ -115,4 +117,5 @@ lib/petstore/version.rb
 petstore.gemspec
 spec/api_client_spec.rb
 spec/configuration_spec.rb
+spec/models/outer_object_with_enum_property_spec.rb
 spec/spec_helper.rb
diff --git a/samples/client/petstore/ruby-faraday/README.md b/samples/client/petstore/ruby-faraday/README.md
index 35c76f3817e47cc6eb4d2db6ab922c6451e906b1..f7d8816e8ca846ac88549195b5edc441b0f7257d 100644
--- a/samples/client/petstore/ruby-faraday/README.md
+++ b/samples/client/petstore/ruby-faraday/README.md
@@ -83,6 +83,7 @@ Class | Method | HTTP request | Description
 *Petstore::FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | 
 *Petstore::FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | 
 *Petstore::FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | 
+*Petstore::FakeApi* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | 
 *Petstore::FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | 
 *Petstore::FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | 
 *Petstore::FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model
@@ -156,6 +157,7 @@ Class | Method | HTTP request | Description
  - [Petstore::OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md)
  - [Petstore::OuterEnumInteger](docs/OuterEnumInteger.md)
  - [Petstore::OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
+ - [Petstore::OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md)
  - [Petstore::Pet](docs/Pet.md)
  - [Petstore::ReadOnlyFirst](docs/ReadOnlyFirst.md)
  - [Petstore::SpecialModelName](docs/SpecialModelName.md)
diff --git a/samples/client/petstore/ruby-faraday/docs/FakeApi.md b/samples/client/petstore/ruby-faraday/docs/FakeApi.md
index 5a1b97fd7ed2ca7735133428e85eb335cdb57304..ce74242565c91e8f63d979e8afa7de1dda021572 100644
--- a/samples/client/petstore/ruby-faraday/docs/FakeApi.md
+++ b/samples/client/petstore/ruby-faraday/docs/FakeApi.md
@@ -10,6 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
 | [**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite |  |
 | [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |  |
 | [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string |  |
+| [**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int |  |
 | [**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema |  |
 | [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params |  |
 | [**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model |
@@ -414,6 +415,70 @@ No authorization required
 - **Accept**: */*
 
 
+## fake_property_enum_integer_serialize
+
+> <OuterObjectWithEnumProperty> fake_property_enum_integer_serialize(outer_object_with_enum_property)
+
+
+
+Test serialization of enum (int) properties with examples
+
+### Examples
+
+```ruby
+require 'time'
+require 'petstore'
+
+api_instance = Petstore::FakeApi.new
+outer_object_with_enum_property = Petstore::OuterObjectWithEnumProperty.new({value: Petstore::OuterEnumInteger::N0}) # OuterObjectWithEnumProperty | Input enum (int) as post body
+
+begin
+  
+  result = api_instance.fake_property_enum_integer_serialize(outer_object_with_enum_property)
+  p result
+rescue Petstore::ApiError => e
+  puts "Error when calling FakeApi->fake_property_enum_integer_serialize: #{e}"
+end
+```
+
+#### Using the fake_property_enum_integer_serialize_with_http_info variant
+
+This returns an Array which contains the response data, status code and headers.
+
+> <Array(<OuterObjectWithEnumProperty>, Integer, Hash)> fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_property)
+
+```ruby
+begin
+  
+  data, status_code, headers = api_instance.fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_property)
+  p status_code # => 2xx
+  p headers # => { ... }
+  p data # => <OuterObjectWithEnumProperty>
+rescue Petstore::ApiError => e
+  puts "Error when calling FakeApi->fake_property_enum_integer_serialize_with_http_info: #{e}"
+end
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **outer_object_with_enum_property** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md) | Input enum (int) as post body |  |
+
+### Return type
+
+[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: application/json
+- **Accept**: */*
+
+
 ## test_body_with_file_schema
 
 > test_body_with_file_schema(file_schema_test_class)
diff --git a/samples/client/petstore/ruby-faraday/docs/OuterObjectWithEnumProperty.md b/samples/client/petstore/ruby-faraday/docs/OuterObjectWithEnumProperty.md
new file mode 100644
index 0000000000000000000000000000000000000000..dfd9de4596efa21d680ce22302e90caa70e98948
--- /dev/null
+++ b/samples/client/petstore/ruby-faraday/docs/OuterObjectWithEnumProperty.md
@@ -0,0 +1,18 @@
+# Petstore::OuterObjectWithEnumProperty
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **value** | [**OuterEnumInteger**](OuterEnumInteger.md) |  |  |
+
+## Example
+
+```ruby
+require 'petstore'
+
+instance = Petstore::OuterObjectWithEnumProperty.new(
+  value: null
+)
+```
+
diff --git a/samples/client/petstore/ruby-faraday/lib/petstore.rb b/samples/client/petstore/ruby-faraday/lib/petstore.rb
index 3c929b2410b7b0e3a14bf6af2203b5bf8646aa09..96e1b15533ed9eafc1e5b1e8554d36da045c5e49 100644
--- a/samples/client/petstore/ruby-faraday/lib/petstore.rb
+++ b/samples/client/petstore/ruby-faraday/lib/petstore.rb
@@ -55,6 +55,7 @@ require 'petstore/models/outer_enum'
 require 'petstore/models/outer_enum_default_value'
 require 'petstore/models/outer_enum_integer'
 require 'petstore/models/outer_enum_integer_default_value'
+require 'petstore/models/outer_object_with_enum_property'
 require 'petstore/models/pet'
 require 'petstore/models/read_only_first'
 require 'petstore/models/special_model_name'
diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb
index 796798b3dd343b9fcaf39ca1fdc15491e1902508..b5b3cbe7e7c70ccb89a22e59e1ce59801c14995c 100644
--- a/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb
+++ b/samples/client/petstore/ruby-faraday/lib/petstore/api/fake_api.rb
@@ -377,6 +377,69 @@ module Petstore
       return data, status_code, headers
     end
 
+    # Test serialization of enum (int) properties with examples
+    # @param outer_object_with_enum_property [OuterObjectWithEnumProperty] Input enum (int) as post body
+    # @param [Hash] opts the optional parameters
+    # @return [OuterObjectWithEnumProperty]
+    def fake_property_enum_integer_serialize(outer_object_with_enum_property, opts = {})
+      data, _status_code, _headers = fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_property, opts)
+      data
+    end
+
+    # Test serialization of enum (int) properties with examples
+    # @param outer_object_with_enum_property [OuterObjectWithEnumProperty] Input enum (int) as post body
+    # @param [Hash] opts the optional parameters
+    # @return [Array<(OuterObjectWithEnumProperty, Integer, Hash)>] OuterObjectWithEnumProperty data, response status code and response headers
+    def fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_property, opts = {})
+      if @api_client.config.debugging
+        @api_client.config.logger.debug 'Calling API: FakeApi.fake_property_enum_integer_serialize ...'
+      end
+      # verify the required parameter 'outer_object_with_enum_property' is set
+      if @api_client.config.client_side_validation && outer_object_with_enum_property.nil?
+        fail ArgumentError, "Missing the required parameter 'outer_object_with_enum_property' when calling FakeApi.fake_property_enum_integer_serialize"
+      end
+      # resource path
+      local_var_path = '/fake/property/enum-int'
+
+      # query parameters
+      query_params = opts[:query_params] || {}
+
+      # header parameters
+      header_params = opts[:header_params] || {}
+      # HTTP header 'Accept' (if needed)
+      header_params['Accept'] = @api_client.select_header_accept(['*/*'])
+      # HTTP header 'Content-Type'
+      header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
+
+      # form parameters
+      form_params = opts[:form_params] || {}
+
+      # http body (model)
+      post_body = opts[:debug_body] || @api_client.object_to_http_body(outer_object_with_enum_property)
+
+      # return_type
+      return_type = opts[:debug_return_type] || 'OuterObjectWithEnumProperty'
+
+      # auth_names
+      auth_names = opts[:debug_auth_names] || []
+
+      new_options = opts.merge(
+        :operation => :"FakeApi.fake_property_enum_integer_serialize",
+        :header_params => header_params,
+        :query_params => query_params,
+        :form_params => form_params,
+        :body => post_body,
+        :auth_names => auth_names,
+        :return_type => return_type
+      )
+
+      data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
+      if @api_client.config.debugging
+        @api_client.config.logger.debug "API called: FakeApi#fake_property_enum_integer_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+      end
+      return data, status_code, headers
+    end
+
     # For this test, the body for this request much reference a schema named `File`.
     # @param file_schema_test_class [FileSchemaTestClass] 
     # @param [Hash] opts the optional parameters
diff --git a/samples/client/petstore/ruby-faraday/lib/petstore/models/outer_object_with_enum_property.rb b/samples/client/petstore/ruby-faraday/lib/petstore/models/outer_object_with_enum_property.rb
new file mode 100644
index 0000000000000000000000000000000000000000..f130abc9be3551987c64b70b01d79daa0765bba6
--- /dev/null
+++ b/samples/client/petstore/ruby-faraday/lib/petstore/models/outer_object_with_enum_property.rb
@@ -0,0 +1,223 @@
+=begin
+#OpenAPI Petstore
+
+#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+
+The version of the OpenAPI document: 1.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 5.1.0-SNAPSHOT
+
+=end
+
+require 'date'
+require 'time'
+
+module Petstore
+  class OuterObjectWithEnumProperty
+    attr_accessor :value
+
+    # Attribute mapping from ruby-style variable name to JSON key.
+    def self.attribute_map
+      {
+        :'value' => :'value'
+      }
+    end
+
+    # Returns all the JSON keys this model knows about
+    def self.acceptable_attributes
+      attribute_map.values
+    end
+
+    # Attribute type mapping.
+    def self.openapi_types
+      {
+        :'value' => :'OuterEnumInteger'
+      }
+    end
+
+    # List of attributes with nullable: true
+    def self.openapi_nullable
+      Set.new([
+      ])
+    end
+
+    # Initializes the object
+    # @param [Hash] attributes Model attributes in the form of hash
+    def initialize(attributes = {})
+      if (!attributes.is_a?(Hash))
+        fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::OuterObjectWithEnumProperty` initialize method"
+      end
+
+      # check to see if the attribute exists and convert string to symbol for hash key
+      attributes = attributes.each_with_object({}) { |(k, v), h|
+        if (!self.class.attribute_map.key?(k.to_sym))
+          fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::OuterObjectWithEnumProperty`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
+        end
+        h[k.to_sym] = v
+      }
+
+      if attributes.key?(:'value')
+        self.value = attributes[:'value']
+      end
+    end
+
+    # Show invalid properties with the reasons. Usually used together with valid?
+    # @return Array for valid properties with the reasons
+    def list_invalid_properties
+      invalid_properties = Array.new
+      if @value.nil?
+        invalid_properties.push('invalid value for "value", value cannot be nil.')
+      end
+
+      invalid_properties
+    end
+
+    # Check to see if the all the properties in the model are valid
+    # @return true if the model is valid
+    def valid?
+      return false if @value.nil?
+      true
+    end
+
+    # Checks equality by comparing each attribute.
+    # @param [Object] Object to be compared
+    def ==(o)
+      return true if self.equal?(o)
+      self.class == o.class &&
+          value == o.value
+    end
+
+    # @see the `==` method
+    # @param [Object] Object to be compared
+    def eql?(o)
+      self == o
+    end
+
+    # Calculates hash code according to all attributes.
+    # @return [Integer] Hash code
+    def hash
+      [value].hash
+    end
+
+    # Builds the object from hash
+    # @param [Hash] attributes Model attributes in the form of hash
+    # @return [Object] Returns the model itself
+    def self.build_from_hash(attributes)
+      new.build_from_hash(attributes)
+    end
+
+    # Builds the object from hash
+    # @param [Hash] attributes Model attributes in the form of hash
+    # @return [Object] Returns the model itself
+    def build_from_hash(attributes)
+      return nil unless attributes.is_a?(Hash)
+      self.class.openapi_types.each_pair do |key, type|
+        if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
+          self.send("#{key}=", nil)
+        elsif type =~ /\AArray<(.*)>/i
+          # check to ensure the input is an array given that the attribute
+          # is documented as an array but the input is not
+          if attributes[self.class.attribute_map[key]].is_a?(Array)
+            self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
+          end
+        elsif !attributes[self.class.attribute_map[key]].nil?
+          self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
+        end
+      end
+
+      self
+    end
+
+    # Deserializes the data based on type
+    # @param string type Data type
+    # @param string value Value to be deserialized
+    # @return [Object] Deserialized data
+    def _deserialize(type, value)
+      case type.to_sym
+      when :Time
+        Time.parse(value)
+      when :Date
+        Date.parse(value)
+      when :String
+        value.to_s
+      when :Integer
+        value.to_i
+      when :Float
+        value.to_f
+      when :Boolean
+        if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+          true
+        else
+          false
+        end
+      when :Object
+        # generic object (usually a Hash), return directly
+        value
+      when /\AArray<(?<inner_type>.+)>\z/
+        inner_type = Regexp.last_match[:inner_type]
+        value.map { |v| _deserialize(inner_type, v) }
+      when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
+        k_type = Regexp.last_match[:k_type]
+        v_type = Regexp.last_match[:v_type]
+        {}.tap do |hash|
+          value.each do |k, v|
+            hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+          end
+        end
+      else # model
+        # models (e.g. Pet) or oneOf
+        klass = Petstore.const_get(type)
+        klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
+      end
+    end
+
+    # Returns the string representation of the object
+    # @return [String] String presentation of the object
+    def to_s
+      to_hash.to_s
+    end
+
+    # to_body is an alias to to_hash (backward compatibility)
+    # @return [Hash] Returns the object in the form of hash
+    def to_body
+      to_hash
+    end
+
+    # Returns the object in the form of hash
+    # @return [Hash] Returns the object in the form of hash
+    def to_hash
+      hash = {}
+      self.class.attribute_map.each_pair do |attr, param|
+        value = self.send(attr)
+        if value.nil?
+          is_nullable = self.class.openapi_nullable.include?(attr)
+          next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
+        end
+
+        hash[param] = _to_hash(value)
+      end
+      hash
+    end
+
+    # Outputs non-array value in the form of hash
+    # For object, use to_hash. Otherwise, just return the value
+    # @param [Object] value Any valid value
+    # @return [Hash] Returns the value in the form of hash
+    def _to_hash(value)
+      if value.is_a?(Array)
+        value.compact.map { |v| _to_hash(v) }
+      elsif value.is_a?(Hash)
+        {}.tap do |hash|
+          value.each { |k, v| hash[k] = _to_hash(v) }
+        end
+      elsif value.respond_to? :to_hash
+        value.to_hash
+      else
+        value
+      end
+    end
+
+  end
+
+end
diff --git a/samples/client/petstore/ruby-faraday/spec/models/outer_object_with_enum_property_spec.rb b/samples/client/petstore/ruby-faraday/spec/models/outer_object_with_enum_property_spec.rb
new file mode 100644
index 0000000000000000000000000000000000000000..561ef7172b82b850495da6bcbb61fcfce7f63cd3
--- /dev/null
+++ b/samples/client/petstore/ruby-faraday/spec/models/outer_object_with_enum_property_spec.rb
@@ -0,0 +1,34 @@
+=begin
+#OpenAPI Petstore
+
+#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+
+The version of the OpenAPI document: 1.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 5.1.0-SNAPSHOT
+
+=end
+
+require 'spec_helper'
+require 'json'
+require 'date'
+
+# Unit tests for Petstore::OuterObjectWithEnumProperty
+# Automatically generated by openapi-generator (https://openapi-generator.tech)
+# Please update as you see appropriate
+describe Petstore::OuterObjectWithEnumProperty do
+  let(:instance) { Petstore::OuterObjectWithEnumProperty.new }
+
+  describe 'test an instance of OuterObjectWithEnumProperty' do
+    it 'should create an instance of OuterObjectWithEnumProperty' do
+      expect(instance).to be_instance_of(Petstore::OuterObjectWithEnumProperty)
+    end
+  end
+  describe 'test attribute "value"' do
+    it 'should work' do
+      # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+    end
+  end
+
+end
diff --git a/samples/client/petstore/ruby/.openapi-generator/FILES b/samples/client/petstore/ruby/.openapi-generator/FILES
index e6cc5300c83a795c3957c9c6462a90aabd666f17..e674f45cce917344e5460c1cd52d285bd7f64c81 100644
--- a/samples/client/petstore/ruby/.openapi-generator/FILES
+++ b/samples/client/petstore/ruby/.openapi-generator/FILES
@@ -47,6 +47,7 @@ docs/OuterEnum.md
 docs/OuterEnumDefaultValue.md
 docs/OuterEnumInteger.md
 docs/OuterEnumIntegerDefaultValue.md
+docs/OuterObjectWithEnumProperty.md
 docs/Pet.md
 docs/PetApi.md
 docs/ReadOnlyFirst.md
@@ -106,6 +107,7 @@ lib/petstore/models/outer_enum.rb
 lib/petstore/models/outer_enum_default_value.rb
 lib/petstore/models/outer_enum_integer.rb
 lib/petstore/models/outer_enum_integer_default_value.rb
+lib/petstore/models/outer_object_with_enum_property.rb
 lib/petstore/models/pet.rb
 lib/petstore/models/read_only_first.rb
 lib/petstore/models/special_model_name.rb
@@ -115,4 +117,5 @@ lib/petstore/version.rb
 petstore.gemspec
 spec/api_client_spec.rb
 spec/configuration_spec.rb
+spec/models/outer_object_with_enum_property_spec.rb
 spec/spec_helper.rb
diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md
index 35c76f3817e47cc6eb4d2db6ab922c6451e906b1..f7d8816e8ca846ac88549195b5edc441b0f7257d 100644
--- a/samples/client/petstore/ruby/README.md
+++ b/samples/client/petstore/ruby/README.md
@@ -83,6 +83,7 @@ Class | Method | HTTP request | Description
 *Petstore::FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | 
 *Petstore::FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | 
 *Petstore::FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | 
+*Petstore::FakeApi* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | 
 *Petstore::FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | 
 *Petstore::FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | 
 *Petstore::FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model
@@ -156,6 +157,7 @@ Class | Method | HTTP request | Description
  - [Petstore::OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md)
  - [Petstore::OuterEnumInteger](docs/OuterEnumInteger.md)
  - [Petstore::OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
+ - [Petstore::OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md)
  - [Petstore::Pet](docs/Pet.md)
  - [Petstore::ReadOnlyFirst](docs/ReadOnlyFirst.md)
  - [Petstore::SpecialModelName](docs/SpecialModelName.md)
diff --git a/samples/client/petstore/ruby/docs/FakeApi.md b/samples/client/petstore/ruby/docs/FakeApi.md
index 5a1b97fd7ed2ca7735133428e85eb335cdb57304..ce74242565c91e8f63d979e8afa7de1dda021572 100644
--- a/samples/client/petstore/ruby/docs/FakeApi.md
+++ b/samples/client/petstore/ruby/docs/FakeApi.md
@@ -10,6 +10,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2*
 | [**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite |  |
 | [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number |  |
 | [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string |  |
+| [**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int |  |
 | [**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema |  |
 | [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params |  |
 | [**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model |
@@ -414,6 +415,70 @@ No authorization required
 - **Accept**: */*
 
 
+## fake_property_enum_integer_serialize
+
+> <OuterObjectWithEnumProperty> fake_property_enum_integer_serialize(outer_object_with_enum_property)
+
+
+
+Test serialization of enum (int) properties with examples
+
+### Examples
+
+```ruby
+require 'time'
+require 'petstore'
+
+api_instance = Petstore::FakeApi.new
+outer_object_with_enum_property = Petstore::OuterObjectWithEnumProperty.new({value: Petstore::OuterEnumInteger::N0}) # OuterObjectWithEnumProperty | Input enum (int) as post body
+
+begin
+  
+  result = api_instance.fake_property_enum_integer_serialize(outer_object_with_enum_property)
+  p result
+rescue Petstore::ApiError => e
+  puts "Error when calling FakeApi->fake_property_enum_integer_serialize: #{e}"
+end
+```
+
+#### Using the fake_property_enum_integer_serialize_with_http_info variant
+
+This returns an Array which contains the response data, status code and headers.
+
+> <Array(<OuterObjectWithEnumProperty>, Integer, Hash)> fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_property)
+
+```ruby
+begin
+  
+  data, status_code, headers = api_instance.fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_property)
+  p status_code # => 2xx
+  p headers # => { ... }
+  p data # => <OuterObjectWithEnumProperty>
+rescue Petstore::ApiError => e
+  puts "Error when calling FakeApi->fake_property_enum_integer_serialize_with_http_info: #{e}"
+end
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **outer_object_with_enum_property** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md) | Input enum (int) as post body |  |
+
+### Return type
+
+[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: application/json
+- **Accept**: */*
+
+
 ## test_body_with_file_schema
 
 > test_body_with_file_schema(file_schema_test_class)
diff --git a/samples/client/petstore/ruby/docs/OuterObjectWithEnumProperty.md b/samples/client/petstore/ruby/docs/OuterObjectWithEnumProperty.md
new file mode 100644
index 0000000000000000000000000000000000000000..dfd9de4596efa21d680ce22302e90caa70e98948
--- /dev/null
+++ b/samples/client/petstore/ruby/docs/OuterObjectWithEnumProperty.md
@@ -0,0 +1,18 @@
+# Petstore::OuterObjectWithEnumProperty
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **value** | [**OuterEnumInteger**](OuterEnumInteger.md) |  |  |
+
+## Example
+
+```ruby
+require 'petstore'
+
+instance = Petstore::OuterObjectWithEnumProperty.new(
+  value: null
+)
+```
+
diff --git a/samples/client/petstore/ruby/lib/petstore.rb b/samples/client/petstore/ruby/lib/petstore.rb
index 3c929b2410b7b0e3a14bf6af2203b5bf8646aa09..96e1b15533ed9eafc1e5b1e8554d36da045c5e49 100644
--- a/samples/client/petstore/ruby/lib/petstore.rb
+++ b/samples/client/petstore/ruby/lib/petstore.rb
@@ -55,6 +55,7 @@ require 'petstore/models/outer_enum'
 require 'petstore/models/outer_enum_default_value'
 require 'petstore/models/outer_enum_integer'
 require 'petstore/models/outer_enum_integer_default_value'
+require 'petstore/models/outer_object_with_enum_property'
 require 'petstore/models/pet'
 require 'petstore/models/read_only_first'
 require 'petstore/models/special_model_name'
diff --git a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb
index 796798b3dd343b9fcaf39ca1fdc15491e1902508..b5b3cbe7e7c70ccb89a22e59e1ce59801c14995c 100644
--- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb
+++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb
@@ -377,6 +377,69 @@ module Petstore
       return data, status_code, headers
     end
 
+    # Test serialization of enum (int) properties with examples
+    # @param outer_object_with_enum_property [OuterObjectWithEnumProperty] Input enum (int) as post body
+    # @param [Hash] opts the optional parameters
+    # @return [OuterObjectWithEnumProperty]
+    def fake_property_enum_integer_serialize(outer_object_with_enum_property, opts = {})
+      data, _status_code, _headers = fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_property, opts)
+      data
+    end
+
+    # Test serialization of enum (int) properties with examples
+    # @param outer_object_with_enum_property [OuterObjectWithEnumProperty] Input enum (int) as post body
+    # @param [Hash] opts the optional parameters
+    # @return [Array<(OuterObjectWithEnumProperty, Integer, Hash)>] OuterObjectWithEnumProperty data, response status code and response headers
+    def fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_property, opts = {})
+      if @api_client.config.debugging
+        @api_client.config.logger.debug 'Calling API: FakeApi.fake_property_enum_integer_serialize ...'
+      end
+      # verify the required parameter 'outer_object_with_enum_property' is set
+      if @api_client.config.client_side_validation && outer_object_with_enum_property.nil?
+        fail ArgumentError, "Missing the required parameter 'outer_object_with_enum_property' when calling FakeApi.fake_property_enum_integer_serialize"
+      end
+      # resource path
+      local_var_path = '/fake/property/enum-int'
+
+      # query parameters
+      query_params = opts[:query_params] || {}
+
+      # header parameters
+      header_params = opts[:header_params] || {}
+      # HTTP header 'Accept' (if needed)
+      header_params['Accept'] = @api_client.select_header_accept(['*/*'])
+      # HTTP header 'Content-Type'
+      header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
+
+      # form parameters
+      form_params = opts[:form_params] || {}
+
+      # http body (model)
+      post_body = opts[:debug_body] || @api_client.object_to_http_body(outer_object_with_enum_property)
+
+      # return_type
+      return_type = opts[:debug_return_type] || 'OuterObjectWithEnumProperty'
+
+      # auth_names
+      auth_names = opts[:debug_auth_names] || []
+
+      new_options = opts.merge(
+        :operation => :"FakeApi.fake_property_enum_integer_serialize",
+        :header_params => header_params,
+        :query_params => query_params,
+        :form_params => form_params,
+        :body => post_body,
+        :auth_names => auth_names,
+        :return_type => return_type
+      )
+
+      data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
+      if @api_client.config.debugging
+        @api_client.config.logger.debug "API called: FakeApi#fake_property_enum_integer_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+      end
+      return data, status_code, headers
+    end
+
     # For this test, the body for this request much reference a schema named `File`.
     # @param file_schema_test_class [FileSchemaTestClass] 
     # @param [Hash] opts the optional parameters
diff --git a/samples/client/petstore/ruby/lib/petstore/models/outer_object_with_enum_property.rb b/samples/client/petstore/ruby/lib/petstore/models/outer_object_with_enum_property.rb
new file mode 100644
index 0000000000000000000000000000000000000000..f130abc9be3551987c64b70b01d79daa0765bba6
--- /dev/null
+++ b/samples/client/petstore/ruby/lib/petstore/models/outer_object_with_enum_property.rb
@@ -0,0 +1,223 @@
+=begin
+#OpenAPI Petstore
+
+#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+
+The version of the OpenAPI document: 1.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 5.1.0-SNAPSHOT
+
+=end
+
+require 'date'
+require 'time'
+
+module Petstore
+  class OuterObjectWithEnumProperty
+    attr_accessor :value
+
+    # Attribute mapping from ruby-style variable name to JSON key.
+    def self.attribute_map
+      {
+        :'value' => :'value'
+      }
+    end
+
+    # Returns all the JSON keys this model knows about
+    def self.acceptable_attributes
+      attribute_map.values
+    end
+
+    # Attribute type mapping.
+    def self.openapi_types
+      {
+        :'value' => :'OuterEnumInteger'
+      }
+    end
+
+    # List of attributes with nullable: true
+    def self.openapi_nullable
+      Set.new([
+      ])
+    end
+
+    # Initializes the object
+    # @param [Hash] attributes Model attributes in the form of hash
+    def initialize(attributes = {})
+      if (!attributes.is_a?(Hash))
+        fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::OuterObjectWithEnumProperty` initialize method"
+      end
+
+      # check to see if the attribute exists and convert string to symbol for hash key
+      attributes = attributes.each_with_object({}) { |(k, v), h|
+        if (!self.class.attribute_map.key?(k.to_sym))
+          fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::OuterObjectWithEnumProperty`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
+        end
+        h[k.to_sym] = v
+      }
+
+      if attributes.key?(:'value')
+        self.value = attributes[:'value']
+      end
+    end
+
+    # Show invalid properties with the reasons. Usually used together with valid?
+    # @return Array for valid properties with the reasons
+    def list_invalid_properties
+      invalid_properties = Array.new
+      if @value.nil?
+        invalid_properties.push('invalid value for "value", value cannot be nil.')
+      end
+
+      invalid_properties
+    end
+
+    # Check to see if the all the properties in the model are valid
+    # @return true if the model is valid
+    def valid?
+      return false if @value.nil?
+      true
+    end
+
+    # Checks equality by comparing each attribute.
+    # @param [Object] Object to be compared
+    def ==(o)
+      return true if self.equal?(o)
+      self.class == o.class &&
+          value == o.value
+    end
+
+    # @see the `==` method
+    # @param [Object] Object to be compared
+    def eql?(o)
+      self == o
+    end
+
+    # Calculates hash code according to all attributes.
+    # @return [Integer] Hash code
+    def hash
+      [value].hash
+    end
+
+    # Builds the object from hash
+    # @param [Hash] attributes Model attributes in the form of hash
+    # @return [Object] Returns the model itself
+    def self.build_from_hash(attributes)
+      new.build_from_hash(attributes)
+    end
+
+    # Builds the object from hash
+    # @param [Hash] attributes Model attributes in the form of hash
+    # @return [Object] Returns the model itself
+    def build_from_hash(attributes)
+      return nil unless attributes.is_a?(Hash)
+      self.class.openapi_types.each_pair do |key, type|
+        if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
+          self.send("#{key}=", nil)
+        elsif type =~ /\AArray<(.*)>/i
+          # check to ensure the input is an array given that the attribute
+          # is documented as an array but the input is not
+          if attributes[self.class.attribute_map[key]].is_a?(Array)
+            self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
+          end
+        elsif !attributes[self.class.attribute_map[key]].nil?
+          self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
+        end
+      end
+
+      self
+    end
+
+    # Deserializes the data based on type
+    # @param string type Data type
+    # @param string value Value to be deserialized
+    # @return [Object] Deserialized data
+    def _deserialize(type, value)
+      case type.to_sym
+      when :Time
+        Time.parse(value)
+      when :Date
+        Date.parse(value)
+      when :String
+        value.to_s
+      when :Integer
+        value.to_i
+      when :Float
+        value.to_f
+      when :Boolean
+        if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+          true
+        else
+          false
+        end
+      when :Object
+        # generic object (usually a Hash), return directly
+        value
+      when /\AArray<(?<inner_type>.+)>\z/
+        inner_type = Regexp.last_match[:inner_type]
+        value.map { |v| _deserialize(inner_type, v) }
+      when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
+        k_type = Regexp.last_match[:k_type]
+        v_type = Regexp.last_match[:v_type]
+        {}.tap do |hash|
+          value.each do |k, v|
+            hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+          end
+        end
+      else # model
+        # models (e.g. Pet) or oneOf
+        klass = Petstore.const_get(type)
+        klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
+      end
+    end
+
+    # Returns the string representation of the object
+    # @return [String] String presentation of the object
+    def to_s
+      to_hash.to_s
+    end
+
+    # to_body is an alias to to_hash (backward compatibility)
+    # @return [Hash] Returns the object in the form of hash
+    def to_body
+      to_hash
+    end
+
+    # Returns the object in the form of hash
+    # @return [Hash] Returns the object in the form of hash
+    def to_hash
+      hash = {}
+      self.class.attribute_map.each_pair do |attr, param|
+        value = self.send(attr)
+        if value.nil?
+          is_nullable = self.class.openapi_nullable.include?(attr)
+          next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
+        end
+
+        hash[param] = _to_hash(value)
+      end
+      hash
+    end
+
+    # Outputs non-array value in the form of hash
+    # For object, use to_hash. Otherwise, just return the value
+    # @param [Object] value Any valid value
+    # @return [Hash] Returns the value in the form of hash
+    def _to_hash(value)
+      if value.is_a?(Array)
+        value.compact.map { |v| _to_hash(v) }
+      elsif value.is_a?(Hash)
+        {}.tap do |hash|
+          value.each { |k, v| hash[k] = _to_hash(v) }
+        end
+      elsif value.respond_to? :to_hash
+        value.to_hash
+      else
+        value
+      end
+    end
+
+  end
+
+end
diff --git a/samples/client/petstore/ruby/spec/models/outer_object_with_enum_property_spec.rb b/samples/client/petstore/ruby/spec/models/outer_object_with_enum_property_spec.rb
new file mode 100644
index 0000000000000000000000000000000000000000..561ef7172b82b850495da6bcbb61fcfce7f63cd3
--- /dev/null
+++ b/samples/client/petstore/ruby/spec/models/outer_object_with_enum_property_spec.rb
@@ -0,0 +1,34 @@
+=begin
+#OpenAPI Petstore
+
+#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+
+The version of the OpenAPI document: 1.0.0
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 5.1.0-SNAPSHOT
+
+=end
+
+require 'spec_helper'
+require 'json'
+require 'date'
+
+# Unit tests for Petstore::OuterObjectWithEnumProperty
+# Automatically generated by openapi-generator (https://openapi-generator.tech)
+# Please update as you see appropriate
+describe Petstore::OuterObjectWithEnumProperty do
+  let(:instance) { Petstore::OuterObjectWithEnumProperty.new }
+
+  describe 'test an instance of OuterObjectWithEnumProperty' do
+    it 'should create an instance of OuterObjectWithEnumProperty' do
+      expect(instance).to be_instance_of(Petstore::OuterObjectWithEnumProperty)
+    end
+  end
+  describe 'test attribute "value"' do
+    it 'should work' do
+      # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
+    end
+  end
+
+end
diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/.openapi-generator/FILES b/samples/client/petstore/typescript-fetch/builds/default-v3.0/.openapi-generator/FILES
index f59d2325423eafcf73d8948e4159a356c5b1e622..79b62dce8a3384eb1aca141a11d0c57ef88c8a27 100644
--- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/.openapi-generator/FILES
+++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/.openapi-generator/FILES
@@ -44,6 +44,7 @@ models/OuterEnum.ts
 models/OuterEnumDefaultValue.ts
 models/OuterEnumInteger.ts
 models/OuterEnumIntegerDefaultValue.ts
+models/OuterObjectWithEnumProperty.ts
 models/Pet.ts
 models/ReadOnlyFirst.ts
 models/Return.ts
diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts
index 2ac64725a384c8ebb479ddc15d588dded4be8156..358d9a5b09bb26108c63433028860e25ce056f2f 100644
--- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts
+++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/apis/FakeApi.ts
@@ -27,6 +27,9 @@ import {
     OuterComposite,
     OuterCompositeFromJSON,
     OuterCompositeToJSON,
+    OuterObjectWithEnumProperty,
+    OuterObjectWithEnumPropertyFromJSON,
+    OuterObjectWithEnumPropertyToJSON,
     Pet,
     PetFromJSON,
     PetToJSON,
@@ -57,6 +60,10 @@ export interface FakeOuterStringSerializeRequest {
     body?: string;
 }
 
+export interface FakePropertyEnumIntegerSerializeRequest {
+    outerObjectWithEnumProperty: OuterObjectWithEnumProperty;
+}
+
 export interface TestBodyWithFileSchemaRequest {
     fileSchemaTestClass: FileSchemaTestClass;
 }
@@ -311,6 +318,39 @@ export class FakeApi extends runtime.BaseAPI {
         return await response.value();
     }
 
+    /**
+     * Test serialization of enum (int) properties with examples
+     */
+    async fakePropertyEnumIntegerSerializeRaw(requestParameters: FakePropertyEnumIntegerSerializeRequest): Promise<runtime.ApiResponse<OuterObjectWithEnumProperty>> {
+        if (requestParameters.outerObjectWithEnumProperty === null || requestParameters.outerObjectWithEnumProperty === undefined) {
+            throw new runtime.RequiredError('outerObjectWithEnumProperty','Required parameter requestParameters.outerObjectWithEnumProperty was null or undefined when calling fakePropertyEnumIntegerSerialize.');
+        }
+
+        const queryParameters: any = {};
+
+        const headerParameters: runtime.HTTPHeaders = {};
+
+        headerParameters['Content-Type'] = 'application/json';
+
+        const response = await this.request({
+            path: `/fake/property/enum-int`,
+            method: 'POST',
+            headers: headerParameters,
+            query: queryParameters,
+            body: OuterObjectWithEnumPropertyToJSON(requestParameters.outerObjectWithEnumProperty),
+        });
+
+        return new runtime.JSONApiResponse(response, (jsonValue) => OuterObjectWithEnumPropertyFromJSON(jsonValue));
+    }
+
+    /**
+     * Test serialization of enum (int) properties with examples
+     */
+    async fakePropertyEnumIntegerSerialize(requestParameters: FakePropertyEnumIntegerSerializeRequest): Promise<OuterObjectWithEnumProperty> {
+        const response = await this.fakePropertyEnumIntegerSerializeRaw(requestParameters);
+        return await response.value();
+    }
+
     /**
      * For this test, the body for this request much reference a schema named `File`.
      */
diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterObjectWithEnumProperty.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterObjectWithEnumProperty.ts
new file mode 100644
index 0000000000000000000000000000000000000000..61d78ab5ff5c7104f47c17d7d32fb05c08d6935e
--- /dev/null
+++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterObjectWithEnumProperty.ts
@@ -0,0 +1,64 @@
+/* tslint:disable */
+/* eslint-disable */
+/**
+ * OpenAPI Petstore
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * 
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+import { exists, mapValues } from '../runtime';
+import {
+    OuterEnumInteger,
+    OuterEnumIntegerFromJSON,
+    OuterEnumIntegerFromJSONTyped,
+    OuterEnumIntegerToJSON,
+} from './';
+
+/**
+ * 
+ * @export
+ * @interface OuterObjectWithEnumProperty
+ */
+export interface OuterObjectWithEnumProperty {
+    /**
+     * 
+     * @type {OuterEnumInteger}
+     * @memberof OuterObjectWithEnumProperty
+     */
+    value: OuterEnumInteger;
+}
+
+export function OuterObjectWithEnumPropertyFromJSON(json: any): OuterObjectWithEnumProperty {
+    return OuterObjectWithEnumPropertyFromJSONTyped(json, false);
+}
+
+export function OuterObjectWithEnumPropertyFromJSONTyped(json: any, ignoreDiscriminator: boolean): OuterObjectWithEnumProperty {
+    if ((json === undefined) || (json === null)) {
+        return json;
+    }
+    return {
+        
+        'value': OuterEnumIntegerFromJSON(json['value']),
+    };
+}
+
+export function OuterObjectWithEnumPropertyToJSON(value?: OuterObjectWithEnumProperty | null): any {
+    if (value === undefined) {
+        return undefined;
+    }
+    if (value === null) {
+        return null;
+    }
+    return {
+        
+        'value': OuterEnumIntegerToJSON(value.value),
+    };
+}
+
+
diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/index.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/index.ts
index 9d4091d7336736edd41c332638f3a0e091f30be8..b1f2e3ff99f9d82057542c7fbcf48179506933db 100644
--- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/index.ts
+++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/index.ts
@@ -35,6 +35,7 @@ export * from './OuterEnum';
 export * from './OuterEnumDefaultValue';
 export * from './OuterEnumInteger';
 export * from './OuterEnumIntegerDefaultValue';
+export * from './OuterObjectWithEnumProperty';
 export * from './Pet';
 export * from './ReadOnlyFirst';
 export * from './Return';
diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/FILES
index a4900515e291babc05abd2a50aedde7eab6ec615..bac744b741c8e5aba326655c546434014557d821 100644
--- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/FILES
+++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/.openapi-generator/FILES
@@ -43,6 +43,7 @@ doc/OuterEnum.md
 doc/OuterEnumDefaultValue.md
 doc/OuterEnumInteger.md
 doc/OuterEnumIntegerDefaultValue.md
+doc/OuterObjectWithEnumProperty.md
 doc/Pet.md
 doc/PetApi.md
 doc/ReadOnlyFirst.md
@@ -102,6 +103,7 @@ lib/model/outer_enum.dart
 lib/model/outer_enum_default_value.dart
 lib/model/outer_enum_integer.dart
 lib/model/outer_enum_integer_default_value.dart
+lib/model/outer_object_with_enum_property.dart
 lib/model/pet.dart
 lib/model/read_only_first.dart
 lib/model/special_model_name.dart
@@ -109,3 +111,4 @@ lib/model/tag.dart
 lib/model/user.dart
 lib/serializers.dart
 pubspec.yaml
+test/outer_object_with_enum_property_test.dart
diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md
index fa9f4d96b1523b5272676c61cf0a38d4f8ee8b59..b22891db2144ef3a2de6cbedd1bd2c4c65c979e3 100644
--- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md
+++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/README.md
@@ -66,6 +66,7 @@ Class | Method | HTTP request | Description
 *FakeApi* | [**fakeOuterCompositeSerialize**](doc//FakeApi.md#fakeoutercompositeserialize) | **post** /fake/outer/composite | 
 *FakeApi* | [**fakeOuterNumberSerialize**](doc//FakeApi.md#fakeouternumberserialize) | **post** /fake/outer/number | 
 *FakeApi* | [**fakeOuterStringSerialize**](doc//FakeApi.md#fakeouterstringserialize) | **post** /fake/outer/string | 
+*FakeApi* | [**fakePropertyEnumIntegerSerialize**](doc//FakeApi.md#fakepropertyenumintegerserialize) | **post** /fake/property/enum-int | 
 *FakeApi* | [**testBodyWithFileSchema**](doc//FakeApi.md#testbodywithfileschema) | **put** /fake/body-with-file-schema | 
 *FakeApi* | [**testBodyWithQueryParams**](doc//FakeApi.md#testbodywithqueryparams) | **put** /fake/body-with-query-params | 
 *FakeApi* | [**testClientModel**](doc//FakeApi.md#testclientmodel) | **patch** /fake | To test \&quot;client\&quot; model
@@ -139,6 +140,7 @@ Class | Method | HTTP request | Description
  - [OuterEnumDefaultValue](doc//OuterEnumDefaultValue.md)
  - [OuterEnumInteger](doc//OuterEnumInteger.md)
  - [OuterEnumIntegerDefaultValue](doc//OuterEnumIntegerDefaultValue.md)
+ - [OuterObjectWithEnumProperty](doc//OuterObjectWithEnumProperty.md)
  - [Pet](doc//Pet.md)
  - [ReadOnlyFirst](doc//ReadOnlyFirst.md)
  - [SpecialModelName](doc//SpecialModelName.md)
diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md
index c40ba1e5c15862e4e62c6b1ef60cf969289dec52..ef42f41081fd248b19493bae2f26b19c4df941d6 100644
--- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md
+++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/FakeApi.md
@@ -15,6 +15,7 @@ Method | HTTP request | Description
 [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **post** /fake/outer/composite | 
 [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **post** /fake/outer/number | 
 [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **post** /fake/outer/string | 
+[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **post** /fake/property/enum-int | 
 [**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **put** /fake/body-with-file-schema | 
 [**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **put** /fake/body-with-query-params | 
 [**testClientModel**](FakeApi.md#testClientModel) | **patch** /fake | To test \&quot;client\&quot; model
@@ -282,6 +283,49 @@ No authorization required
 
 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
 
+# **fakePropertyEnumIntegerSerialize**
+> OuterObjectWithEnumProperty fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty)
+
+
+
+Test serialization of enum (int) properties with examples
+
+### Example 
+```dart
+import 'package:openapi/api.dart';
+
+var api_instance = new FakeApi();
+var outerObjectWithEnumProperty = new OuterObjectWithEnumProperty(); // OuterObjectWithEnumProperty | Input enum (int) as post body
+
+try { 
+    var result = api_instance.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty);
+    print(result);
+} catch (e) {
+    print('Exception when calling FakeApi->fakePropertyEnumIntegerSerialize: $e\n');
+}
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **outerObjectWithEnumProperty** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | 
+
+### Return type
+
+[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: */*
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
 # **testBodyWithFileSchema**
 > testBodyWithFileSchema(fileSchemaTestClass)
 
diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterObjectWithEnumProperty.md b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterObjectWithEnumProperty.md
new file mode 100644
index 0000000000000000000000000000000000000000..eab2ae8f66b43c16e16b7be60338c9368acc17fc
--- /dev/null
+++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/doc/OuterObjectWithEnumProperty.md
@@ -0,0 +1,15 @@
+# openapi.model.OuterObjectWithEnumProperty
+
+## Load the model package
+```dart
+import 'package:openapi/api.dart';
+```
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**value** | [**OuterEnumInteger**](OuterEnumInteger.md) |  | 
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart
index 6f9d4984f8b98564697c69cd130cd5e83bc1aa00..6264437cbab3a0cd4fc16c2a3771e6bc33975000 100644
--- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart
+++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/api/fake_api.dart
@@ -11,6 +11,7 @@ import 'package:built_value/serializer.dart';
 
 import 'package:openapi/model/file_schema_test_class.dart';
 import 'package:openapi/model/outer_composite.dart';
+import 'package:openapi/model/outer_object_with_enum_property.dart';
 import 'package:openapi/model/user.dart';
 import 'package:openapi/model/health_check_result.dart';
 import 'package:openapi/model/pet.dart';
@@ -365,6 +366,66 @@ class FakeApi {
     );
   }
 
+  /// 
+  ///
+  /// Test serialization of enum (int) properties with examples
+  Future<Response<OuterObjectWithEnumProperty>> fakePropertyEnumIntegerSerialize(
+    OuterObjectWithEnumProperty outerObjectWithEnumProperty, { 
+    CancelToken cancelToken,
+    Map<String, dynamic> headers,
+    Map<String, dynamic> extra,
+    ValidateStatus validateStatus,
+    ProgressCallback onSendProgress,
+    ProgressCallback onReceiveProgress,
+  }) async {
+    final _request = RequestOptions(
+      path: r'/fake/property/enum-int',
+      method: 'POST',
+      headers: <String, dynamic>{
+        ...?headers,
+      },
+      extra: <String, dynamic>{
+        'secure': <Map<String, String>>[],
+        ...?extra,
+      },
+      validateStatus: validateStatus,
+      contentType: [
+        'application/json',
+      ].first,
+      cancelToken: cancelToken,
+      onSendProgress: onSendProgress,
+      onReceiveProgress: onReceiveProgress,
+    );
+
+    dynamic _bodyData;
+
+    const _type = FullType(OuterObjectWithEnumProperty);
+    _bodyData = _serializers.serialize(outerObjectWithEnumProperty, specifiedType: _type);
+
+    final _response = await _dio.request<dynamic>(
+      _request.path,
+      data: _bodyData,
+      options: _request,
+    );
+
+    const _responseType = FullType(OuterObjectWithEnumProperty);
+    final _responseData = _serializers.deserialize(
+      _response.data,
+      specifiedType: _responseType,
+    ) as OuterObjectWithEnumProperty;
+
+    return Response<OuterObjectWithEnumProperty>(
+      data: _responseData,
+      headers: _response.headers,
+      isRedirect: _response.isRedirect,
+      request: _response.request,
+      redirects: _response.redirects,
+      statusCode: _response.statusCode,
+      statusMessage: _response.statusMessage,
+      extra: _response.extra,
+    );
+  }
+
   /// 
   ///
   /// For this test, the body for this request much reference a schema named `File`.
diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart
new file mode 100644
index 0000000000000000000000000000000000000000..caf3ce86097ce5fe41d42e87703c07676bd6bd25
--- /dev/null
+++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart
@@ -0,0 +1,68 @@
+//
+// AUTO-GENERATED FILE, DO NOT MODIFY!
+//
+// @dart=2.7
+
+// ignore_for_file: unused_import
+
+import 'package:openapi/model/outer_enum_integer.dart';
+import 'package:built_value/built_value.dart';
+import 'package:built_value/serializer.dart';
+
+part 'outer_object_with_enum_property.g.dart';
+
+abstract class OuterObjectWithEnumProperty implements Built<OuterObjectWithEnumProperty, OuterObjectWithEnumPropertyBuilder> {
+
+    @BuiltValueField(wireName: r'value')
+    OuterEnumInteger get value;
+    // enum valueEnum {  0,  1,  2,  };
+
+    OuterObjectWithEnumProperty._();
+
+    static void _initializeBuilder(OuterObjectWithEnumPropertyBuilder b) => b;
+
+    factory OuterObjectWithEnumProperty([void updates(OuterObjectWithEnumPropertyBuilder b)]) = _$OuterObjectWithEnumProperty;
+
+    @BuiltValueSerializer(custom: true)
+    static Serializer<OuterObjectWithEnumProperty> get serializer => _$OuterObjectWithEnumPropertySerializer();
+}
+
+class _$OuterObjectWithEnumPropertySerializer implements StructuredSerializer<OuterObjectWithEnumProperty> {
+
+    @override
+    final Iterable<Type> types = const [OuterObjectWithEnumProperty, _$OuterObjectWithEnumProperty];
+    @override
+    final String wireName = r'OuterObjectWithEnumProperty';
+
+    @override
+    Iterable<Object> serialize(Serializers serializers, OuterObjectWithEnumProperty object,
+        {FullType specifiedType = FullType.unspecified}) {
+        final result = <Object>[];
+        result
+            ..add(r'value')
+            ..add(serializers.serialize(object.value,
+                specifiedType: const FullType(OuterEnumInteger)));
+        return result;
+    }
+
+    @override
+    OuterObjectWithEnumProperty deserialize(Serializers serializers, Iterable<Object> serialized,
+        {FullType specifiedType = FullType.unspecified}) {
+        final result = OuterObjectWithEnumPropertyBuilder();
+
+        final iterator = serialized.iterator;
+        while (iterator.moveNext()) {
+            final key = iterator.current as String;
+            iterator.moveNext();
+            final dynamic value = iterator.current;
+            switch (key) {
+                case r'value':
+                    result.value = serializers.deserialize(value,
+                        specifiedType: const FullType(OuterEnumInteger)) as OuterEnumInteger;
+                    break;
+            }
+        }
+        return result.build();
+    }
+}
+
diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/serializers.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/serializers.dart
index a484bd35d30de130821a128c5e99b5a7614180b0..dd7f28bd0dbda718eb0de9b1d107ce94c8f024ce 100644
--- a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/serializers.dart
+++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/lib/serializers.dart
@@ -51,6 +51,7 @@ import 'package:openapi/model/outer_enum.dart';
 import 'package:openapi/model/outer_enum_default_value.dart';
 import 'package:openapi/model/outer_enum_integer.dart';
 import 'package:openapi/model/outer_enum_integer_default_value.dart';
+import 'package:openapi/model/outer_object_with_enum_property.dart';
 import 'package:openapi/model/pet.dart';
 import 'package:openapi/model/read_only_first.dart';
 import 'package:openapi/model/special_model_name.dart';
@@ -98,6 +99,7 @@ part 'serializers.g.dart';
   OuterEnumDefaultValue,
   OuterEnumInteger,
   OuterEnumIntegerDefaultValue,
+  OuterObjectWithEnumProperty,
   Pet,
   ReadOnlyFirst,
   SpecialModelName,
diff --git a/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_object_with_enum_property_test.dart b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_object_with_enum_property_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..4b75616d133d7e5ae184a043a644767b70304ed0
--- /dev/null
+++ b/samples/openapi3/client/petstore/dart-dio/petstore_client_lib_fake/test/outer_object_with_enum_property_test.dart
@@ -0,0 +1,18 @@
+import 'package:openapi/model/outer_object_with_enum_property.dart';
+import 'package:test/test.dart';
+
+// tests for OuterObjectWithEnumProperty
+void main() {
+  final instance = OuterObjectWithEnumPropertyBuilder();
+  // TODO add properties to the builder and call build()
+
+  group(OuterObjectWithEnumProperty, () {
+    // OuterEnumInteger value
+    test('to test the property `value`', () async {
+      // TODO
+    });
+
+
+  });
+
+}
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES
index ef5de1dfbd02551a3393fe1a27c0e0528402f542..662b3f9b1be304dde2fb7a2d87582664daf30727 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/.openapi-generator/FILES
@@ -43,6 +43,7 @@ doc/OuterEnum.md
 doc/OuterEnumDefaultValue.md
 doc/OuterEnumInteger.md
 doc/OuterEnumIntegerDefaultValue.md
+doc/OuterObjectWithEnumProperty.md
 doc/Pet.md
 doc/PetApi.md
 doc/ReadOnlyFirst.md
@@ -106,9 +107,11 @@ lib/model/outer_enum.dart
 lib/model/outer_enum_default_value.dart
 lib/model/outer_enum_integer.dart
 lib/model/outer_enum_integer_default_value.dart
+lib/model/outer_object_with_enum_property.dart
 lib/model/pet.dart
 lib/model/read_only_first.dart
 lib/model/special_model_name.dart
 lib/model/tag.dart
 lib/model/user.dart
 pubspec.yaml
+test/outer_object_with_enum_property_test.dart
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md
index 6e050e1ead820f56b571b48436ffcbc4d26d0082..fe39c2f212640df773fb9237300671923bf4ac9e 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/README.md
@@ -66,6 +66,7 @@ Class | Method | HTTP request | Description
 *FakeApi* | [**fakeOuterCompositeSerialize**](doc//FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | 
 *FakeApi* | [**fakeOuterNumberSerialize**](doc//FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | 
 *FakeApi* | [**fakeOuterStringSerialize**](doc//FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | 
+*FakeApi* | [**fakePropertyEnumIntegerSerialize**](doc//FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | 
 *FakeApi* | [**testBodyWithFileSchema**](doc//FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | 
 *FakeApi* | [**testBodyWithQueryParams**](doc//FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | 
 *FakeApi* | [**testClientModel**](doc//FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model
@@ -139,6 +140,7 @@ Class | Method | HTTP request | Description
  - [OuterEnumDefaultValue](doc//OuterEnumDefaultValue.md)
  - [OuterEnumInteger](doc//OuterEnumInteger.md)
  - [OuterEnumIntegerDefaultValue](doc//OuterEnumIntegerDefaultValue.md)
+ - [OuterObjectWithEnumProperty](doc//OuterObjectWithEnumProperty.md)
  - [Pet](doc//Pet.md)
  - [ReadOnlyFirst](doc//ReadOnlyFirst.md)
  - [SpecialModelName](doc//SpecialModelName.md)
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md
index d8dfaf9329cd6fe1f8be559b4ee567d9e28c4ee5..1a42d2f9341ae69d7a6612e4c92acb73d21e2ea9 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/FakeApi.md
@@ -15,6 +15,7 @@ Method | HTTP request | Description
 [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | 
 [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | 
 [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | 
+[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | 
 [**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | 
 [**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | 
 [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model
@@ -279,6 +280,49 @@ No authorization required
 
 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
 
+# **fakePropertyEnumIntegerSerialize**
+> OuterObjectWithEnumProperty fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty)
+
+
+
+Test serialization of enum (int) properties with examples
+
+### Example 
+```dart
+import 'package:openapi/api.dart';
+
+final api_instance = FakeApi();
+final outerObjectWithEnumProperty = OuterObjectWithEnumProperty(); // OuterObjectWithEnumProperty | Input enum (int) as post body
+
+try { 
+    final result = api_instance.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty);
+    print(result);
+} catch (e) {
+    print('Exception when calling FakeApi->fakePropertyEnumIntegerSerialize: $e\n');
+}
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **outerObjectWithEnumProperty** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | 
+
+### Return type
+
+[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: */*
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
 # **testBodyWithFileSchema**
 > testBodyWithFileSchema(fileSchemaTestClass)
 
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterObjectWithEnumProperty.md b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterObjectWithEnumProperty.md
new file mode 100644
index 0000000000000000000000000000000000000000..eab2ae8f66b43c16e16b7be60338c9368acc17fc
--- /dev/null
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/doc/OuterObjectWithEnumProperty.md
@@ -0,0 +1,15 @@
+# openapi.model.OuterObjectWithEnumProperty
+
+## Load the model package
+```dart
+import 'package:openapi/api.dart';
+```
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**value** | [**OuterEnumInteger**](OuterEnumInteger.md) |  | 
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart
index b54bf96e1882395d0e0749db244f14c20f9535b4..d68dcf2e279eb3a8999ea634ca7a84cb31865144 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api.dart
@@ -73,6 +73,7 @@ part 'model/outer_enum.dart';
 part 'model/outer_enum_default_value.dart';
 part 'model/outer_enum_integer.dart';
 part 'model/outer_enum_integer_default_value.dart';
+part 'model/outer_object_with_enum_property.dart';
 part 'model/pet.dart';
 part 'model/read_only_first.dart';
 part 'model/special_model_name.dart';
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart
index e81da089940d61ac5d61d8661e3604704af5787a..f8fc84ca7f554836c1944f3d9a4b5d01edc81d69 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api/fake_api.dart
@@ -421,6 +421,76 @@ class FakeApi {
     return null;
   }
 
+  /// Test serialization of enum (int) properties with examples
+  ///
+  /// Note: This method returns the HTTP [Response].
+  ///
+  /// Parameters:
+  ///
+  /// * [OuterObjectWithEnumProperty] outerObjectWithEnumProperty (required):
+  ///   Input enum (int) as post body
+  Future<Response> fakePropertyEnumIntegerSerializeWithHttpInfo(OuterObjectWithEnumProperty outerObjectWithEnumProperty) async {
+    // Verify required params are set.
+    if (outerObjectWithEnumProperty == null) {
+     throw ApiException(HttpStatus.badRequest, 'Missing required param: outerObjectWithEnumProperty');
+    }
+
+    final path = '/fake/property/enum-int';
+
+    Object postBody = outerObjectWithEnumProperty;
+
+    final queryParams = <QueryParam>[];
+    final headerParams = <String, String>{};
+    final formParams = <String, String>{};
+
+    final contentTypes = <String>['application/json'];
+    final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
+    final authNames = <String>[];
+
+    if (
+      nullableContentType != null &&
+      nullableContentType.toLowerCase().startsWith('multipart/form-data')
+    ) {
+      bool hasFields = false;
+      final mp = MultipartRequest(null, null);
+      if (hasFields) {
+        postBody = mp;
+      }
+    } else {
+    }
+
+    return await apiClient.invokeAPI(
+      path,
+      'POST',
+      queryParams,
+      postBody,
+      headerParams,
+      formParams,
+      nullableContentType,
+      authNames,
+    );
+  }
+
+  /// Test serialization of enum (int) properties with examples
+  ///
+  /// Parameters:
+  ///
+  /// * [OuterObjectWithEnumProperty] outerObjectWithEnumProperty (required):
+  ///   Input enum (int) as post body
+  Future<OuterObjectWithEnumProperty> fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty) async {
+    final response = await fakePropertyEnumIntegerSerializeWithHttpInfo(outerObjectWithEnumProperty);
+    if (response.statusCode >= HttpStatus.badRequest) {
+      throw ApiException(response.statusCode, _decodeBodyBytes(response));
+    }
+    // When a remote server returns no body with a status of 204, we shall not decode it.
+    // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
+    // FormatException when trying to decode an empty string.
+    if (response.body != null && response.statusCode != HttpStatus.noContent) {
+      return apiClient.deserialize(_decodeBodyBytes(response), 'OuterObjectWithEnumProperty') as OuterObjectWithEnumProperty;
+    }
+    return null;
+  }
+
   /// For this test, the body for this request much reference a schema named `File`.
   ///
   /// Note: This method returns the HTTP [Response].
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart
index 864e189b21a473cb227adcc15fd4a9d4c6fdb9fc..6cc6d8150f2651f09f1375197bf68f84062cd5c8 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/api_client.dart
@@ -252,6 +252,8 @@ class ApiClient {
         case 'OuterEnumIntegerDefaultValue':
           return OuterEnumIntegerDefaultValueTypeTransformer().decode(value);
           
+        case 'OuterObjectWithEnumProperty':
+          return OuterObjectWithEnumProperty.fromJson(value);
         case 'Pet':
           return Pet.fromJson(value);
         case 'ReadOnlyFirst':
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart
new file mode 100644
index 0000000000000000000000000000000000000000..4d58d27628443f0a5f06efcb559cfbe8b7ae38d1
--- /dev/null
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/lib/model/outer_object_with_enum_property.dart
@@ -0,0 +1,69 @@
+//
+// AUTO-GENERATED FILE, DO NOT MODIFY!
+//
+// @dart=2.0
+
+// ignore_for_file: unused_element, unused_import
+// ignore_for_file: always_put_required_named_parameters_first
+// ignore_for_file: lines_longer_than_80_chars
+
+part of openapi.api;
+
+class OuterObjectWithEnumProperty {
+  /// Returns a new [OuterObjectWithEnumProperty] instance.
+  OuterObjectWithEnumProperty({
+    @required this.value,
+  });
+
+  OuterEnumInteger value;
+
+  @override
+  bool operator ==(Object other) => identical(this, other) || other is OuterObjectWithEnumProperty &&
+     other.value == value;
+
+  @override
+  int get hashCode =>
+    (value == null ? 0 : value.hashCode);
+
+  @override
+  String toString() => 'OuterObjectWithEnumProperty[value=$value]';
+
+  Map<String, dynamic> toJson() {
+    final json = <String, dynamic>{};
+      json[r'value'] = value;
+    return json;
+  }
+
+  /// Returns a new [OuterObjectWithEnumProperty] instance and imports its values from
+  /// [json] if it's non-null, null if [json] is null.
+  static OuterObjectWithEnumProperty fromJson(Map<String, dynamic> json) => json == null
+    ? null
+    : OuterObjectWithEnumProperty(
+        value: OuterEnumInteger.fromJson(json[r'value']),
+    );
+
+  static List<OuterObjectWithEnumProperty> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
+    json == null || json.isEmpty
+      ? true == emptyIsNull ? null : <OuterObjectWithEnumProperty>[]
+      : json.map((v) => OuterObjectWithEnumProperty.fromJson(v)).toList(growable: true == growable);
+
+  static Map<String, OuterObjectWithEnumProperty> mapFromJson(Map<String, dynamic> json) {
+    final map = <String, OuterObjectWithEnumProperty>{};
+    if (json != null && json.isNotEmpty) {
+      json.forEach((String key, dynamic v) => map[key] = OuterObjectWithEnumProperty.fromJson(v));
+    }
+    return map;
+  }
+
+  // maps a json object with a list of OuterObjectWithEnumProperty-objects as value to a dart map
+  static Map<String, List<OuterObjectWithEnumProperty>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
+    final map = <String, List<OuterObjectWithEnumProperty>>{};
+    if (json != null && json.isNotEmpty) {
+      json.forEach((String key, dynamic v) {
+        map[key] = OuterObjectWithEnumProperty.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
+      });
+    }
+    return map;
+  }
+}
+
diff --git a/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_object_with_enum_property_test.dart b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_object_with_enum_property_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..f7764334ed44d14b714fec24db812d2abf67f722
--- /dev/null
+++ b/samples/openapi3/client/petstore/dart2/petstore_client_lib_fake/test/outer_object_with_enum_property_test.dart
@@ -0,0 +1,17 @@
+import 'package:openapi/api.dart';
+import 'package:test/test.dart';
+
+// tests for OuterObjectWithEnumProperty
+void main() {
+  final instance = OuterObjectWithEnumProperty();
+
+  group('test OuterObjectWithEnumProperty', () {
+    // OuterEnumInteger value
+    test('to test the property `value`', () async {
+      // TODO
+    });
+
+
+  });
+
+}
diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/FILES b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/FILES
index 22ebe91a52048b83c53effe6d301f47940f03322..7176fccc4a39cf7ef59e15790c16ba898f429d24 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/FILES
+++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/.openapi-generator/FILES
@@ -44,6 +44,7 @@ doc/OuterEnum.md
 doc/OuterEnumDefaultValue.md
 doc/OuterEnumInteger.md
 doc/OuterEnumIntegerDefaultValue.md
+doc/OuterObjectWithEnumProperty.md
 doc/Pet.md
 doc/PetApi.md
 doc/ReadOnlyFirst.md
@@ -107,9 +108,11 @@ lib/model/outer_enum.dart
 lib/model/outer_enum_default_value.dart
 lib/model/outer_enum_integer.dart
 lib/model/outer_enum_integer_default_value.dart
+lib/model/outer_object_with_enum_property.dart
 lib/model/pet.dart
 lib/model/read_only_first.dart
 lib/model/special_model_name.dart
 lib/model/tag.dart
 lib/model/user.dart
 pubspec.yaml
+test/outer_object_with_enum_property_test.dart
diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/README.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/README.md
index 6e050e1ead820f56b571b48436ffcbc4d26d0082..fe39c2f212640df773fb9237300671923bf4ac9e 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/README.md
+++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/README.md
@@ -66,6 +66,7 @@ Class | Method | HTTP request | Description
 *FakeApi* | [**fakeOuterCompositeSerialize**](doc//FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | 
 *FakeApi* | [**fakeOuterNumberSerialize**](doc//FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | 
 *FakeApi* | [**fakeOuterStringSerialize**](doc//FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | 
+*FakeApi* | [**fakePropertyEnumIntegerSerialize**](doc//FakeApi.md#fakepropertyenumintegerserialize) | **POST** /fake/property/enum-int | 
 *FakeApi* | [**testBodyWithFileSchema**](doc//FakeApi.md#testbodywithfileschema) | **PUT** /fake/body-with-file-schema | 
 *FakeApi* | [**testBodyWithQueryParams**](doc//FakeApi.md#testbodywithqueryparams) | **PUT** /fake/body-with-query-params | 
 *FakeApi* | [**testClientModel**](doc//FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model
@@ -139,6 +140,7 @@ Class | Method | HTTP request | Description
  - [OuterEnumDefaultValue](doc//OuterEnumDefaultValue.md)
  - [OuterEnumInteger](doc//OuterEnumInteger.md)
  - [OuterEnumIntegerDefaultValue](doc//OuterEnumIntegerDefaultValue.md)
+ - [OuterObjectWithEnumProperty](doc//OuterObjectWithEnumProperty.md)
  - [Pet](doc//Pet.md)
  - [ReadOnlyFirst](doc//ReadOnlyFirst.md)
  - [SpecialModelName](doc//SpecialModelName.md)
diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md
index d8dfaf9329cd6fe1f8be559b4ee567d9e28c4ee5..1a42d2f9341ae69d7a6612e4c92acb73d21e2ea9 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md
+++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/FakeApi.md
@@ -15,6 +15,7 @@ Method | HTTP request | Description
 [**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | 
 [**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | 
 [**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | 
+[**fakePropertyEnumIntegerSerialize**](FakeApi.md#fakePropertyEnumIntegerSerialize) | **POST** /fake/property/enum-int | 
 [**testBodyWithFileSchema**](FakeApi.md#testBodyWithFileSchema) | **PUT** /fake/body-with-file-schema | 
 [**testBodyWithQueryParams**](FakeApi.md#testBodyWithQueryParams) | **PUT** /fake/body-with-query-params | 
 [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model
@@ -279,6 +280,49 @@ No authorization required
 
 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
 
+# **fakePropertyEnumIntegerSerialize**
+> OuterObjectWithEnumProperty fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty)
+
+
+
+Test serialization of enum (int) properties with examples
+
+### Example 
+```dart
+import 'package:openapi/api.dart';
+
+final api_instance = FakeApi();
+final outerObjectWithEnumProperty = OuterObjectWithEnumProperty(); // OuterObjectWithEnumProperty | Input enum (int) as post body
+
+try { 
+    final result = api_instance.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty);
+    print(result);
+} catch (e) {
+    print('Exception when calling FakeApi->fakePropertyEnumIntegerSerialize: $e\n');
+}
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **outerObjectWithEnumProperty** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | 
+
+### Return type
+
+[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: */*
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
 # **testBodyWithFileSchema**
 > testBodyWithFileSchema(fileSchemaTestClass)
 
diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterObjectWithEnumProperty.md b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterObjectWithEnumProperty.md
new file mode 100644
index 0000000000000000000000000000000000000000..eab2ae8f66b43c16e16b7be60338c9368acc17fc
--- /dev/null
+++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/doc/OuterObjectWithEnumProperty.md
@@ -0,0 +1,15 @@
+# openapi.model.OuterObjectWithEnumProperty
+
+## Load the model package
+```dart
+import 'package:openapi/api.dart';
+```
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**value** | [**OuterEnumInteger**](OuterEnumInteger.md) |  | 
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api.dart
index de2aea295d76bc291cf67b824e73f19810e1de28..9fdfdb55fb80a3c10e770ed9eee894e24f0639ab 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api.dart
@@ -74,6 +74,7 @@ part 'model/outer_enum.dart';
 part 'model/outer_enum_default_value.dart';
 part 'model/outer_enum_integer.dart';
 part 'model/outer_enum_integer_default_value.dart';
+part 'model/outer_object_with_enum_property.dart';
 part 'model/pet.dart';
 part 'model/read_only_first.dart';
 part 'model/special_model_name.dart';
diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart
index e81da089940d61ac5d61d8661e3604704af5787a..f8fc84ca7f554836c1944f3d9a4b5d01edc81d69 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api/fake_api.dart
@@ -421,6 +421,76 @@ class FakeApi {
     return null;
   }
 
+  /// Test serialization of enum (int) properties with examples
+  ///
+  /// Note: This method returns the HTTP [Response].
+  ///
+  /// Parameters:
+  ///
+  /// * [OuterObjectWithEnumProperty] outerObjectWithEnumProperty (required):
+  ///   Input enum (int) as post body
+  Future<Response> fakePropertyEnumIntegerSerializeWithHttpInfo(OuterObjectWithEnumProperty outerObjectWithEnumProperty) async {
+    // Verify required params are set.
+    if (outerObjectWithEnumProperty == null) {
+     throw ApiException(HttpStatus.badRequest, 'Missing required param: outerObjectWithEnumProperty');
+    }
+
+    final path = '/fake/property/enum-int';
+
+    Object postBody = outerObjectWithEnumProperty;
+
+    final queryParams = <QueryParam>[];
+    final headerParams = <String, String>{};
+    final formParams = <String, String>{};
+
+    final contentTypes = <String>['application/json'];
+    final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
+    final authNames = <String>[];
+
+    if (
+      nullableContentType != null &&
+      nullableContentType.toLowerCase().startsWith('multipart/form-data')
+    ) {
+      bool hasFields = false;
+      final mp = MultipartRequest(null, null);
+      if (hasFields) {
+        postBody = mp;
+      }
+    } else {
+    }
+
+    return await apiClient.invokeAPI(
+      path,
+      'POST',
+      queryParams,
+      postBody,
+      headerParams,
+      formParams,
+      nullableContentType,
+      authNames,
+    );
+  }
+
+  /// Test serialization of enum (int) properties with examples
+  ///
+  /// Parameters:
+  ///
+  /// * [OuterObjectWithEnumProperty] outerObjectWithEnumProperty (required):
+  ///   Input enum (int) as post body
+  Future<OuterObjectWithEnumProperty> fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty) async {
+    final response = await fakePropertyEnumIntegerSerializeWithHttpInfo(outerObjectWithEnumProperty);
+    if (response.statusCode >= HttpStatus.badRequest) {
+      throw ApiException(response.statusCode, _decodeBodyBytes(response));
+    }
+    // When a remote server returns no body with a status of 204, we shall not decode it.
+    // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
+    // FormatException when trying to decode an empty string.
+    if (response.body != null && response.statusCode != HttpStatus.noContent) {
+      return apiClient.deserialize(_decodeBodyBytes(response), 'OuterObjectWithEnumProperty') as OuterObjectWithEnumProperty;
+    }
+    return null;
+  }
+
   /// For this test, the body for this request much reference a schema named `File`.
   ///
   /// Note: This method returns the HTTP [Response].
diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart
index 435fdfc4b74a7c9e191cd79f88a130c0ff915df7..84a1288bc299f4b87dc5a583ec16562a9deee3c2 100644
--- a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart
+++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/api_client.dart
@@ -252,6 +252,8 @@ class ApiClient {
         case 'OuterEnumIntegerDefaultValue':
           
            return _$enumDecode(_$OuterEnumIntegerDefaultValueEnumMap, value);
+        case 'OuterObjectWithEnumProperty':
+          return OuterObjectWithEnumProperty.fromJson(value);
         case 'Pet':
           return Pet.fromJson(value);
         case 'ReadOnlyFirst':
diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_object_with_enum_property.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_object_with_enum_property.dart
new file mode 100644
index 0000000000000000000000000000000000000000..0857bb708bbee2670f24f85241ea6f678128a32b
--- /dev/null
+++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/lib/model/outer_object_with_enum_property.dart
@@ -0,0 +1,50 @@
+//
+// AUTO-GENERATED FILE, DO NOT MODIFY!
+//
+// @dart=2.0
+
+// ignore_for_file: unused_element, unused_import
+// ignore_for_file: always_put_required_named_parameters_first
+// ignore_for_file: lines_longer_than_80_chars
+
+part of openapi.api;
+
+@JsonSerializable(
+  checked: true,
+  createToJson: true,
+  disallowUnrecognizedKeys: true,
+  explicitToJson: true,
+)
+class OuterObjectWithEnumProperty {
+  /// Returns a new [OuterObjectWithEnumProperty] instance.
+  OuterObjectWithEnumProperty({
+    @required this.value,
+  });
+
+  @JsonKey(
+    nullable: false,
+    name: r'value',
+    required: true,
+  )
+  OuterEnumInteger value;
+
+  @override
+  bool operator ==(Object other) => identical(this, other) || other is OuterObjectWithEnumProperty &&
+     other.value == value;
+
+  @override
+  int get hashCode =>
+    (value == null ? 0 : value.hashCode);
+
+
+  factory OuterObjectWithEnumProperty.fromJson(Map<String, dynamic> json) => _$OuterObjectWithEnumPropertyFromJson(json);
+
+  Map<String, dynamic> toJson() => _$OuterObjectWithEnumPropertyToJson(this);
+
+  @override
+  String toString() {
+    return toJson().toString();
+  }
+
+}
+
diff --git a/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_object_with_enum_property_test.dart b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_object_with_enum_property_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..f7764334ed44d14b714fec24db812d2abf67f722
--- /dev/null
+++ b/samples/openapi3/client/petstore/dart2/petstore_json_serializable_client_lib_fake/test/outer_object_with_enum_property_test.dart
@@ -0,0 +1,17 @@
+import 'package:openapi/api.dart';
+import 'package:test/test.dart';
+
+// tests for OuterObjectWithEnumProperty
+void main() {
+  final instance = OuterObjectWithEnumProperty();
+
+  group('test OuterObjectWithEnumProperty', () {
+    // OuterEnumInteger value
+    test('to test the property `value`', () async {
+      // TODO
+    });
+
+
+  });
+
+}
diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/OuterObjectWithEnumProperty.md b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterObjectWithEnumProperty.md
new file mode 100644
index 0000000000000000000000000000000000000000..04d2981467047c77c9cadeb70530a937c697acb5
--- /dev/null
+++ b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterObjectWithEnumProperty.md
@@ -0,0 +1,51 @@
+# OuterObjectWithEnumProperty
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Value** | [**OuterEnumInteger**](OuterEnumInteger.md) |  | 
+
+## Methods
+
+### NewOuterObjectWithEnumProperty
+
+`func NewOuterObjectWithEnumProperty(value OuterEnumInteger, ) *OuterObjectWithEnumProperty`
+
+NewOuterObjectWithEnumProperty instantiates a new OuterObjectWithEnumProperty object
+This constructor will assign default values to properties that have it defined,
+and makes sure properties required by API are set, but the set of arguments
+will change when the set of required properties is changed
+
+### NewOuterObjectWithEnumPropertyWithDefaults
+
+`func NewOuterObjectWithEnumPropertyWithDefaults() *OuterObjectWithEnumProperty`
+
+NewOuterObjectWithEnumPropertyWithDefaults instantiates a new OuterObjectWithEnumProperty object
+This constructor will only assign default values to properties that have it defined,
+but it doesn't guarantee that properties required by API are set
+
+### GetValue
+
+`func (o *OuterObjectWithEnumProperty) GetValue() OuterEnumInteger`
+
+GetValue returns the Value field if non-nil, zero value otherwise.
+
+### GetValueOk
+
+`func (o *OuterObjectWithEnumProperty) GetValueOk() (*OuterEnumInteger, bool)`
+
+GetValueOk returns a tuple with the Value field if it's non-nil, zero value otherwise
+and a boolean to check if the value has been set.
+
+### SetValue
+
+`func (o *OuterObjectWithEnumProperty) SetValue(v OuterEnumInteger)`
+
+SetValue sets Value field to given value.
+
+
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_outer_object_with_enum_property.go b/samples/openapi3/client/petstore/go/go-petstore/model_outer_object_with_enum_property.go
new file mode 100644
index 0000000000000000000000000000000000000000..ed972e498d2e749d414b0a2f38713537dae13874
--- /dev/null
+++ b/samples/openapi3/client/petstore/go/go-petstore/model_outer_object_with_enum_property.go
@@ -0,0 +1,108 @@
+/*
+ * OpenAPI Petstore
+ *
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * API version: 1.0.0
+ */
+
+// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
+
+package petstore
+
+import (
+	"encoding/json"
+)
+
+// OuterObjectWithEnumProperty struct for OuterObjectWithEnumProperty
+type OuterObjectWithEnumProperty struct {
+	Value OuterEnumInteger `json:"value"`
+}
+
+// NewOuterObjectWithEnumProperty instantiates a new OuterObjectWithEnumProperty object
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed
+func NewOuterObjectWithEnumProperty(value OuterEnumInteger) *OuterObjectWithEnumProperty {
+	this := OuterObjectWithEnumProperty{}
+	this.Value = value
+	return &this
+}
+
+// NewOuterObjectWithEnumPropertyWithDefaults instantiates a new OuterObjectWithEnumProperty object
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set
+func NewOuterObjectWithEnumPropertyWithDefaults() *OuterObjectWithEnumProperty {
+	this := OuterObjectWithEnumProperty{}
+	return &this
+}
+
+// GetValue returns the Value field value
+func (o *OuterObjectWithEnumProperty) GetValue() OuterEnumInteger {
+	if o == nil {
+		var ret OuterEnumInteger
+		return ret
+	}
+
+	return o.Value
+}
+
+// GetValueOk returns a tuple with the Value field value
+// and a boolean to check if the value has been set.
+func (o *OuterObjectWithEnumProperty) GetValueOk() (*OuterEnumInteger, bool) {
+	if o == nil  {
+		return nil, false
+	}
+	return &o.Value, true
+}
+
+// SetValue sets field value
+func (o *OuterObjectWithEnumProperty) SetValue(v OuterEnumInteger) {
+	o.Value = v
+}
+
+func (o OuterObjectWithEnumProperty) MarshalJSON() ([]byte, error) {
+	toSerialize := map[string]interface{}{}
+	if true {
+		toSerialize["value"] = o.Value
+	}
+	return json.Marshal(toSerialize)
+}
+
+type NullableOuterObjectWithEnumProperty struct {
+	value *OuterObjectWithEnumProperty
+	isSet bool
+}
+
+func (v NullableOuterObjectWithEnumProperty) Get() *OuterObjectWithEnumProperty {
+	return v.value
+}
+
+func (v *NullableOuterObjectWithEnumProperty) Set(val *OuterObjectWithEnumProperty) {
+	v.value = val
+	v.isSet = true
+}
+
+func (v NullableOuterObjectWithEnumProperty) IsSet() bool {
+	return v.isSet
+}
+
+func (v *NullableOuterObjectWithEnumProperty) Unset() {
+	v.value = nil
+	v.isSet = false
+}
+
+func NewNullableOuterObjectWithEnumProperty(val *OuterObjectWithEnumProperty) *NullableOuterObjectWithEnumProperty {
+	return &NullableOuterObjectWithEnumProperty{value: val, isSet: true}
+}
+
+func (v NullableOuterObjectWithEnumProperty) MarshalJSON() ([]byte, error) {
+	return json.Marshal(v.value)
+}
+
+func (v *NullableOuterObjectWithEnumProperty) UnmarshalJSON(src []byte) error {
+	v.isSet = true
+	return json.Unmarshal(src, &v.value)
+}
+
+
diff --git a/samples/openapi3/client/petstore/python-legacy/.openapi-generator/FILES b/samples/openapi3/client/petstore/python-legacy/.openapi-generator/FILES
index 50dd7b24b7af41e54be6b1cbfe11eb441ab30391..b3c1a30cae84a8601ba61e716801521310434a3d 100755
--- a/samples/openapi3/client/petstore/python-legacy/.openapi-generator/FILES
+++ b/samples/openapi3/client/petstore/python-legacy/.openapi-generator/FILES
@@ -44,6 +44,7 @@ docs/OuterEnum.md
 docs/OuterEnumDefaultValue.md
 docs/OuterEnumInteger.md
 docs/OuterEnumIntegerDefaultValue.md
+docs/OuterObjectWithEnumProperty.md
 docs/Pet.md
 docs/PetApi.md
 docs/ReadOnlyFirst.md
@@ -104,6 +105,7 @@ petstore_api/models/outer_enum.py
 petstore_api/models/outer_enum_default_value.py
 petstore_api/models/outer_enum_integer.py
 petstore_api/models/outer_enum_integer_default_value.py
+petstore_api/models/outer_object_with_enum_property.py
 petstore_api/models/pet.py
 petstore_api/models/read_only_first.py
 petstore_api/models/special_model_name.py
@@ -115,4 +117,5 @@ setup.cfg
 setup.py
 test-requirements.txt
 test/__init__.py
+test/test_outer_object_with_enum_property.py
 tox.ini
diff --git a/samples/openapi3/client/petstore/python-legacy/README.md b/samples/openapi3/client/petstore/python-legacy/README.md
index 4d8a7194aa89afe78c8691987b4614c6ae3a0863..65ce00102b4c7146b9b70418a5bd6ff2c7370423 100755
--- a/samples/openapi3/client/petstore/python-legacy/README.md
+++ b/samples/openapi3/client/petstore/python-legacy/README.md
@@ -89,6 +89,7 @@ Class | Method | HTTP request | Description
 *FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | 
 *FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | 
 *FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | 
+*FakeApi* | [**fake_property_enum_integer_serialize**](docs/FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | 
 *FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | 
 *FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | 
 *FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model
@@ -162,6 +163,7 @@ Class | Method | HTTP request | Description
  - [OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md)
  - [OuterEnumInteger](docs/OuterEnumInteger.md)
  - [OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
+ - [OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md)
  - [Pet](docs/Pet.md)
  - [ReadOnlyFirst](docs/ReadOnlyFirst.md)
  - [SpecialModelName](docs/SpecialModelName.md)
diff --git a/samples/openapi3/client/petstore/python-legacy/docs/FakeApi.md b/samples/openapi3/client/petstore/python-legacy/docs/FakeApi.md
index 50de8cc758facd565dc6c68e64c343e6327ff2d4..f7bbbecdce6c9ea2b5a6a601dcc212dd47da1135 100755
--- a/samples/openapi3/client/petstore/python-legacy/docs/FakeApi.md
+++ b/samples/openapi3/client/petstore/python-legacy/docs/FakeApi.md
@@ -10,6 +10,7 @@ Method | HTTP request | Description
 [**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | 
 [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | 
 [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | 
+[**fake_property_enum_integer_serialize**](FakeApi.md#fake_property_enum_integer_serialize) | **POST** /fake/property/enum-int | 
 [**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | 
 [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | 
 [**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \&quot;client\&quot; model
@@ -448,6 +449,67 @@ No authorization required
 
 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
 
+# **fake_property_enum_integer_serialize**
+> OuterObjectWithEnumProperty fake_property_enum_integer_serialize(outer_object_with_enum_property)
+
+
+
+Test serialization of enum (int) properties with examples
+
+### Example
+
+```python
+from __future__ import print_function
+import time
+import petstore_api
+from petstore_api.rest import ApiException
+from pprint import pprint
+# Defining the host is optional and defaults to http://petstore.swagger.io:80/v2
+# See configuration.py for a list of all supported configuration parameters.
+configuration = petstore_api.Configuration(
+    host = "http://petstore.swagger.io:80/v2"
+)
+
+
+# Enter a context with an instance of the API client
+with petstore_api.ApiClient() as api_client:
+    # Create an instance of the API class
+    api_instance = petstore_api.FakeApi(api_client)
+    outer_object_with_enum_property = petstore_api.OuterObjectWithEnumProperty() # OuterObjectWithEnumProperty | Input enum (int) as post body
+
+    try:
+        api_response = api_instance.fake_property_enum_integer_serialize(outer_object_with_enum_property)
+        pprint(api_response)
+    except ApiException as e:
+        print("Exception when calling FakeApi->fake_property_enum_integer_serialize: %s\n" % e)
+```
+
+### Parameters
+
+Name | Type | Description  | Notes
+------------- | ------------- | ------------- | -------------
+ **outer_object_with_enum_property** | [**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)| Input enum (int) as post body | 
+
+### Return type
+
+[**OuterObjectWithEnumProperty**](OuterObjectWithEnumProperty.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+ - **Content-Type**: application/json
+ - **Accept**: */*
+
+### HTTP response details
+| Status code | Description | Response headers |
+|-------------|-------------|------------------|
+**200** | Output enum (int) |  -  |
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
 # **test_body_with_file_schema**
 > test_body_with_file_schema(file_schema_test_class)
 
diff --git a/samples/openapi3/client/petstore/python-legacy/docs/OuterObjectWithEnumProperty.md b/samples/openapi3/client/petstore/python-legacy/docs/OuterObjectWithEnumProperty.md
new file mode 100644
index 0000000000000000000000000000000000000000..b6bdd708890d22217eb2f9a6947bf0a3a7e4d722
--- /dev/null
+++ b/samples/openapi3/client/petstore/python-legacy/docs/OuterObjectWithEnumProperty.md
@@ -0,0 +1,10 @@
+# OuterObjectWithEnumProperty
+
+## Properties
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**value** | [**OuterEnumInteger**](OuterEnumInteger.md) |  | 
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/openapi3/client/petstore/python-legacy/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-legacy/petstore_api/__init__.py
index 0625babbb660284fb8cd76eeaafdd45ae9e376f1..adc76de2316f68f98b39a881c3a7ea0710aa7c64 100755
--- a/samples/openapi3/client/petstore/python-legacy/petstore_api/__init__.py
+++ b/samples/openapi3/client/petstore/python-legacy/petstore_api/__init__.py
@@ -73,6 +73,7 @@ from petstore_api.models.outer_enum import OuterEnum
 from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue
 from petstore_api.models.outer_enum_integer import OuterEnumInteger
 from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue
+from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty
 from petstore_api.models.pet import Pet
 from petstore_api.models.read_only_first import ReadOnlyFirst
 from petstore_api.models.special_model_name import SpecialModelName
diff --git a/samples/openapi3/client/petstore/python-legacy/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python-legacy/petstore_api/api/fake_api.py
index a5038873bb40fd0f2073ca90e3c2f56fe2d378c4..d5dd027679eaedff79f62d4844c28742e249d6dc 100755
--- a/samples/openapi3/client/petstore/python-legacy/petstore_api/api/fake_api.py
+++ b/samples/openapi3/client/petstore/python-legacy/petstore_api/api/fake_api.py
@@ -843,6 +843,145 @@ class FakeApi(object):
             collection_formats=collection_formats,
             _request_auth=local_var_params.get('_request_auth'))
 
+    def fake_property_enum_integer_serialize(self, outer_object_with_enum_property, **kwargs):  # noqa: E501
+        """fake_property_enum_integer_serialize  # noqa: E501
+
+        Test serialization of enum (int) properties with examples  # noqa: E501
+        This method makes a synchronous HTTP request by default. To make an
+        asynchronous HTTP request, please pass async_req=True
+
+        >>> thread = api.fake_property_enum_integer_serialize(outer_object_with_enum_property, async_req=True)
+        >>> result = thread.get()
+
+        :param outer_object_with_enum_property: Input enum (int) as post body (required)
+        :type outer_object_with_enum_property: OuterObjectWithEnumProperty
+        :param async_req: Whether to execute the request asynchronously.
+        :type async_req: bool, optional
+        :param _preload_content: if False, the urllib3.HTTPResponse object will
+                                 be returned without reading/decoding response
+                                 data. Default is True.
+        :type _preload_content: bool, optional
+        :param _request_timeout: timeout setting for this request. If one
+                                 number provided, it will be total request
+                                 timeout. It can also be a pair (tuple) of
+                                 (connection, read) timeouts.
+        :return: Returns the result object.
+                 If the method is called asynchronously,
+                 returns the request thread.
+        :rtype: OuterObjectWithEnumProperty
+        """
+        kwargs['_return_http_data_only'] = True
+        return self.fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_property, **kwargs)  # noqa: E501
+
+    def fake_property_enum_integer_serialize_with_http_info(self, outer_object_with_enum_property, **kwargs):  # noqa: E501
+        """fake_property_enum_integer_serialize  # noqa: E501
+
+        Test serialization of enum (int) properties with examples  # noqa: E501
+        This method makes a synchronous HTTP request by default. To make an
+        asynchronous HTTP request, please pass async_req=True
+
+        >>> thread = api.fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_property, async_req=True)
+        >>> result = thread.get()
+
+        :param outer_object_with_enum_property: Input enum (int) as post body (required)
+        :type outer_object_with_enum_property: OuterObjectWithEnumProperty
+        :param async_req: Whether to execute the request asynchronously.
+        :type async_req: bool, optional
+        :param _return_http_data_only: response data without head status code
+                                       and headers
+        :type _return_http_data_only: bool, optional
+        :param _preload_content: if False, the urllib3.HTTPResponse object will
+                                 be returned without reading/decoding response
+                                 data. Default is True.
+        :type _preload_content: bool, optional
+        :param _request_timeout: timeout setting for this request. If one
+                                 number provided, it will be total request
+                                 timeout. It can also be a pair (tuple) of
+                                 (connection, read) timeouts.
+        :param _request_auth: set to override the auth_settings for an a single
+                              request; this effectively ignores the authentication
+                              in the spec for a single request.
+        :type _request_auth: dict, optional
+        :return: Returns the result object.
+                 If the method is called asynchronously,
+                 returns the request thread.
+        :rtype: tuple(OuterObjectWithEnumProperty, status_code(int), headers(HTTPHeaderDict))
+        """
+
+        local_var_params = locals()
+
+        all_params = [
+            'outer_object_with_enum_property'
+        ]
+        all_params.extend(
+            [
+                'async_req',
+                '_return_http_data_only',
+                '_preload_content',
+                '_request_timeout',
+                '_request_auth'
+            ]
+        )
+
+        for key, val in six.iteritems(local_var_params['kwargs']):
+            if key not in all_params:
+                raise ApiTypeError(
+                    "Got an unexpected keyword argument '%s'"
+                    " to method fake_property_enum_integer_serialize" % key
+                )
+            local_var_params[key] = val
+        del local_var_params['kwargs']
+        # verify the required parameter 'outer_object_with_enum_property' is set
+        if self.api_client.client_side_validation and ('outer_object_with_enum_property' not in local_var_params or  # noqa: E501
+                                                        local_var_params['outer_object_with_enum_property'] is None):  # noqa: E501
+            raise ApiValueError("Missing the required parameter `outer_object_with_enum_property` when calling `fake_property_enum_integer_serialize`")  # noqa: E501
+
+        collection_formats = {}
+
+        path_params = {}
+
+        query_params = []
+
+        header_params = {}
+
+        form_params = []
+        local_var_files = {}
+
+        body_params = None
+        if 'outer_object_with_enum_property' in local_var_params:
+            body_params = local_var_params['outer_object_with_enum_property']
+        # HTTP header `Accept`
+        header_params['Accept'] = self.api_client.select_header_accept(
+            ['*/*'])  # noqa: E501
+
+        # HTTP header `Content-Type`
+        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
+            ['application/json'])  # noqa: E501
+
+        # Authentication setting
+        auth_settings = []  # noqa: E501
+        
+        response_types_map = {
+            200: "OuterObjectWithEnumProperty",
+        }
+
+        return self.api_client.call_api(
+            '/fake/property/enum-int', 'POST',
+            path_params,
+            query_params,
+            header_params,
+            body=body_params,
+            post_params=form_params,
+            files=local_var_files,
+            response_types_map=response_types_map,
+            auth_settings=auth_settings,
+            async_req=local_var_params.get('async_req'),
+            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
+            _preload_content=local_var_params.get('_preload_content', True),
+            _request_timeout=local_var_params.get('_request_timeout'),
+            collection_formats=collection_formats,
+            _request_auth=local_var_params.get('_request_auth'))
+
     def test_body_with_file_schema(self, file_schema_test_class, **kwargs):  # noqa: E501
         """test_body_with_file_schema  # noqa: E501
 
diff --git a/samples/openapi3/client/petstore/python-legacy/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python-legacy/petstore_api/models/__init__.py
index d24bf127f02a74b3e33ced0332e9dce8489724c3..7df4fcdfadc1093fd09ce22b358689ee602e7366 100755
--- a/samples/openapi3/client/petstore/python-legacy/petstore_api/models/__init__.py
+++ b/samples/openapi3/client/petstore/python-legacy/petstore_api/models/__init__.py
@@ -52,6 +52,7 @@ from petstore_api.models.outer_enum import OuterEnum
 from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue
 from petstore_api.models.outer_enum_integer import OuterEnumInteger
 from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue
+from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty
 from petstore_api.models.pet import Pet
 from petstore_api.models.read_only_first import ReadOnlyFirst
 from petstore_api.models.special_model_name import SpecialModelName
diff --git a/samples/openapi3/client/petstore/python-legacy/petstore_api/models/outer_object_with_enum_property.py b/samples/openapi3/client/petstore/python-legacy/petstore_api/models/outer_object_with_enum_property.py
new file mode 100644
index 0000000000000000000000000000000000000000..8a50b129a7fba0f28ca727c85142e0aa850022ab
--- /dev/null
+++ b/samples/openapi3/client/petstore/python-legacy/petstore_api/models/outer_object_with_enum_property.py
@@ -0,0 +1,129 @@
+# coding: utf-8
+
+"""
+    OpenAPI Petstore
+
+    This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\  # noqa: E501
+
+    The version of the OpenAPI document: 1.0.0
+    Generated by: https://openapi-generator.tech
+"""
+
+
+import inspect
+import pprint
+import re  # noqa: F401
+import six
+
+from petstore_api.configuration import Configuration
+
+
+class OuterObjectWithEnumProperty(object):
+    """NOTE: This class is auto generated by OpenAPI Generator.
+    Ref: https://openapi-generator.tech
+
+    Do not edit the class manually.
+    """
+
+    """
+    Attributes:
+      openapi_types (dict): The key is attribute name
+                            and the value is attribute type.
+      attribute_map (dict): The key is attribute name
+                            and the value is json key in definition.
+    """
+    openapi_types = {
+        'value': 'OuterEnumInteger'
+    }
+
+    attribute_map = {
+        'value': 'value'
+    }
+
+    def __init__(self, value=None, local_vars_configuration=None):  # noqa: E501
+        """OuterObjectWithEnumProperty - a model defined in OpenAPI"""  # noqa: E501
+        if local_vars_configuration is None:
+            local_vars_configuration = Configuration.get_default_copy()
+        self.local_vars_configuration = local_vars_configuration
+
+        self._value = None
+        self.discriminator = None
+
+        self.value = value
+
+    @property
+    def value(self):
+        """Gets the value of this OuterObjectWithEnumProperty.  # noqa: E501
+
+
+        :return: The value of this OuterObjectWithEnumProperty.  # noqa: E501
+        :rtype: OuterEnumInteger
+        """
+        return self._value
+
+    @value.setter
+    def value(self, value):
+        """Sets the value of this OuterObjectWithEnumProperty.
+
+
+        :param value: The value of this OuterObjectWithEnumProperty.  # noqa: E501
+        :type value: OuterEnumInteger
+        """
+        if self.local_vars_configuration.client_side_validation and value is None:  # noqa: E501
+            raise ValueError("Invalid value for `value`, must not be `None`")  # noqa: E501
+
+        self._value = value
+
+    def to_dict(self, serialize=False):
+        """Returns the model properties as a dict"""
+        result = {}
+
+        def convert(x):
+            if hasattr(x, "to_dict"):
+                args = inspect.getargspec(x.to_dict).args
+                if len(args) == 1:
+                    return x.to_dict()
+                else:
+                    return x.to_dict(serialize)
+            else:
+                return x
+
+        for attr, _ in six.iteritems(self.openapi_types):
+            value = getattr(self, attr)
+            attr = self.attribute_map.get(attr, attr) if serialize else attr
+            if isinstance(value, list):
+                result[attr] = list(map(
+                    lambda x: convert(x),
+                    value
+                ))
+            elif isinstance(value, dict):
+                result[attr] = dict(map(
+                    lambda item: (item[0], convert(item[1])),
+                    value.items()
+                ))
+            else:
+                result[attr] = convert(value)
+
+        return result
+
+    def to_str(self):
+        """Returns the string representation of the model"""
+        return pprint.pformat(self.to_dict())
+
+    def __repr__(self):
+        """For `print` and `pprint`"""
+        return self.to_str()
+
+    def __eq__(self, other):
+        """Returns true if both objects are equal"""
+        if not isinstance(other, OuterObjectWithEnumProperty):
+            return False
+
+        return self.to_dict() == other.to_dict()
+
+    def __ne__(self, other):
+        """Returns true if both objects are not equal"""
+        if not isinstance(other, OuterObjectWithEnumProperty):
+            return True
+
+        return self.to_dict() != other.to_dict()
diff --git a/samples/openapi3/client/petstore/python-legacy/test/test_outer_object_with_enum_property.py b/samples/openapi3/client/petstore/python-legacy/test/test_outer_object_with_enum_property.py
new file mode 100644
index 0000000000000000000000000000000000000000..81fb183aedc99bf728b036225a23abbf702bc2e4
--- /dev/null
+++ b/samples/openapi3/client/petstore/python-legacy/test/test_outer_object_with_enum_property.py
@@ -0,0 +1,52 @@
+# coding: utf-8
+
+"""
+    OpenAPI Petstore
+
+    This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\  # noqa: E501
+
+    The version of the OpenAPI document: 1.0.0
+    Generated by: https://openapi-generator.tech
+"""
+
+
+from __future__ import absolute_import
+
+import unittest
+import datetime
+
+import petstore_api
+from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty  # noqa: E501
+from petstore_api.rest import ApiException
+
+class TestOuterObjectWithEnumProperty(unittest.TestCase):
+    """OuterObjectWithEnumProperty unit test stubs"""
+
+    def setUp(self):
+        pass
+
+    def tearDown(self):
+        pass
+
+    def make_instance(self, include_optional):
+        """Test OuterObjectWithEnumProperty
+            include_option is a boolean, when False only required
+            params are included, when True both required and
+            optional params are included """
+        # model = petstore_api.models.outer_object_with_enum_property.OuterObjectWithEnumProperty()  # noqa: E501
+        if include_optional :
+            return OuterObjectWithEnumProperty(
+                value = 2
+            )
+        else :
+            return OuterObjectWithEnumProperty(
+                value = 2,
+        )
+
+    def testOuterObjectWithEnumProperty(self):
+        """Test OuterObjectWithEnumProperty"""
+        inst_req_only = self.make_instance(include_optional=False)
+        inst_req_and_optional = self.make_instance(include_optional=True)
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/samples/schema/petstore/mysql/.openapi-generator/FILES b/samples/schema/petstore/mysql/.openapi-generator/FILES
index 5902ce6da7ef2661860ca0403b233dcf78b2d91b..7b909264badf87cae319e5228064d4e67d139dc6 100644
--- a/samples/schema/petstore/mysql/.openapi-generator/FILES
+++ b/samples/schema/petstore/mysql/.openapi-generator/FILES
@@ -35,6 +35,7 @@ Model/OuterEnum.sql
 Model/OuterEnumDefaultValue.sql
 Model/OuterEnumInteger.sql
 Model/OuterEnumIntegerDefaultValue.sql
+Model/OuterObjectWithEnumProperty.sql
 Model/Pet.sql
 Model/ReadOnlyFirst.sql
 Model/Return.sql
diff --git a/samples/schema/petstore/mysql/Model/OuterObjectWithEnumProperty.sql b/samples/schema/petstore/mysql/Model/OuterObjectWithEnumProperty.sql
new file mode 100644
index 0000000000000000000000000000000000000000..0c3c627761c34f295e237c2cceef57cf45722745
--- /dev/null
+++ b/samples/schema/petstore/mysql/Model/OuterObjectWithEnumProperty.sql
@@ -0,0 +1,26 @@
+--
+-- OpenAPI Petstore.
+-- Prepared SQL queries for 'OuterObjectWithEnumProperty' definition.
+--
+
+
+--
+-- SELECT template for table `OuterObjectWithEnumProperty`
+--
+SELECT `value` FROM `OuterObjectWithEnumProperty` WHERE 1;
+
+--
+-- INSERT template for table `OuterObjectWithEnumProperty`
+--
+INSERT INTO `OuterObjectWithEnumProperty`(`value`) VALUES (?);
+
+--
+-- UPDATE template for table `OuterObjectWithEnumProperty`
+--
+UPDATE `OuterObjectWithEnumProperty` SET `value` = ? WHERE 1;
+
+--
+-- DELETE template for table `OuterObjectWithEnumProperty`
+--
+DELETE FROM `OuterObjectWithEnumProperty` WHERE 0;
+
diff --git a/samples/schema/petstore/mysql/mysql_schema.sql b/samples/schema/petstore/mysql/mysql_schema.sql
index e2cb414ed44d9c6e6298472d92c60599c82da6bf..91c69dcfcf0cdc89fb864c87089badc23842ebe9 100644
--- a/samples/schema/petstore/mysql/mysql_schema.sql
+++ b/samples/schema/petstore/mysql/mysql_schema.sql
@@ -334,6 +334,14 @@ CREATE TABLE IF NOT EXISTS `OuterComposite` (
   `my_boolean` TINYINT(1) DEFAULT NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
+--
+-- Table structure for table `OuterObjectWithEnumProperty` generated from model 'OuterObjectWithEnumProperty'
+--
+
+CREATE TABLE IF NOT EXISTS `OuterObjectWithEnumProperty` (
+  `value` TEXT NOT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
 --
 -- Table structure for table `Pet` generated from model 'Pet'
 --
diff --git a/samples/server/petstore/jaxrs-jersey/.openapi-generator/FILES b/samples/server/petstore/jaxrs-jersey/.openapi-generator/FILES
index 980f24f906764615af8d1b7e76eefff1eae97f0b..46fbadf7e596a963ae836e0d174b4fa0c93a8044 100644
--- a/samples/server/petstore/jaxrs-jersey/.openapi-generator/FILES
+++ b/samples/server/petstore/jaxrs-jersey/.openapi-generator/FILES
@@ -57,6 +57,7 @@ src/gen/java/org/openapitools/model/OuterEnum.java
 src/gen/java/org/openapitools/model/OuterEnumDefaultValue.java
 src/gen/java/org/openapitools/model/OuterEnumInteger.java
 src/gen/java/org/openapitools/model/OuterEnumIntegerDefaultValue.java
+src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java
 src/gen/java/org/openapitools/model/Pet.java
 src/gen/java/org/openapitools/model/ReadOnlyFirst.java
 src/gen/java/org/openapitools/model/SpecialModelName.java
diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java
index 3ce42cd81fb58b8d437fdf909c391b43217c364d..08171d2547d51000d89a84c5e3fe1e9af4e18a8f 100644
--- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java
+++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApi.java
@@ -16,6 +16,7 @@ import org.openapitools.model.HealthCheckResult;
 import java.util.Map;
 import org.openapitools.model.ModelApiResponse;
 import org.openapitools.model.OuterComposite;
+import org.openapitools.model.OuterObjectWithEnumProperty;
 import org.openapitools.model.Pet;
 import org.openapitools.model.User;
 
@@ -139,6 +140,18 @@ public class FakeApi  {
     throws NotFoundException {
         return delegate.fakeOuterStringSerialize(body, securityContext);
     }
+    @POST
+    @Path("/property/enum-int")
+    @Consumes({ "application/json" })
+    @Produces({ "*/*" })
+    @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of enum (int) properties with examples", response = OuterObjectWithEnumProperty.class, tags={ "fake", })
+    @io.swagger.annotations.ApiResponses(value = {
+        @io.swagger.annotations.ApiResponse(code = 200, message = "Output enum (int)", response = OuterObjectWithEnumProperty.class)
+    })
+    public Response fakePropertyEnumIntegerSerialize(@ApiParam(value = "Input enum (int) as post body", required = true) @NotNull @Valid  OuterObjectWithEnumProperty outerObjectWithEnumProperty,@Context SecurityContext securityContext)
+    throws NotFoundException {
+        return delegate.fakePropertyEnumIntegerSerialize(outerObjectWithEnumProperty, securityContext);
+    }
     @PUT
     @Path("/body-with-file-schema")
     @Consumes({ "application/json" })
diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java
index 63068f1fcba0b6fff379928e5650f3fa2481b8be..60685a8f5ff4bf760dbd204e808dc270ccf1e58a 100644
--- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java
+++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/FakeApiService.java
@@ -14,6 +14,7 @@ import org.openapitools.model.HealthCheckResult;
 import java.util.Map;
 import org.openapitools.model.ModelApiResponse;
 import org.openapitools.model.OuterComposite;
+import org.openapitools.model.OuterObjectWithEnumProperty;
 import org.openapitools.model.Pet;
 import org.openapitools.model.User;
 
@@ -33,6 +34,7 @@ public abstract class FakeApiService {
     public abstract Response fakeOuterCompositeSerialize(OuterComposite outerComposite,SecurityContext securityContext) throws NotFoundException;
     public abstract Response fakeOuterNumberSerialize(BigDecimal body,SecurityContext securityContext) throws NotFoundException;
     public abstract Response fakeOuterStringSerialize(String body,SecurityContext securityContext) throws NotFoundException;
+    public abstract Response fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty,SecurityContext securityContext) throws NotFoundException;
     public abstract Response testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass,SecurityContext securityContext) throws NotFoundException;
     public abstract Response testBodyWithQueryParams( @NotNull String query,User user,SecurityContext securityContext) throws NotFoundException;
     public abstract Response testClientModel(Client client,SecurityContext securityContext) throws NotFoundException;
diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java
new file mode 100644
index 0000000000000000000000000000000000000000..55890a0c6ee15513300df1e756de8a9188615c43
--- /dev/null
+++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/OuterObjectWithEnumProperty.java
@@ -0,0 +1,98 @@
+/*
+ * OpenAPI Petstore
+ * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * 
+ *
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+
+package org.openapitools.model;
+
+import java.util.Objects;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import org.openapitools.model.OuterEnumInteger;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import javax.validation.constraints.*;
+import javax.validation.Valid;
+
+/**
+ * OuterObjectWithEnumProperty
+ */
+@JsonPropertyOrder({
+  OuterObjectWithEnumProperty.JSON_PROPERTY_VALUE
+})
+@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen")
+public class OuterObjectWithEnumProperty   {
+  public static final String JSON_PROPERTY_VALUE = "value";
+  @JsonProperty(JSON_PROPERTY_VALUE)
+  private OuterEnumInteger value;
+
+  public OuterObjectWithEnumProperty value(OuterEnumInteger value) {
+    this.value = value;
+    return this;
+  }
+
+  /**
+   * Get value
+   * @return value
+   **/
+  @JsonProperty("value")
+  @ApiModelProperty(required = true, value = "")
+  @NotNull @Valid 
+  public OuterEnumInteger getValue() {
+    return value;
+  }
+
+  public void setValue(OuterEnumInteger value) {
+    this.value = value;
+  }
+
+
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+    if (o == null || getClass() != o.getClass()) {
+      return false;
+    }
+    OuterObjectWithEnumProperty outerObjectWithEnumProperty = (OuterObjectWithEnumProperty) o;
+    return Objects.equals(this.value, outerObjectWithEnumProperty.value);
+  }
+
+  @Override
+  public int hashCode() {
+    return Objects.hash(value);
+  }
+
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder();
+    sb.append("class OuterObjectWithEnumProperty {\n");
+    
+    sb.append("    value: ").append(toIndentedString(value)).append("\n");
+    sb.append("}");
+    return sb.toString();
+  }
+
+  /**
+   * Convert the given object to string with each line indented by 4 spaces
+   * (except the first line).
+   */
+  private String toIndentedString(Object o) {
+    if (o == null) {
+      return "null";
+    }
+    return o.toString().replace("\n", "\n    ");
+  }
+}
+
diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java
index 0a6baad8adebf5638f4c25fca0386ac2a0af54db..10c9235fe62831ffea606e39cc1d9b053561372d 100644
--- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java
+++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/FakeApiServiceImpl.java
@@ -12,6 +12,7 @@ import org.openapitools.model.HealthCheckResult;
 import java.util.Map;
 import org.openapitools.model.ModelApiResponse;
 import org.openapitools.model.OuterComposite;
+import org.openapitools.model.OuterObjectWithEnumProperty;
 import org.openapitools.model.Pet;
 import org.openapitools.model.User;
 
@@ -58,6 +59,11 @@ public class FakeApiServiceImpl extends FakeApiService {
         return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
     }
     @Override
+    public Response fakePropertyEnumIntegerSerialize(OuterObjectWithEnumProperty outerObjectWithEnumProperty, SecurityContext securityContext) throws NotFoundException {
+        // do some magic!
+        return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
+    }
+    @Override
     public Response testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass, SecurityContext securityContext) throws NotFoundException {
         // do some magic!
         return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
diff --git a/samples/server/petstore/php-laravel/.openapi-generator/FILES b/samples/server/petstore/php-laravel/.openapi-generator/FILES
index 603506bb91129b935d75aa847572b741a783bd8d..0d54ad9ead609e35a2c699c0fec3c420bd9d0d73 100644
--- a/samples/server/petstore/php-laravel/.openapi-generator/FILES
+++ b/samples/server/petstore/php-laravel/.openapi-generator/FILES
@@ -60,6 +60,7 @@ lib/app/Models/OuterEnum.php
 lib/app/Models/OuterEnumDefaultValue.php
 lib/app/Models/OuterEnumInteger.php
 lib/app/Models/OuterEnumIntegerDefaultValue.php
+lib/app/Models/OuterObjectWithEnumProperty.php
 lib/app/Models/Pet.php
 lib/app/Models/ReadOnlyFirst.php
 lib/app/Models/SpecialModelName.php
diff --git a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeController.php b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeController.php
index 8029bd4ad98d010209f236bf45b281cc5351ace9..cb3da629aaa563726f82748942b455aa04340de6 100644
--- a/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeController.php
+++ b/samples/server/petstore/php-laravel/lib/app/Http/Controllers/FakeController.php
@@ -465,6 +465,30 @@ class FakeController extends Controller
 
         return response('How about implementing fakeOuterStringSerialize as a post method ?');
     }
+    /**
+     * Operation fakePropertyEnumIntegerSerialize
+     *
+     * .
+     *
+     *
+     * @return Http response
+     */
+    public function fakePropertyEnumIntegerSerialize()
+    {
+        $input = Request::all();
+
+        //path params validation
+
+
+        //not path params validation
+        if (!isset($input['outerObjectWithEnumProperty'])) {
+            throw new \InvalidArgumentException('Missing the required parameter $outerObjectWithEnumProperty when calling fakePropertyEnumIntegerSerialize');
+        }
+        $outerObjectWithEnumProperty = $input['outerObjectWithEnumProperty'];
+
+
+        return response('How about implementing fakePropertyEnumIntegerSerialize as a post method ?');
+    }
     /**
      * Operation testQueryParameterCollectionFormat
      *
diff --git a/samples/server/petstore/php-laravel/lib/app/Models/OuterObjectWithEnumProperty.php b/samples/server/petstore/php-laravel/lib/app/Models/OuterObjectWithEnumProperty.php
new file mode 100644
index 0000000000000000000000000000000000000000..b2bd8d779644e025a3b00a03993b847287b995ff
--- /dev/null
+++ b/samples/server/petstore/php-laravel/lib/app/Models/OuterObjectWithEnumProperty.php
@@ -0,0 +1,15 @@
+<?php
+/**
+ * OuterObjectWithEnumProperty
+ */
+namespace app\Models;
+
+/**
+ * OuterObjectWithEnumProperty
+ */
+class OuterObjectWithEnumProperty {
+
+    /** @var \app\Models\OuterEnumInteger $value */
+    private $value;
+
+}
diff --git a/samples/server/petstore/php-laravel/lib/routes/api.php b/samples/server/petstore/php-laravel/lib/routes/api.php
index a0ef076e3f9ce7ff175c4096bb36fdacedf72b32..856cc66810a138f997b7dabcf09773db922ad032 100644
--- a/samples/server/petstore/php-laravel/lib/routes/api.php
+++ b/samples/server/petstore/php-laravel/lib/routes/api.php
@@ -133,6 +133,13 @@ Route::post('/v2/fake/outer/number', 'FakeController@fakeOuterNumberSerialize');
  * Output-Formats: [*_/_*]
  */
 Route::post('/v2/fake/outer/string', 'FakeController@fakeOuterStringSerialize');
+/**
+ * post fakePropertyEnumIntegerSerialize
+ * Summary: 
+ * Notes: Test serialization of enum (int) properties with examples
+ * Output-Formats: [*_/_*]
+ */
+Route::post('/v2/fake/property/enum-int', 'FakeController@fakePropertyEnumIntegerSerialize');
 /**
  * put testQueryParameterCollectionFormat
  * Summary: 
diff --git a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/FakeApi.php b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/FakeApi.php
index 53495aa6d10ecc71d5cada0f18c21974309e5bb0..86e5ae7356fef7221fca1a19e3b87b0d92301613 100644
--- a/samples/server/petstore/php-lumen/lib/app/Http/Controllers/FakeApi.php
+++ b/samples/server/petstore/php-lumen/lib/app/Http/Controllers/FakeApi.php
@@ -461,6 +461,30 @@ class FakeApi extends Controller
 
         return response('How about implementing fakeOuterStringSerialize as a post method ?');
     }
+    /**
+     * Operation fakePropertyEnumIntegerSerialize
+     *
+     * .
+     *
+     *
+     * @return Http response
+     */
+    public function fakePropertyEnumIntegerSerialize()
+    {
+        $input = Request::all();
+
+        //path params validation
+
+
+        //not path params validation
+        if (!isset($input['outer_object_with_enum_property'])) {
+            throw new \InvalidArgumentException('Missing the required parameter $outer_object_with_enum_property when calling fakePropertyEnumIntegerSerialize');
+        }
+        $outer_object_with_enum_property = $input['outer_object_with_enum_property'];
+
+
+        return response('How about implementing fakePropertyEnumIntegerSerialize as a post method ?');
+    }
     /**
      * Operation testQueryParameterCollectionFormat
      *
diff --git a/samples/server/petstore/php-lumen/lib/routes/web.php b/samples/server/petstore/php-lumen/lib/routes/web.php
index 5f08105d2f29fa1737ba16a2cfe486759bfcc9fd..f159b8da780b8146cf6556e5f46d1e2f8aebc778 100644
--- a/samples/server/petstore/php-lumen/lib/routes/web.php
+++ b/samples/server/petstore/php-lumen/lib/routes/web.php
@@ -149,6 +149,13 @@ $router->post('/v2/fake/outer/number', 'FakeApi@fakeOuterNumberSerialize');
  */
 $router->post('/v2/fake/outer/string', 'FakeApi@fakeOuterStringSerialize');
 
+/**
+ * post fakePropertyEnumIntegerSerialize
+ * Summary: 
+ * Notes: Test serialization of enum (int) properties with examples
+ */
+$router->post('/v2/fake/property/enum-int', 'FakeApi@fakePropertyEnumIntegerSerialize');
+
 /**
  * put testQueryParameterCollectionFormat
  * Summary: