diff --git a/bin/configs/kotlin-gson.yaml b/bin/configs/kotlin-gson.yaml
index e4e55689509d..8e6eccccbd49 100644
--- a/bin/configs/kotlin-gson.yaml
+++ b/bin/configs/kotlin-gson.yaml
@@ -1,7 +1,8 @@
generatorName: kotlin
outputDir: samples/client/petstore/kotlin-gson
-inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
+inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/kotlin-client
additionalProperties:
serializationLibrary: gson
artifactId: kotlin-petstore-gson
+ companionObject: true
diff --git a/docs/generators/kotlin-spring.md b/docs/generators/kotlin-spring.md
index a169cb0b7e83..ab39d3a2942a 100644
--- a/docs/generators/kotlin-spring.md
+++ b/docs/generators/kotlin-spring.md
@@ -27,6 +27,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|autoXSpringPaginated|Automatically add x-spring-paginated to operations that have 'page', 'size', and 'sort' query parameters. When enabled, operations with all three parameters will have Pageable support automatically applied. Operations with x-spring-paginated explicitly set to false will not be auto-detected.| |false|
|basePackage|base package (invokerPackage) for generated code| |org.openapitools|
|beanQualifiers|Whether to add fully-qualifier class names as bean qualifiers in @Component and @RestController annotations. May be used to prevent bean names clash if multiple generated libraries (contexts) added to single project.| |false|
+|companionObject|Whether to generate companion objects in data classes, enabling companion extensions.| |false|
|configPackage|configuration package for generated code| |org.openapitools.configuration|
|declarativeInterfaceReactiveMode|What type of reactive style to use in Spring Http declarative interface|
- **coroutines**
- Use kotlin-idiomatic 'suspend' functions
- **reactor**
- Use reactor return wrappers 'Mono' and 'Flux'
|coroutines|
|delegatePattern|Whether to generate the server files using the delegate pattern| |false|
diff --git a/docs/generators/kotlin.md b/docs/generators/kotlin.md
index 5c1a70330b6e..22b931b9229e 100644
--- a/docs/generators/kotlin.md
+++ b/docs/generators/kotlin.md
@@ -23,6 +23,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactId|Generated artifact id (name of jar).| |kotlin-client|
|artifactVersion|Generated artifact's package version.| |1.0.0|
|collectionType|Option. Collection type to use|- **array**
- kotlin.Array
- **list**
- kotlin.collections.List
|list|
+|companionObject|Whether to generate companion objects in data classes, enabling companion extensions.| |false|
|dateLibrary|Option. Date library to use|- **threetenbp-localdatetime**
- Threetenbp - Backport of JSR310 (jvm only, for legacy app only)
- **kotlinx-datetime**
- kotlinx-datetime (preferred for multiplatform)
- **string**
- String
- **java8-localdatetime**
- Java 8 native JSR310 (jvm only, for legacy app only)
- **java8**
- Java 8 native JSR310 (jvm only, preferred for jdk 1.8+)
- **threetenbp**
- Threetenbp - Backport of JSR310 (jvm only, preferred for jdk < 1.8)
|java8|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |original|
|explicitApi|Generates code with explicit access modifiers to comply with Kotlin Explicit API Mode.| |false|
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java
index e0b51976ce5c..57b5f20dbcd9 100755
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java
@@ -106,6 +106,8 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
public static final String GENERATE_ONEOF_ANYOF_WRAPPERS = "generateOneOfAnyOfWrappers";
+ public static final String COMPANION_OBJECT = "companionObject";
+
protected static final String VENDOR_EXTENSION_BASE_NAME_LITERAL = "x-base-name-literal";
@@ -123,6 +125,7 @@ public class KotlinClientCodegen extends AbstractKotlinCodegen {
@Setter protected boolean mapFileBinaryToByteArray = false;
@Setter protected boolean generateOneOfAnyOfWrappers = true;
@Getter @Setter protected boolean failOnUnknownProperties = false;
+ @Setter protected boolean companionObject = false;
protected String authFolder;
@@ -288,6 +291,8 @@ public KotlinClientCodegen() {
cliOptions.add(CliOption.newBoolean(GENERATE_ONEOF_ANYOF_WRAPPERS, "Generate oneOf, anyOf schemas as wrappers. Only `jvm-retrofit2`(library) with `gson` or `kotlinx_serialization`(serializationLibrary) support this option."));
+ cliOptions.add(CliOption.newBoolean(COMPANION_OBJECT, "Whether to generate companion objects in data classes, enabling companion extensions.", false));
+
CliOption serializationLibraryOpt = new CliOption(CodegenConstants.SERIALIZATION_LIBRARY, SERIALIZATION_LIBRARY_DESC);
cliOptions.add(serializationLibraryOpt.defaultValue(serializationLibrary.name()));
@@ -322,6 +327,10 @@ public boolean getGenerateOneOfAnyOfWrappers() {
return generateOneOfAnyOfWrappers;
}
+ public boolean getCompanionObject() {
+ return companionObject;
+ }
+
public void setGenerateRoomModels(Boolean generateRoomModels) {
this.generateRoomModels = generateRoomModels;
}
@@ -484,6 +493,12 @@ public void processOpts() {
setFailOnUnknownProperties(false);
}
+ if (additionalProperties.containsKey(COMPANION_OBJECT)) {
+ setCompanionObject(convertPropertyToBooleanAndWriteBack(COMPANION_OBJECT));
+ } else {
+ additionalProperties.put(COMPANION_OBJECT, companionObject);
+ }
+
commonSupportingFiles();
switch (getLibrary()) {
@@ -936,7 +951,7 @@ public ModelsMap postProcessModels(ModelsMap objs) {
for (ModelMap mo : objects.getModels()) {
CodegenModel cm = mo.getModel();
- if (getGenerateRoomModels() || getGenerateOneOfAnyOfWrappers()) {
+ if (getGenerateRoomModels() || getGenerateOneOfAnyOfWrappers() || getCompanionObject()) {
cm.vendorExtensions.put("x-has-data-class-body", true);
}
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java
index 269075dc780e..1706b802e1f0 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java
@@ -98,6 +98,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen
public static final String USE_REQUEST_MAPPING_ON_INTERFACE = "useRequestMappingOnInterface";
public static final String AUTO_X_SPRING_PAGINATED = "autoXSpringPaginated";
public static final String USE_SEALED_RESPONSE_INTERFACES = "useSealedResponseInterfaces";
+ public static final String COMPANION_OBJECT = "companionObject";
@Getter
public enum DeclarativeInterfaceReactiveMode {
@@ -163,6 +164,7 @@ public String getDescription() {
@Setter private boolean useResponseEntity = true;
@Setter private boolean autoXSpringPaginated = false;
@Setter private boolean useSealedResponseInterfaces = false;
+ @Setter private boolean companionObject = false;
@Getter @Setter
protected boolean useSpringBoot3 = false;
@@ -265,6 +267,7 @@ public KotlinSpringServerCodegen() {
addOption(SCHEMA_IMPLEMENTS, "A map of single interface or a list of interfaces per schema name that should be implemented (serves similar purpose as `x-kotlin-implements`, but is fully decoupled from the api spec). Example: yaml `schemaImplements: {Pet: com.some.pack.WithId, Category: [com.some.pack.CategoryInterface], Dog: [com.some.pack.Canine, com.some.pack.OtherInterface]}` implements interfaces in schemas `Pet` (interface `com.some.pack.WithId`), `Category` (interface `com.some.pack.CategoryInterface`), `Dog`(interfaces `com.some.pack.Canine`, `com.some.pack.OtherInterface`)", "empty map");
addOption(SCHEMA_IMPLEMENTS_FIELDS, "A map of single field or a list of fields per schema name that should be prepended with `override` (serves similar purpose as `x-kotlin-implements-fields`, but is fully decoupled from the api spec). Example: yaml `schemaImplementsFields: {Pet: id, Category: [name, id], Dog: [bark, breed]}` marks fields to be prepended with `override` in schemas `Pet` (field `id`), `Category` (fields `name`, `id`) and `Dog` (fields `bark`, `breed`)", "empty map");
addSwitch(AUTO_X_SPRING_PAGINATED, "Automatically add x-spring-paginated to operations that have 'page', 'size', and 'sort' query parameters. When enabled, operations with all three parameters will have Pageable support automatically applied. Operations with x-spring-paginated explicitly set to false will not be auto-detected.", autoXSpringPaginated);
+ addSwitch(COMPANION_OBJECT, "Whether to generate companion objects in data classes, enabling companion extensions.", companionObject);
supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application.");
supportedLibraries.put(SPRING_CLOUD_LIBRARY,
"Spring-Cloud-Feign client with Spring-Boot auto-configured settings.");
@@ -512,6 +515,12 @@ public void processOpts() {
}
writePropertyBack(USE_SEALED_RESPONSE_INTERFACES, useSealedResponseInterfaces);
+ if (additionalProperties.containsKey(COMPANION_OBJECT)) {
+ this.setCompanionObject(convertPropertyToBooleanAndWriteBack(COMPANION_OBJECT));
+ } else {
+ additionalProperties.put(COMPANION_OBJECT, companionObject);
+ }
+
additionalProperties.put("springHttpStatus", new SpringHttpStatusLambda());
// Set basePackage from invokerPackage
diff --git a/modules/openapi-generator/src/main/resources/kotlin-client/data_class.mustache b/modules/openapi-generator/src/main/resources/kotlin-client/data_class.mustache
index b9bb49eae25a..28ec1da04089 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-client/data_class.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-client/data_class.mustache
@@ -123,7 +123,8 @@ import {{packageName}}.infrastructure.ITransformForStorage
private const val serialVersionUID: Long = 123
}
{{/serializableModel}}
-{{#discriminator}}{{#vars}}{{#required}}
+{{^serializableModel}}{{^generateRoomModels}}{{^generateOneOfAnyOfWrappers}}{{#companionObject}} {{#nonPublicApi}}internal {{/nonPublicApi}}{{^nonPublicApi}}{{#explicitApi}}public {{/explicitApi}}{{/nonPublicApi}}companion object { }
+{{/companionObject}}{{/generateOneOfAnyOfWrappers}}{{/generateRoomModels}}{{/serializableModel}}{{#discriminator}}{{#vars}}{{#required}}
{{>interface_req_var}}{{/required}}{{^required}}
{{>interface_opt_var}}{{/required}}{{/vars}}{{/discriminator}}
{{#hasEnums}}
diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClass.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClass.mustache
index 4fadc4b89ccb..178487a26e3b 100644
--- a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClass.mustache
+++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClass.mustache
@@ -64,4 +64,5 @@
private const val serialVersionUID: kotlin.Long = 1
}
{{/serializableModel}}
-}
+{{^serializableModel}}{{#companionObject}} companion object { }
+{{/companionObject}}{{/serializableModel}}}
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenModelTest.java
index 023374b9e248..23f98e3c443e 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenModelTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinClientCodegenModelTest.java
@@ -43,6 +43,7 @@
import java.util.Map;
import static org.openapitools.codegen.CodegenConstants.*;
+import static org.openapitools.codegen.languages.KotlinClientCodegen.COMPANION_OBJECT;
import static org.openapitools.codegen.languages.KotlinClientCodegen.GENERATE_ONEOF_ANYOF_WRAPPERS;
@SuppressWarnings("static-method")
@@ -878,6 +879,50 @@ public void emptyModelKotlinxSerializationTest() throws IOException {
TestUtils.assertFileNotContains(modelKt, "data class EmptyModel");
}
+ @Test
+ public void testCompanionObjectAdditionalProperty() {
+ final KotlinClientCodegen codegen = new KotlinClientCodegen();
+
+ // Default case, nothing provided
+ codegen.processOpts();
+
+ ConfigAssert configAssert = new ConfigAssert(codegen.additionalProperties());
+ // Default to false
+ configAssert.assertValue(COMPANION_OBJECT, codegen::getCompanionObject, Boolean.FALSE);
+
+ // Provide true
+ codegen.additionalProperties().put(COMPANION_OBJECT, true);
+ codegen.processOpts();
+
+ // Should be true
+ configAssert.assertValue(COMPANION_OBJECT, codegen::getCompanionObject, Boolean.TRUE);
+
+ // Provide false
+ codegen.additionalProperties().put(COMPANION_OBJECT, false);
+ codegen.processOpts();
+
+ // Should be false
+ configAssert.assertValue(COMPANION_OBJECT, codegen::getCompanionObject, Boolean.FALSE);
+ }
+
+ @Test
+ public void testCompanionObjectGeneratesCompanionInModel() throws IOException {
+ File output = Files.createTempDirectory("test").toFile();
+ output.deleteOnExit();
+
+ final CodegenConfigurator configurator = new CodegenConfigurator()
+ .setGeneratorName("kotlin")
+ .addAdditionalProperty(COMPANION_OBJECT, true)
+ .setInputSpec("src/test/resources/3_0/petstore.yaml")
+ .setOutputDir(output.getAbsolutePath().replace("\\", "/"));
+
+ DefaultGenerator generator = new DefaultGenerator();
+ generator.opts(configurator.toClientOptInput()).generate();
+
+ Path petModel = Paths.get(output.getAbsolutePath() + "/src/main/kotlin/org/openapitools/client/models/Pet.kt");
+ TestUtils.assertFileContains(petModel, "companion object { }");
+ }
+
private static class ModelNameTest {
private final String expectedName;
private final String expectedClassName;
diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java
index 9f59e7f2f967..0bdf7f3f128e 100644
--- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java
+++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java
@@ -4706,6 +4706,35 @@ public void testDeprecatedAnnotationOnController() throws IOException {
"@Deprecated(message=\"Operation is deprecated\") @RequestMapping("
);
}
+
+ @Test
+ public void testCompanionObjectDefaultIsFalse() {
+ final KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen();
+ codegen.processOpts();
+
+ Assert.assertEquals(codegen.additionalProperties().get(COMPANION_OBJECT), false);
+ }
+
+ @Test
+ public void testCompanionObjectGeneratesCompanionInModel() throws IOException {
+ File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
+ output.deleteOnExit();
+ String outputPath = output.getAbsolutePath().replace('\\', '/');
+
+ KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen();
+ codegen.setOutputDir(output.getAbsolutePath());
+ codegen.additionalProperties().put(COMPANION_OBJECT, true);
+
+ new DefaultGenerator().opts(new ClientOptInput()
+ .openAPI(TestUtils.parseSpec("src/test/resources/3_0/petstore.yaml"))
+ .config(codegen))
+ .generate();
+
+ assertFileContains(
+ Paths.get(outputPath + "/src/main/kotlin/org/openapitools/model/Pet.kt"),
+ "companion object { }"
+ );
+ }
}
diff --git a/samples/client/petstore/kotlin-gson/docs/PetApi.md b/samples/client/petstore/kotlin-gson/docs/PetApi.md
index 6856ea516dab..e0bf879c9a65 100644
--- a/samples/client/petstore/kotlin-gson/docs/PetApi.md
+++ b/samples/client/petstore/kotlin-gson/docs/PetApi.md
@@ -16,10 +16,12 @@ All URIs are relative to *http://petstore.swagger.io/v2*
# **addPet**
-> addPet(body)
+> Pet addPet(pet)
Add a new pet to the store
+
+
### Example
```kotlin
// Import classes:
@@ -27,9 +29,10 @@ Add a new pet to the store
//import org.openapitools.client.models.*
val apiInstance = PetApi()
-val body : Pet = // Pet | Pet object that needs to be added to the store
+val pet : Pet = // Pet | Pet object that needs to be added to the store
try {
- apiInstance.addPet(body)
+ val result : Pet = apiInstance.addPet(pet)
+ println(result)
} catch (e: ClientException) {
println("4xx response calling PetApi#addPet")
e.printStackTrace()
@@ -42,11 +45,11 @@ try {
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
-| **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | |
+| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | |
### Return type
-null (empty response body)
+[**Pet**](Pet.md)
### Authorization
@@ -57,7 +60,7 @@ Configure petstore_auth:
### HTTP request headers
- **Content-Type**: application/json
- - **Accept**: Not defined
+ - **Accept**: application/json
# **deletePet**
@@ -65,6 +68,8 @@ Configure petstore_auth:
Deletes a pet
+
+
### Example
```kotlin
// Import classes:
@@ -253,10 +258,12 @@ Configure api_key:
# **updatePet**
-> updatePet(body)
+> Pet updatePet(pet)
Update an existing pet
+
+
### Example
```kotlin
// Import classes:
@@ -264,9 +271,10 @@ Update an existing pet
//import org.openapitools.client.models.*
val apiInstance = PetApi()
-val body : Pet = // Pet | Pet object that needs to be added to the store
+val pet : Pet = // Pet | Pet object that needs to be added to the store
try {
- apiInstance.updatePet(body)
+ val result : Pet = apiInstance.updatePet(pet)
+ println(result)
} catch (e: ClientException) {
println("4xx response calling PetApi#updatePet")
e.printStackTrace()
@@ -279,11 +287,11 @@ try {
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
-| **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | |
+| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | |
### Return type
-null (empty response body)
+[**Pet**](Pet.md)
### Authorization
@@ -294,7 +302,7 @@ Configure petstore_auth:
### HTTP request headers
- **Content-Type**: application/json
- - **Accept**: Not defined
+ - **Accept**: application/json
# **updatePetWithForm**
@@ -302,6 +310,8 @@ Configure petstore_auth:
Updates a pet in the store with form data
+
+
### Example
```kotlin
// Import classes:
@@ -351,6 +361,8 @@ Configure petstore_auth:
uploads an image
+
+
### Example
```kotlin
// Import classes:
diff --git a/samples/client/petstore/kotlin-gson/docs/StoreApi.md b/samples/client/petstore/kotlin-gson/docs/StoreApi.md
index 53ff17b16676..bfbf6c75d797 100644
--- a/samples/client/petstore/kotlin-gson/docs/StoreApi.md
+++ b/samples/client/petstore/kotlin-gson/docs/StoreApi.md
@@ -149,10 +149,12 @@ No authorization required
# **placeOrder**
-> Order placeOrder(body)
+> Order placeOrder(order)
Place an order for a pet
+
+
### Example
```kotlin
// Import classes:
@@ -160,9 +162,9 @@ Place an order for a pet
//import org.openapitools.client.models.*
val apiInstance = StoreApi()
-val body : Order = // Order | order placed for purchasing the pet
+val order : Order = // Order | order placed for purchasing the pet
try {
- val result : Order = apiInstance.placeOrder(body)
+ val result : Order = apiInstance.placeOrder(order)
println(result)
} catch (e: ClientException) {
println("4xx response calling StoreApi#placeOrder")
@@ -176,7 +178,7 @@ try {
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
-| **body** | [**Order**](Order.md)| order placed for purchasing the pet | |
+| **order** | [**Order**](Order.md)| order placed for purchasing the pet | |
### Return type
@@ -188,6 +190,6 @@ No authorization required
### HTTP request headers
- - **Content-Type**: Not defined
+ - **Content-Type**: application/json
- **Accept**: application/json
diff --git a/samples/client/petstore/kotlin-gson/docs/UserApi.md b/samples/client/petstore/kotlin-gson/docs/UserApi.md
index 82c8d6060276..fb5bfa6c7a44 100644
--- a/samples/client/petstore/kotlin-gson/docs/UserApi.md
+++ b/samples/client/petstore/kotlin-gson/docs/UserApi.md
@@ -16,7 +16,7 @@ All URIs are relative to *http://petstore.swagger.io/v2*
# **createUser**
-> createUser(body)
+> createUser(user)
Create user
@@ -29,9 +29,9 @@ This can only be done by the logged in user.
//import org.openapitools.client.models.*
val apiInstance = UserApi()
-val body : User = // User | Created user object
+val user : User = // User | Created user object
try {
- apiInstance.createUser(body)
+ apiInstance.createUser(user)
} catch (e: ClientException) {
println("4xx response calling UserApi#createUser")
e.printStackTrace()
@@ -44,7 +44,7 @@ try {
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
-| **body** | [**User**](User.md)| Created user object | |
+| **user** | [**User**](User.md)| Created user object | |
### Return type
@@ -52,19 +52,24 @@ null (empty response body)
### Authorization
-No authorization required
+
+Configure api_key:
+ ApiClient.apiKey["api_key"] = ""
+ ApiClient.apiKeyPrefix["api_key"] = ""
### HTTP request headers
- - **Content-Type**: Not defined
+ - **Content-Type**: application/json
- **Accept**: Not defined
# **createUsersWithArrayInput**
-> createUsersWithArrayInput(body)
+> createUsersWithArrayInput(user)
Creates list of users with given input array
+
+
### Example
```kotlin
// Import classes:
@@ -72,9 +77,9 @@ Creates list of users with given input array
//import org.openapitools.client.models.*
val apiInstance = UserApi()
-val body : kotlin.collections.List = // kotlin.collections.List | List of user object
+val user : kotlin.collections.List = // kotlin.collections.List | List of user object
try {
- apiInstance.createUsersWithArrayInput(body)
+ apiInstance.createUsersWithArrayInput(user)
} catch (e: ClientException) {
println("4xx response calling UserApi#createUsersWithArrayInput")
e.printStackTrace()
@@ -87,7 +92,7 @@ try {
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
-| **body** | [**kotlin.collections.List<User>**](User.md)| List of user object | |
+| **user** | [**kotlin.collections.List<User>**](User.md)| List of user object | |
### Return type
@@ -95,19 +100,24 @@ null (empty response body)
### Authorization
-No authorization required
+
+Configure api_key:
+ ApiClient.apiKey["api_key"] = ""
+ ApiClient.apiKeyPrefix["api_key"] = ""
### HTTP request headers
- - **Content-Type**: Not defined
+ - **Content-Type**: application/json
- **Accept**: Not defined
# **createUsersWithListInput**
-> createUsersWithListInput(body)
+> createUsersWithListInput(user)
Creates list of users with given input array
+
+
### Example
```kotlin
// Import classes:
@@ -115,9 +125,9 @@ Creates list of users with given input array
//import org.openapitools.client.models.*
val apiInstance = UserApi()
-val body : kotlin.collections.List = // kotlin.collections.List | List of user object
+val user : kotlin.collections.List = // kotlin.collections.List | List of user object
try {
- apiInstance.createUsersWithListInput(body)
+ apiInstance.createUsersWithListInput(user)
} catch (e: ClientException) {
println("4xx response calling UserApi#createUsersWithListInput")
e.printStackTrace()
@@ -130,7 +140,7 @@ try {
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
-| **body** | [**kotlin.collections.List<User>**](User.md)| List of user object | |
+| **user** | [**kotlin.collections.List<User>**](User.md)| List of user object | |
### Return type
@@ -138,11 +148,14 @@ null (empty response body)
### Authorization
-No authorization required
+
+Configure api_key:
+ ApiClient.apiKey["api_key"] = ""
+ ApiClient.apiKeyPrefix["api_key"] = ""
### HTTP request headers
- - **Content-Type**: Not defined
+ - **Content-Type**: application/json
- **Accept**: Not defined
@@ -183,7 +196,10 @@ null (empty response body)
### Authorization
-No authorization required
+
+Configure api_key:
+ ApiClient.apiKey["api_key"] = ""
+ ApiClient.apiKeyPrefix["api_key"] = ""
### HTTP request headers
@@ -196,6 +212,8 @@ No authorization required
Get user by user name
+
+
### Example
```kotlin
// Import classes:
@@ -240,6 +258,8 @@ No authorization required
Logs user into the system
+
+
### Example
```kotlin
// Import classes:
@@ -286,6 +306,8 @@ No authorization required
Logs out current logged in user session
+
+
### Example
```kotlin
// Import classes:
@@ -313,7 +335,10 @@ null (empty response body)
### Authorization
-No authorization required
+
+Configure api_key:
+ ApiClient.apiKey["api_key"] = ""
+ ApiClient.apiKeyPrefix["api_key"] = ""
### HTTP request headers
@@ -322,7 +347,7 @@ No authorization required
# **updateUser**
-> updateUser(username, body)
+> updateUser(username, user)
Updated user
@@ -336,9 +361,9 @@ This can only be done by the logged in user.
val apiInstance = UserApi()
val username : kotlin.String = username_example // kotlin.String | name that need to be deleted
-val body : User = // User | Updated user object
+val user : User = // User | Updated user object
try {
- apiInstance.updateUser(username, body)
+ apiInstance.updateUser(username, user)
} catch (e: ClientException) {
println("4xx response calling UserApi#updateUser")
e.printStackTrace()
@@ -352,7 +377,7 @@ try {
| **username** | **kotlin.String**| name that need to be deleted | |
| Name | Type | Description | Notes |
| ------------- | ------------- | ------------- | ------------- |
-| **body** | [**User**](User.md)| Updated user object | |
+| **user** | [**User**](User.md)| Updated user object | |
### Return type
@@ -360,10 +385,13 @@ null (empty response body)
### Authorization
-No authorization required
+
+Configure api_key:
+ ApiClient.apiKey["api_key"] = ""
+ ApiClient.apiKeyPrefix["api_key"] = ""
### HTTP request headers
- - **Content-Type**: Not defined
+ - **Content-Type**: application/json
- **Accept**: Not defined
diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt
index 71a98eb51647..d5605d2dfb6a 100644
--- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt
+++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt
@@ -50,20 +50,21 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor
* POST /pet
* Add a new pet to the store
*
- * @param body Pet object that needs to be added to the store
- * @return void
+ * @param pet Pet object that needs to be added to the store
+ * @return Pet
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
* @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(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
- fun addPet(body: Pet) : Unit {
- val localVarResponse = addPetWithHttpInfo(body = body)
+ fun addPet(pet: Pet) : Pet {
+ val localVarResponse = addPetWithHttpInfo(pet = pet)
return when (localVarResponse.responseType) {
- ResponseType.Success -> Unit
+ 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 -> {
@@ -81,16 +82,17 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor
* POST /pet
* Add a new pet to the store
*
- * @param body Pet object that needs to be added to the store
- * @return ApiResponse
+ * @param pet Pet object that needs to be added to the store
+ * @return ApiResponse
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
+ @Suppress("UNCHECKED_CAST")
@Throws(IllegalStateException::class, IOException::class)
- fun addPetWithHttpInfo(body: Pet) : ApiResponse {
- val localVariableConfig = addPetRequestConfig(body = body)
+ fun addPetWithHttpInfo(pet: Pet) : ApiResponse {
+ val localVariableConfig = addPetRequestConfig(pet = pet)
- return request(
+ return request(
localVariableConfig
)
}
@@ -98,15 +100,16 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor
/**
* To obtain the request config of the operation addPet
*
- * @param body Pet object that needs to be added to the store
+ * @param pet Pet object that needs to be added to the store
* @return RequestConfig
*/
- fun addPetRequestConfig(body: Pet) : RequestConfig {
- val localVariableBody = body
+ fun addPetRequestConfig(pet: Pet) : RequestConfig {
+ val localVariableBody = pet
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap = mutableMapOf()
localVariableHeaders["Content-Type"] = "application/json"
-
+ localVariableHeaders["Accept"] = "application/json"
+
return RequestConfig(
method = RequestMethod.POST,
path = "/pet",
@@ -443,20 +446,21 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor
* PUT /pet
* Update an existing pet
*
- * @param body Pet object that needs to be added to the store
- * @return void
+ * @param pet Pet object that needs to be added to the store
+ * @return Pet
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
* @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(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
- fun updatePet(body: Pet) : Unit {
- val localVarResponse = updatePetWithHttpInfo(body = body)
+ fun updatePet(pet: Pet) : Pet {
+ val localVarResponse = updatePetWithHttpInfo(pet = pet)
return when (localVarResponse.responseType) {
- ResponseType.Success -> Unit
+ 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 -> {
@@ -474,16 +478,17 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor
* PUT /pet
* Update an existing pet
*
- * @param body Pet object that needs to be added to the store
- * @return ApiResponse
+ * @param pet Pet object that needs to be added to the store
+ * @return ApiResponse
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
+ @Suppress("UNCHECKED_CAST")
@Throws(IllegalStateException::class, IOException::class)
- fun updatePetWithHttpInfo(body: Pet) : ApiResponse {
- val localVariableConfig = updatePetRequestConfig(body = body)
+ fun updatePetWithHttpInfo(pet: Pet) : ApiResponse {
+ val localVariableConfig = updatePetRequestConfig(pet = pet)
- return request(
+ return request(
localVariableConfig
)
}
@@ -491,15 +496,16 @@ open class PetApi(basePath: kotlin.String = defaultBasePath, client: Call.Factor
/**
* To obtain the request config of the operation updatePet
*
- * @param body Pet object that needs to be added to the store
+ * @param pet Pet object that needs to be added to the store
* @return RequestConfig
*/
- fun updatePetRequestConfig(body: Pet) : RequestConfig {
- val localVariableBody = body
+ fun updatePetRequestConfig(pet: Pet) : RequestConfig {
+ val localVariableBody = pet
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap = mutableMapOf()
localVariableHeaders["Content-Type"] = "application/json"
-
+ localVariableHeaders["Accept"] = "application/json"
+
return RequestConfig(
method = RequestMethod.PUT,
path = "/pet",
diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt
index 4e1ab0677faf..83f36f7f7765 100644
--- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt
+++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt
@@ -262,7 +262,7 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact
* POST /store/order
* Place an order for a pet
*
- * @param body order placed for purchasing the pet
+ * @param order order placed for purchasing the pet
* @return Order
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
@@ -272,8 +272,8 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact
*/
@Suppress("UNCHECKED_CAST")
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
- fun placeOrder(body: Order) : Order {
- val localVarResponse = placeOrderWithHttpInfo(body = body)
+ fun placeOrder(order: Order) : Order {
+ val localVarResponse = placeOrderWithHttpInfo(order = order)
return when (localVarResponse.responseType) {
ResponseType.Success -> (localVarResponse as Success<*>).data as Order
@@ -294,15 +294,15 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact
* POST /store/order
* Place an order for a pet
*
- * @param body order placed for purchasing the pet
+ * @param order order placed for purchasing the pet
* @return ApiResponse
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Suppress("UNCHECKED_CAST")
@Throws(IllegalStateException::class, IOException::class)
- fun placeOrderWithHttpInfo(body: Order) : ApiResponse {
- val localVariableConfig = placeOrderRequestConfig(body = body)
+ fun placeOrderWithHttpInfo(order: Order) : ApiResponse {
+ val localVariableConfig = placeOrderRequestConfig(order = order)
return request(
localVariableConfig
@@ -312,13 +312,14 @@ open class StoreApi(basePath: kotlin.String = defaultBasePath, client: Call.Fact
/**
* To obtain the request config of the operation placeOrder
*
- * @param body order placed for purchasing the pet
+ * @param order order placed for purchasing the pet
* @return RequestConfig
*/
- fun placeOrderRequestConfig(body: Order) : RequestConfig {
- val localVariableBody = body
+ fun placeOrderRequestConfig(order: Order) : RequestConfig {
+ val localVariableBody = order
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap = mutableMapOf()
+ localVariableHeaders["Content-Type"] = "application/json"
localVariableHeaders["Accept"] = "application/json"
return RequestConfig(
diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt
index 91bf8a6be5a3..59ae1b3fcd8d 100644
--- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt
+++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt
@@ -49,7 +49,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto
* POST /user
* Create user
* This can only be done by the logged in user.
- * @param body Created user object
+ * @param user Created user object
* @return void
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
@@ -58,8 +58,8 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto
* @throws ServerException If the API returns a server error response
*/
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
- fun createUser(body: User) : Unit {
- val localVarResponse = createUserWithHttpInfo(body = body)
+ fun createUser(user: User) : Unit {
+ val localVarResponse = createUserWithHttpInfo(user = user)
return when (localVarResponse.responseType) {
ResponseType.Success -> Unit
@@ -80,14 +80,14 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto
* POST /user
* Create user
* This can only be done by the logged in user.
- * @param body Created user object
+ * @param user Created user object
* @return ApiResponse
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
- fun createUserWithHttpInfo(body: User) : ApiResponse {
- val localVariableConfig = createUserRequestConfig(body = body)
+ fun createUserWithHttpInfo(user: User) : ApiResponse {
+ val localVariableConfig = createUserRequestConfig(user = user)
return request(
localVariableConfig
@@ -97,20 +97,21 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto
/**
* To obtain the request config of the operation createUser
*
- * @param body Created user object
+ * @param user Created user object
* @return RequestConfig
*/
- fun createUserRequestConfig(body: User) : RequestConfig {
- val localVariableBody = body
+ fun createUserRequestConfig(user: User) : RequestConfig {
+ val localVariableBody = user
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap = mutableMapOf()
+ localVariableHeaders["Content-Type"] = "application/json"
return RequestConfig(
method = RequestMethod.POST,
path = "/user",
query = localVariableQuery,
headers = localVariableHeaders,
- requiresAuthentication = false,
+ requiresAuthentication = true,
body = localVariableBody
)
}
@@ -119,7 +120,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto
* POST /user/createWithArray
* Creates list of users with given input array
*
- * @param body List of user object
+ * @param user List of user object
* @return void
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
@@ -128,8 +129,8 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto
* @throws ServerException If the API returns a server error response
*/
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
- fun createUsersWithArrayInput(body: kotlin.collections.List) : Unit {
- val localVarResponse = createUsersWithArrayInputWithHttpInfo(body = body)
+ fun createUsersWithArrayInput(user: kotlin.collections.List) : Unit {
+ val localVarResponse = createUsersWithArrayInputWithHttpInfo(user = user)
return when (localVarResponse.responseType) {
ResponseType.Success -> Unit
@@ -150,14 +151,14 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto
* POST /user/createWithArray
* Creates list of users with given input array
*
- * @param body List of user object
+ * @param user List of user object
* @return ApiResponse
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
- fun createUsersWithArrayInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse {
- val localVariableConfig = createUsersWithArrayInputRequestConfig(body = body)
+ fun createUsersWithArrayInputWithHttpInfo(user: kotlin.collections.List) : ApiResponse {
+ val localVariableConfig = createUsersWithArrayInputRequestConfig(user = user)
return request, Unit>(
localVariableConfig
@@ -167,20 +168,21 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto
/**
* To obtain the request config of the operation createUsersWithArrayInput
*
- * @param body List of user object
+ * @param user List of user object
* @return RequestConfig
*/
- fun createUsersWithArrayInputRequestConfig(body: kotlin.collections.List) : RequestConfig> {
- val localVariableBody = body
+ fun createUsersWithArrayInputRequestConfig(user: kotlin.collections.List) : RequestConfig> {
+ val localVariableBody = user
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap = mutableMapOf()
+ localVariableHeaders["Content-Type"] = "application/json"
return RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithArray",
query = localVariableQuery,
headers = localVariableHeaders,
- requiresAuthentication = false,
+ requiresAuthentication = true,
body = localVariableBody
)
}
@@ -189,7 +191,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto
* POST /user/createWithList
* Creates list of users with given input array
*
- * @param body List of user object
+ * @param user List of user object
* @return void
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
@@ -198,8 +200,8 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto
* @throws ServerException If the API returns a server error response
*/
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
- fun createUsersWithListInput(body: kotlin.collections.List) : Unit {
- val localVarResponse = createUsersWithListInputWithHttpInfo(body = body)
+ fun createUsersWithListInput(user: kotlin.collections.List) : Unit {
+ val localVarResponse = createUsersWithListInputWithHttpInfo(user = user)
return when (localVarResponse.responseType) {
ResponseType.Success -> Unit
@@ -220,14 +222,14 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto
* POST /user/createWithList
* Creates list of users with given input array
*
- * @param body List of user object
+ * @param user List of user object
* @return ApiResponse
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
- fun createUsersWithListInputWithHttpInfo(body: kotlin.collections.List) : ApiResponse {
- val localVariableConfig = createUsersWithListInputRequestConfig(body = body)
+ fun createUsersWithListInputWithHttpInfo(user: kotlin.collections.List) : ApiResponse {
+ val localVariableConfig = createUsersWithListInputRequestConfig(user = user)
return request, Unit>(
localVariableConfig
@@ -237,20 +239,21 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto
/**
* To obtain the request config of the operation createUsersWithListInput
*
- * @param body List of user object
+ * @param user List of user object
* @return RequestConfig
*/
- fun createUsersWithListInputRequestConfig(body: kotlin.collections.List) : RequestConfig> {
- val localVariableBody = body
+ fun createUsersWithListInputRequestConfig(user: kotlin.collections.List) : RequestConfig> {
+ val localVariableBody = user
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap = mutableMapOf()
+ localVariableHeaders["Content-Type"] = "application/json"
return RequestConfig(
method = RequestMethod.POST,
path = "/user/createWithList",
query = localVariableQuery,
headers = localVariableHeaders,
- requiresAuthentication = false,
+ requiresAuthentication = true,
body = localVariableBody
)
}
@@ -320,7 +323,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto
path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery,
headers = localVariableHeaders,
- requiresAuthentication = false,
+ requiresAuthentication = true,
body = localVariableBody
)
}
@@ -540,7 +543,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto
path = "/user/logout",
query = localVariableQuery,
headers = localVariableHeaders,
- requiresAuthentication = false,
+ requiresAuthentication = true,
body = localVariableBody
)
}
@@ -550,7 +553,7 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto
* Updated user
* This can only be done by the logged in user.
* @param username name that need to be deleted
- * @param body Updated user object
+ * @param user Updated user object
* @return void
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
@@ -559,8 +562,8 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto
* @throws ServerException If the API returns a server error response
*/
@Throws(IllegalStateException::class, IOException::class, UnsupportedOperationException::class, ClientException::class, ServerException::class)
- fun updateUser(username: kotlin.String, body: User) : Unit {
- val localVarResponse = updateUserWithHttpInfo(username = username, body = body)
+ fun updateUser(username: kotlin.String, user: User) : Unit {
+ val localVarResponse = updateUserWithHttpInfo(username = username, user = user)
return when (localVarResponse.responseType) {
ResponseType.Success -> Unit
@@ -582,14 +585,14 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto
* Updated user
* This can only be done by the logged in user.
* @param username name that need to be deleted
- * @param body Updated user object
+ * @param user Updated user object
* @return ApiResponse
* @throws IllegalStateException If the request is not correctly configured
* @throws IOException Rethrows the OkHttp execute method exception
*/
@Throws(IllegalStateException::class, IOException::class)
- fun updateUserWithHttpInfo(username: kotlin.String, body: User) : ApiResponse {
- val localVariableConfig = updateUserRequestConfig(username = username, body = body)
+ fun updateUserWithHttpInfo(username: kotlin.String, user: User) : ApiResponse {
+ val localVariableConfig = updateUserRequestConfig(username = username, user = user)
return request(
localVariableConfig
@@ -600,20 +603,21 @@ open class UserApi(basePath: kotlin.String = defaultBasePath, client: Call.Facto
* To obtain the request config of the operation updateUser
*
* @param username name that need to be deleted
- * @param body Updated user object
+ * @param user Updated user object
* @return RequestConfig
*/
- fun updateUserRequestConfig(username: kotlin.String, body: User) : RequestConfig {
- val localVariableBody = body
+ fun updateUserRequestConfig(username: kotlin.String, user: User) : RequestConfig {
+ val localVariableBody = user
val localVariableQuery: MultiValueMap = mutableMapOf()
val localVariableHeaders: MutableMap = mutableMapOf()
+ localVariableHeaders["Content-Type"] = "application/json"
return RequestConfig(
method = RequestMethod.PUT,
path = "/user/{username}".replace("{"+"username"+"}", encodeURIComponent(username.toString())),
query = localVariableQuery,
headers = localVariableHeaders,
- requiresAuthentication = false,
+ requiresAuthentication = true,
body = localVariableBody
)
}
diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Category.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Category.kt
index 87eacb1365a5..92998b83400d 100644
--- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Category.kt
+++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Category.kt
@@ -35,6 +35,7 @@ data class Category (
val name: kotlin.String? = null
) {
+ companion object { }
}
diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt
index fe2d51d4ef04..add1de46e967 100644
--- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt
+++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/ModelApiResponse.kt
@@ -39,6 +39,7 @@ data class ModelApiResponse (
val message: kotlin.String? = null
) {
+ companion object { }
}
diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Order.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Order.kt
index b9f182f53b53..c08af4d76416 100644
--- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Order.kt
+++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Order.kt
@@ -52,6 +52,7 @@ data class Order (
val complete: kotlin.Boolean? = false
) {
+ companion object { }
/**
* Order Status
diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Pet.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Pet.kt
index 57c97dd3d089..6fc1fbf59b2b 100644
--- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Pet.kt
+++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Pet.kt
@@ -51,9 +51,11 @@ data class Pet (
/* pet status in the store */
@SerializedName("status")
+ @Deprecated(message = "This property is deprecated.")
val status: Pet.Status? = null
) {
+ companion object { }
/**
* pet status in the store
diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Tag.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Tag.kt
index f66db9ea55e8..eb8bf964dc50 100644
--- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Tag.kt
+++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/Tag.kt
@@ -35,6 +35,7 @@ data class Tag (
val name: kotlin.String? = null
) {
+ companion object { }
}
diff --git a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/User.kt b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/User.kt
index 62b3ce81f9bf..e2c260392392 100644
--- a/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/User.kt
+++ b/samples/client/petstore/kotlin-gson/src/main/kotlin/org/openapitools/client/models/User.kt
@@ -60,6 +60,7 @@ data class User (
val userStatus: kotlin.Int? = null
) {
+ companion object { }
}