From 08da0abfcaed908c84fcdd7fc026284c9cdf6499 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sat, 11 Oct 2025 00:51:11 +0800 Subject: [PATCH] remove unused files in java samples (#22105) --- .../docs/Category.md | 15 - .../docs/ModelApiResponse.md | 16 - .../docs/Order.md | 29 - .../docs/Pet.md | 29 - .../docs/StoreApi.md | 266 ---- .../docs/Tag.md | 15 - .../docs/User.md | 21 - .../docs/UserApi.md | 553 --------- .../org/openapitools/client/api/StoreApi.java | 586 --------- .../org/openapitools/client/api/UserApi.java | 1100 ----------------- .../openapitools/client/model/Category.java | 314 ----- .../client/model/ModelApiResponse.java | 343 ----- .../org/openapitools/client/model/Order.java | 477 ------- .../org/openapitools/client/model/Pet.java | 535 -------- .../org/openapitools/client/model/Tag.java | 314 ----- .../org/openapitools/client/model/User.java | 485 -------- .../openapitools/client/api/StoreApiTest.java | 89 -- .../openapitools/client/api/UserApiTest.java | 148 --- .../client/model/CategoryTest.java | 56 - .../client/model/ModelApiResponseTest.java | 64 - .../openapitools/client/model/OrderTest.java | 89 -- .../openapitools/client/model/PetTest.java | 92 -- .../openapitools/client/model/TagTest.java | 56 - .../openapitools/client/model/UserTest.java | 104 -- 24 files changed, 5796 deletions(-) delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/Category.md delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/ModelApiResponse.md delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/Order.md delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/Pet.md delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/StoreApi.md delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/Tag.md delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/User.md delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/UserApi.md delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/api/StoreApi.java delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/api/UserApi.java delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/Category.java delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/ModelApiResponse.java delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/Order.java delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/Pet.java delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/Tag.java delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/User.java delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/api/StoreApiTest.java delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/api/UserApiTest.java delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/CategoryTest.java delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/OrderTest.java delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/PetTest.java delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/TagTest.java delete mode 100644 samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/UserTest.java diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/Category.md b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/Category.md deleted file mode 100644 index a7fc939d252..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/Category.md +++ /dev/null @@ -1,15 +0,0 @@ - - -# Category - -A category for a pet - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**id** | **Long** | | [optional] | -|**name** | **String** | | [optional] | - - - diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/ModelApiResponse.md b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/ModelApiResponse.md deleted file mode 100644 index cd7e3c400be..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/ModelApiResponse.md +++ /dev/null @@ -1,16 +0,0 @@ - - -# ModelApiResponse - -Describes the result of uploading an image resource - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**code** | **Integer** | | [optional] | -|**type** | **String** | | [optional] | -|**message** | **String** | | [optional] | - - - diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/Order.md b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/Order.md deleted file mode 100644 index 0c33059b8b6..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/Order.md +++ /dev/null @@ -1,29 +0,0 @@ - - -# Order - -An order for a pets from the pet store - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**id** | **Long** | | [optional] | -|**petId** | **Long** | | [optional] | -|**quantity** | **Integer** | | [optional] | -|**shipDate** | **OffsetDateTime** | | [optional] | -|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | -|**complete** | **Boolean** | | [optional] | - - - -## Enum: StatusEnum - -| Name | Value | -|---- | -----| -| PLACED | "placed" | -| APPROVED | "approved" | -| DELIVERED | "delivered" | - - - diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/Pet.md b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/Pet.md deleted file mode 100644 index 8bb36330123..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/Pet.md +++ /dev/null @@ -1,29 +0,0 @@ - - -# Pet - -A pet for sale in the pet store - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**id** | **Long** | | [optional] | -|**category** | [**Category**](Category.md) | | [optional] | -|**name** | **String** | | | -|**photoUrls** | **List<String>** | | | -|**tags** | [**List<Tag>**](Tag.md) | | [optional] | -|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] | - - - -## Enum: StatusEnum - -| Name | Value | -|---- | -----| -| AVAILABLE | "available" | -| PENDING | "pending" | -| SOLD | "sold" | - - - diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/StoreApi.md b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/StoreApi.md deleted file mode 100644 index af54298ffc2..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/StoreApi.md +++ /dev/null @@ -1,266 +0,0 @@ -# StoreApi - -All URIs are relative to *http://petstore.swagger.io/v2* - -| Method | HTTP request | Description | -|------------- | ------------- | -------------| -| [**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID | -| [**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status | -| [**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID | -| [**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet | - - - -# **deleteOrder** -> deleteOrder(orderId) - -Delete purchase order by ID - -For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - -### Example -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.models.*; -import org.openapitools.client.api.StoreApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io/v2"); - - StoreApi apiInstance = new StoreApi(defaultClient); - String orderId = "orderId_example"; // String | ID of the order that needs to be deleted - try { - apiInstance.deleteOrder(orderId); - } catch (ApiException e) { - System.err.println("Exception when calling StoreApi#deleteOrder"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **orderId** | **String**| ID of the order that needs to be deleted | | - -### Return type - -null (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **400** | Invalid ID supplied | - | -| **404** | Order not found | - | - - -# **getInventory** -> Map<String, Integer> getInventory() - -Returns pet inventories by status - -Returns a map of status codes to quantities - -### Example -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.StoreApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io/v2"); - - // Configure API key authorization: api_key - ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); - api_key.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //api_key.setApiKeyPrefix("Token"); - - StoreApi apiInstance = new StoreApi(defaultClient); - try { - Map result = apiInstance.getInventory(); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getInventory"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**Map<String, Integer>** - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | - - -# **getOrderById** -> Order getOrderById(orderId) - -Find purchase order by ID - -For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - -### Example -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.models.*; -import org.openapitools.client.api.StoreApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io/v2"); - - StoreApi apiInstance = new StoreApi(defaultClient); - Long orderId = 56L; // Long | ID of pet that needs to be fetched - try { - Order result = apiInstance.getOrderById(orderId); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getOrderById"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **orderId** | **Long**| ID of pet that needs to be fetched | | - -### Return type - -[**Order**](Order.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | -| **400** | Invalid ID supplied | - | -| **404** | Order not found | - | - - -# **placeOrder** -> Order placeOrder(order) - -Place an order for a pet - - - -### Example -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.models.*; -import org.openapitools.client.api.StoreApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io/v2"); - - StoreApi apiInstance = new StoreApi(defaultClient); - Order order = new Order(); // Order | order placed for purchasing the pet - try { - Order result = apiInstance.placeOrder(order); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling StoreApi#placeOrder"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **order** | [**Order**](Order.md)| order placed for purchasing the pet | | - -### Return type - -[**Order**](Order.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/xml, application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | -| **400** | Invalid Order | - | - diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/Tag.md b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/Tag.md deleted file mode 100644 index abfde4afb50..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/Tag.md +++ /dev/null @@ -1,15 +0,0 @@ - - -# Tag - -A tag for a pet - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**id** | **Long** | | [optional] | -|**name** | **String** | | [optional] | - - - diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/User.md b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/User.md deleted file mode 100644 index 426845227bd..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/User.md +++ /dev/null @@ -1,21 +0,0 @@ - - -# User - -A User who is purchasing from the pet store - -## Properties - -| Name | Type | Description | Notes | -|------------ | ------------- | ------------- | -------------| -|**id** | **Long** | | [optional] | -|**username** | **String** | | [optional] | -|**firstName** | **String** | | [optional] | -|**lastName** | **String** | | [optional] | -|**email** | **String** | | [optional] | -|**password** | **String** | | [optional] | -|**phone** | **String** | | [optional] | -|**userStatus** | **Integer** | User Status | [optional] | - - - diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/UserApi.md b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/UserApi.md deleted file mode 100644 index 4c338a42137..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/docs/UserApi.md +++ /dev/null @@ -1,553 +0,0 @@ -# UserApi - -All URIs are relative to *http://petstore.swagger.io/v2* - -| Method | HTTP request | Description | -|------------- | ------------- | -------------| -| [**createUser**](UserApi.md#createUser) | **POST** /user | Create user | -| [**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array | -| [**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array | -| [**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user | -| [**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name | -| [**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system | -| [**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session | -| [**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user | - - - -# **createUser** -> createUser(user) - -Create user - -This can only be done by the logged in user. - -### Example -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.UserApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io/v2"); - - // Configure API key authorization: api_key - ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); - api_key.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //api_key.setApiKeyPrefix("Token"); - - UserApi apiInstance = new UserApi(defaultClient); - User user = new User(); // User | Created user object - try { - apiInstance.createUser(user); - } catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUser"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **user** | [**User**](User.md)| Created user object | | - -### Return type - -null (empty response body) - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **0** | successful operation | - | - - -# **createUsersWithArrayInput** -> createUsersWithArrayInput(user) - -Creates list of users with given input array - - - -### Example -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.UserApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io/v2"); - - // Configure API key authorization: api_key - ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); - api_key.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //api_key.setApiKeyPrefix("Token"); - - UserApi apiInstance = new UserApi(defaultClient); - List user = Arrays.asList(); // List | List of user object - try { - apiInstance.createUsersWithArrayInput(user); - } catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **user** | [**List<User>**](User.md)| List of user object | | - -### Return type - -null (empty response body) - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **0** | successful operation | - | - - -# **createUsersWithListInput** -> createUsersWithListInput(user) - -Creates list of users with given input array - - - -### Example -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.UserApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io/v2"); - - // Configure API key authorization: api_key - ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); - api_key.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //api_key.setApiKeyPrefix("Token"); - - UserApi apiInstance = new UserApi(defaultClient); - List user = Arrays.asList(); // List | List of user object - try { - apiInstance.createUsersWithListInput(user); - } catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithListInput"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **user** | [**List<User>**](User.md)| List of user object | | - -### Return type - -null (empty response body) - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **0** | successful operation | - | - - -# **deleteUser** -> deleteUser(username) - -Delete user - -This can only be done by the logged in user. - -### Example -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.UserApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io/v2"); - - // Configure API key authorization: api_key - ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); - api_key.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //api_key.setApiKeyPrefix("Token"); - - UserApi apiInstance = new UserApi(defaultClient); - String username = "username_example"; // String | The name that needs to be deleted - try { - apiInstance.deleteUser(username); - } catch (ApiException e) { - System.err.println("Exception when calling UserApi#deleteUser"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **username** | **String**| The name that needs to be deleted | | - -### Return type - -null (empty response body) - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **400** | Invalid username supplied | - | -| **404** | User not found | - | - - -# **getUserByName** -> User getUserByName(username) - -Get user by user name - - - -### Example -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.models.*; -import org.openapitools.client.api.UserApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io/v2"); - - UserApi apiInstance = new UserApi(defaultClient); - String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. - try { - User result = apiInstance.getUserByName(username); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling UserApi#getUserByName"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **username** | **String**| The name that needs to be fetched. Use user1 for testing. | | - -### Return type - -[**User**](User.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | - | -| **400** | Invalid username supplied | - | -| **404** | User not found | - | - - -# **loginUser** -> String loginUser(username, password) - -Logs user into the system - - - -### Example -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.models.*; -import org.openapitools.client.api.UserApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io/v2"); - - UserApi apiInstance = new UserApi(defaultClient); - String username = "username_example"; // String | The user name for login - String password = "password_example"; // String | The password for login in clear text - try { - String result = apiInstance.loginUser(username, password); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling UserApi#loginUser"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **username** | **String**| The user name for login | | -| **password** | **String**| The password for login in clear text | | - -### Return type - -**String** - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| -| **400** | Invalid username/password supplied | - | - - -# **logoutUser** -> logoutUser() - -Logs out current logged in user session - - - -### Example -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.UserApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io/v2"); - - // Configure API key authorization: api_key - ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); - api_key.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //api_key.setApiKeyPrefix("Token"); - - UserApi apiInstance = new UserApi(defaultClient); - try { - apiInstance.logoutUser(); - } catch (ApiException e) { - System.err.println("Exception when calling UserApi#logoutUser"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -null (empty response body) - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **0** | successful operation | - | - - -# **updateUser** -> updateUser(username, user) - -Updated user - -This can only be done by the logged in user. - -### Example -```java -// Import classes: -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.Configuration; -import org.openapitools.client.auth.*; -import org.openapitools.client.models.*; -import org.openapitools.client.api.UserApi; - -public class Example { - public static void main(String[] args) { - ApiClient defaultClient = Configuration.getDefaultApiClient(); - defaultClient.setBasePath("http://petstore.swagger.io/v2"); - - // Configure API key authorization: api_key - ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); - api_key.setApiKey("YOUR API KEY"); - // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) - //api_key.setApiKeyPrefix("Token"); - - UserApi apiInstance = new UserApi(defaultClient); - String username = "username_example"; // String | name that need to be deleted - User user = new User(); // User | Updated user object - try { - apiInstance.updateUser(username, user); - } catch (ApiException e) { - System.err.println("Exception when calling UserApi#updateUser"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getResponseBody()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - -| Name | Type | Description | Notes | -|------------- | ------------- | ------------- | -------------| -| **username** | **String**| name that need to be deleted | | -| **user** | [**User**](User.md)| Updated user object | | - -### Return type - -null (empty response body) - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: Not defined - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **400** | Invalid user supplied | - | -| **404** | User not found | - | - diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/api/StoreApi.java deleted file mode 100644 index e1140a10a68..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/api/StoreApi.java +++ /dev/null @@ -1,586 +0,0 @@ -/* - * 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.api; - -import org.openapitools.client.ApiCallback; -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.ApiResponse; -import org.openapitools.client.Configuration; -import org.openapitools.client.Pair; -import org.openapitools.client.ProgressRequestBody; -import org.openapitools.client.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import org.openapitools.client.model.Order; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class StoreApi { - private ApiClient localVarApiClient; - private int localHostIndex; - private String localCustomBaseUrl; - - public StoreApi() { - this(Configuration.getDefaultApiClient()); - } - - public StoreApi(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public ApiClient getApiClient() { - return localVarApiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public int getHostIndex() { - return localHostIndex; - } - - public void setHostIndex(int hostIndex) { - this.localHostIndex = hostIndex; - } - - public String getCustomBaseUrl() { - return localCustomBaseUrl; - } - - public void setCustomBaseUrl(String customBaseUrl) { - this.localCustomBaseUrl = customBaseUrl; - } - - /** - * Build call for deleteOrder - * @param orderId ID of the order that needs to be deleted (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - -
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
- */ - public okhttp3.Call deleteOrderCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/store/order/{orderId}" - .replace("{" + "orderId" + "}", localVarApiClient.escapeString(orderId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call deleteOrderValidateBeforeCall(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'orderId' is set - if (orderId == null) { - throw new ApiException("Missing the required parameter 'orderId' when calling deleteOrder(Async)"); - } - - return deleteOrderCall(orderId, _callback); - - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
- */ - public void deleteOrder(@javax.annotation.Nonnull String orderId) throws ApiException { - deleteOrderWithHttpInfo(orderId); - } - - /** - * Delete purchase order by ID - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
- */ - public ApiResponse deleteOrderWithHttpInfo(@javax.annotation.Nonnull String orderId) throws ApiException { - okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, null); - return localVarApiClient.execute(localVarCall); - } - - /** - * Delete purchase order by ID (asynchronously) - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @param orderId ID of the order that needs to be deleted (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - -
Response Details
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
- */ - public okhttp3.Call deleteOrderAsync(@javax.annotation.Nonnull String orderId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = deleteOrderValidateBeforeCall(orderId, _callback); - localVarApiClient.executeAsync(localVarCall, _callback); - return localVarCall; - } - /** - * Build call for getInventory - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - -
Response Details
Status Code Description Response Headers
200 successful operation -
- */ - public okhttp3.Call getInventoryCall(final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/store/inventory"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "api_key" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call getInventoryValidateBeforeCall(final ApiCallback _callback) throws ApiException { - return getInventoryCall(_callback); - - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return Map<String, Integer> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - -
Response Details
Status Code Description Response Headers
200 successful operation -
- */ - public Map getInventory() throws ApiException { - ApiResponse> localVarResp = getInventoryWithHttpInfo(); - return localVarResp.getData(); - } - - /** - * Returns pet inventories by status - * Returns a map of status codes to quantities - * @return ApiResponse<Map<String, Integer>> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - -
Response Details
Status Code Description Response Headers
200 successful operation -
- */ - public ApiResponse> getInventoryWithHttpInfo() throws ApiException { - okhttp3.Call localVarCall = getInventoryValidateBeforeCall(null); - Type localVarReturnType = new TypeToken>(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Returns pet inventories by status (asynchronously) - * Returns a map of status codes to quantities - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - -
Response Details
Status Code Description Response Headers
200 successful operation -
- */ - public okhttp3.Call getInventoryAsync(final ApiCallback> _callback) throws ApiException { - - okhttp3.Call localVarCall = getInventoryValidateBeforeCall(_callback); - Type localVarReturnType = new TypeToken>(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for getOrderById - * @param orderId ID of pet that needs to be fetched (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - - -
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
- */ - public okhttp3.Call getOrderByIdCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/store/order/{orderId}" - .replace("{" + "orderId" + "}", localVarApiClient.escapeString(orderId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/xml", - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call getOrderByIdValidateBeforeCall(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'orderId' is set - if (orderId == null) { - throw new ApiException("Missing the required parameter 'orderId' when calling getOrderById(Async)"); - } - - return getOrderByIdCall(orderId, _callback); - - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - * @param orderId ID of pet that needs to be fetched (required) - * @return Order - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - -
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
- */ - public Order getOrderById(@javax.annotation.Nonnull Long orderId) throws ApiException { - ApiResponse localVarResp = getOrderByIdWithHttpInfo(orderId); - return localVarResp.getData(); - } - - /** - * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - * @param orderId ID of pet that needs to be fetched (required) - * @return ApiResponse<Order> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - -
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
- */ - public ApiResponse getOrderByIdWithHttpInfo(@javax.annotation.Nonnull Long orderId) throws ApiException { - okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Find purchase order by ID (asynchronously) - * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - * @param orderId ID of pet that needs to be fetched (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - - -
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
- */ - public okhttp3.Call getOrderByIdAsync(@javax.annotation.Nonnull Long orderId, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getOrderByIdValidateBeforeCall(orderId, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for placeOrder - * @param order order placed for purchasing the pet (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - -
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
- */ - public okhttp3.Call placeOrderCall(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = order; - - // create path and map variables - String localVarPath = "/store/order"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/xml", - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call placeOrderValidateBeforeCall(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'order' is set - if (order == null) { - throw new ApiException("Missing the required parameter 'order' when calling placeOrder(Async)"); - } - - return placeOrderCall(order, _callback); - - } - - /** - * Place an order for a pet - * - * @param order order placed for purchasing the pet (required) - * @return Order - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
- */ - public Order placeOrder(@javax.annotation.Nonnull Order order) throws ApiException { - ApiResponse localVarResp = placeOrderWithHttpInfo(order); - return localVarResp.getData(); - } - - /** - * Place an order for a pet - * - * @param order order placed for purchasing the pet (required) - * @return ApiResponse<Order> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
- */ - public ApiResponse placeOrderWithHttpInfo(@javax.annotation.Nonnull Order order) throws ApiException { - okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Place an order for a pet (asynchronously) - * - * @param order order placed for purchasing the pet (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - -
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
- */ - public okhttp3.Call placeOrderAsync(@javax.annotation.Nonnull Order order, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = placeOrderValidateBeforeCall(order, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } -} diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/api/UserApi.java deleted file mode 100644 index 34d1386c02e..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/api/UserApi.java +++ /dev/null @@ -1,1100 +0,0 @@ -/* - * 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.api; - -import org.openapitools.client.ApiCallback; -import org.openapitools.client.ApiClient; -import org.openapitools.client.ApiException; -import org.openapitools.client.ApiResponse; -import org.openapitools.client.Configuration; -import org.openapitools.client.Pair; -import org.openapitools.client.ProgressRequestBody; -import org.openapitools.client.ProgressResponseBody; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - - -import java.time.OffsetDateTime; -import org.openapitools.client.model.User; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class UserApi { - private ApiClient localVarApiClient; - private int localHostIndex; - private String localCustomBaseUrl; - - public UserApi() { - this(Configuration.getDefaultApiClient()); - } - - public UserApi(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public ApiClient getApiClient() { - return localVarApiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - public int getHostIndex() { - return localHostIndex; - } - - public void setHostIndex(int hostIndex) { - this.localHostIndex = hostIndex; - } - - public String getCustomBaseUrl() { - return localCustomBaseUrl; - } - - public void setCustomBaseUrl(String customBaseUrl) { - this.localCustomBaseUrl = customBaseUrl; - } - - /** - * Build call for createUser - * @param user Created user object (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - -
Response Details
Status Code Description Response Headers
0 successful operation -
- */ - public okhttp3.Call createUserCall(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = user; - - // create path and map variables - String localVarPath = "/user"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "api_key" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call createUserValidateBeforeCall(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'user' is set - if (user == null) { - throw new ApiException("Missing the required parameter 'user' when calling createUser(Async)"); - } - - return createUserCall(user, _callback); - - } - - /** - * Create user - * This can only be done by the logged in user. - * @param user Created user object (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - -
Response Details
Status Code Description Response Headers
0 successful operation -
- */ - public void createUser(@javax.annotation.Nonnull User user) throws ApiException { - createUserWithHttpInfo(user); - } - - /** - * Create user - * This can only be done by the logged in user. - * @param user Created user object (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - -
Response Details
Status Code Description Response Headers
0 successful operation -
- */ - public ApiResponse createUserWithHttpInfo(@javax.annotation.Nonnull User user) throws ApiException { - okhttp3.Call localVarCall = createUserValidateBeforeCall(user, null); - return localVarApiClient.execute(localVarCall); - } - - /** - * Create user (asynchronously) - * This can only be done by the logged in user. - * @param user Created user object (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - -
Response Details
Status Code Description Response Headers
0 successful operation -
- */ - public okhttp3.Call createUserAsync(@javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = createUserValidateBeforeCall(user, _callback); - localVarApiClient.executeAsync(localVarCall, _callback); - return localVarCall; - } - /** - * Build call for createUsersWithArrayInput - * @param user List of user object (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - -
Response Details
Status Code Description Response Headers
0 successful operation -
- */ - public okhttp3.Call createUsersWithArrayInputCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = user; - - // create path and map variables - String localVarPath = "/user/createWithArray"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "api_key" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call createUsersWithArrayInputValidateBeforeCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'user' is set - if (user == null) { - throw new ApiException("Missing the required parameter 'user' when calling createUsersWithArrayInput(Async)"); - } - - return createUsersWithArrayInputCall(user, _callback); - - } - - /** - * Creates list of users with given input array - * - * @param user List of user object (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - -
Response Details
Status Code Description Response Headers
0 successful operation -
- */ - public void createUsersWithArrayInput(@javax.annotation.Nonnull List user) throws ApiException { - createUsersWithArrayInputWithHttpInfo(user); - } - - /** - * Creates list of users with given input array - * - * @param user List of user object (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - -
Response Details
Status Code Description Response Headers
0 successful operation -
- */ - public ApiResponse createUsersWithArrayInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { - okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(user, null); - return localVarApiClient.execute(localVarCall); - } - - /** - * Creates list of users with given input array (asynchronously) - * - * @param user List of user object (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - -
Response Details
Status Code Description Response Headers
0 successful operation -
- */ - public okhttp3.Call createUsersWithArrayInputAsync(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = createUsersWithArrayInputValidateBeforeCall(user, _callback); - localVarApiClient.executeAsync(localVarCall, _callback); - return localVarCall; - } - /** - * Build call for createUsersWithListInput - * @param user List of user object (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - -
Response Details
Status Code Description Response Headers
0 successful operation -
- */ - public okhttp3.Call createUsersWithListInputCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = user; - - // create path and map variables - String localVarPath = "/user/createWithList"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "api_key" }; - return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call createUsersWithListInputValidateBeforeCall(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'user' is set - if (user == null) { - throw new ApiException("Missing the required parameter 'user' when calling createUsersWithListInput(Async)"); - } - - return createUsersWithListInputCall(user, _callback); - - } - - /** - * Creates list of users with given input array - * - * @param user List of user object (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - -
Response Details
Status Code Description Response Headers
0 successful operation -
- */ - public void createUsersWithListInput(@javax.annotation.Nonnull List user) throws ApiException { - createUsersWithListInputWithHttpInfo(user); - } - - /** - * Creates list of users with given input array - * - * @param user List of user object (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - -
Response Details
Status Code Description Response Headers
0 successful operation -
- */ - public ApiResponse createUsersWithListInputWithHttpInfo(@javax.annotation.Nonnull List user) throws ApiException { - okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(user, null); - return localVarApiClient.execute(localVarCall); - } - - /** - * Creates list of users with given input array (asynchronously) - * - * @param user List of user object (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - -
Response Details
Status Code Description Response Headers
0 successful operation -
- */ - public okhttp3.Call createUsersWithListInputAsync(@javax.annotation.Nonnull List user, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = createUsersWithListInputValidateBeforeCall(user, _callback); - localVarApiClient.executeAsync(localVarCall, _callback); - return localVarCall; - } - /** - * Build call for deleteUser - * @param username The name that needs to be deleted (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - -
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
- */ - public okhttp3.Call deleteUserCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/user/{username}" - .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "api_key" }; - return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call deleteUserValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException("Missing the required parameter 'username' when calling deleteUser(Async)"); - } - - return deleteUserCall(username, _callback); - - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
- */ - public void deleteUser(@javax.annotation.Nonnull String username) throws ApiException { - deleteUserWithHttpInfo(username); - } - - /** - * Delete user - * This can only be done by the logged in user. - * @param username The name that needs to be deleted (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
- */ - public ApiResponse deleteUserWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { - okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, null); - return localVarApiClient.execute(localVarCall); - } - - /** - * Delete user (asynchronously) - * This can only be done by the logged in user. - * @param username The name that needs to be deleted (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - -
Response Details
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
- */ - public okhttp3.Call deleteUserAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = deleteUserValidateBeforeCall(username, _callback); - localVarApiClient.executeAsync(localVarCall, _callback); - return localVarCall; - } - /** - * Build call for getUserByName - * @param username The name that needs to be fetched. Use user1 for testing. (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - - -
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
- */ - public okhttp3.Call getUserByNameCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/user/{username}" - .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - "application/xml", - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call getUserByNameValidateBeforeCall(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException("Missing the required parameter 'username' when calling getUserByName(Async)"); - } - - return getUserByNameCall(username, _callback); - - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. (required) - * @return User - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - -
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
- */ - public User getUserByName(@javax.annotation.Nonnull String username) throws ApiException { - ApiResponse localVarResp = getUserByNameWithHttpInfo(username); - return localVarResp.getData(); - } - - /** - * Get user by user name - * - * @param username The name that needs to be fetched. Use user1 for testing. (required) - * @return ApiResponse<User> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - - -
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
- */ - public ApiResponse getUserByNameWithHttpInfo(@javax.annotation.Nonnull String username) throws ApiException { - okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Get user by user name (asynchronously) - * - * @param username The name that needs to be fetched. Use user1 for testing. (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - - -
Response Details
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
- */ - public okhttp3.Call getUserByNameAsync(@javax.annotation.Nonnull String username, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = getUserByNameValidateBeforeCall(username, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for loginUser - * @param username The user name for login (required) - * @param password The password for login in clear text (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - -
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
400 Invalid username/password supplied -
- */ - public okhttp3.Call loginUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/user/login"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if (username != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("username", username)); - } - - if (password != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("password", password)); - } - - final String[] localVarAccepts = { - "application/xml", - "application/json" - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call loginUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException("Missing the required parameter 'username' when calling loginUser(Async)"); - } - - // verify the required parameter 'password' is set - if (password == null) { - throw new ApiException("Missing the required parameter 'password' when calling loginUser(Async)"); - } - - return loginUserCall(username, password, _callback); - - } - - /** - * Logs user into the system - * - * @param username The user name for login (required) - * @param password The password for login in clear text (required) - * @return String - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
400 Invalid username/password supplied -
- */ - public String loginUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { - ApiResponse localVarResp = loginUserWithHttpInfo(username, password); - return localVarResp.getData(); - } - - /** - * Logs user into the system - * - * @param username The user name for login (required) - * @param password The password for login in clear text (required) - * @return ApiResponse<String> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
400 Invalid username/password supplied -
- */ - public ApiResponse loginUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password) throws ApiException { - okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, null); - Type localVarReturnType = new TypeToken(){}.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - /** - * Logs user into the system (asynchronously) - * - * @param username The user name for login (required) - * @param password The password for login in clear text (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - -
Response Details
Status Code Description Response Headers
200 successful operation * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication.
* X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
400 Invalid username/password supplied -
- */ - public okhttp3.Call loginUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = loginUserValidateBeforeCall(username, password, _callback); - Type localVarReturnType = new TypeToken(){}.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - /** - * Build call for logoutUser - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - -
Response Details
Status Code Description Response Headers
0 successful operation -
- */ - public okhttp3.Call logoutUserCall(final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/user/logout"; - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "api_key" }; - return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call logoutUserValidateBeforeCall(final ApiCallback _callback) throws ApiException { - return logoutUserCall(_callback); - - } - - /** - * Logs out current logged in user session - * - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - -
Response Details
Status Code Description Response Headers
0 successful operation -
- */ - public void logoutUser() throws ApiException { - logoutUserWithHttpInfo(); - } - - /** - * Logs out current logged in user session - * - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - -
Response Details
Status Code Description Response Headers
0 successful operation -
- */ - public ApiResponse logoutUserWithHttpInfo() throws ApiException { - okhttp3.Call localVarCall = logoutUserValidateBeforeCall(null); - return localVarApiClient.execute(localVarCall); - } - - /** - * Logs out current logged in user session (asynchronously) - * - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - -
Response Details
Status Code Description Response Headers
0 successful operation -
- */ - public okhttp3.Call logoutUserAsync(final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = logoutUserValidateBeforeCall(_callback); - localVarApiClient.executeAsync(localVarCall, _callback); - return localVarCall; - } - /** - * Build call for updateUser - * @param username name that need to be deleted (required) - * @param user Updated user object (required) - * @param _callback Callback for upload/download progress - * @return Call to execute - * @throws ApiException If fail to serialize the request body object - * @http.response.details - - - - - -
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
- */ - public okhttp3.Call updateUserCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { - String basePath = null; - // Operation Servers - String[] localBasePaths = new String[] { }; - - // Determine Base Path to Use - if (localCustomBaseUrl != null){ - basePath = localCustomBaseUrl; - } else if ( localBasePaths.length > 0 ) { - basePath = localBasePaths[localHostIndex]; - } else { - basePath = null; - } - - Object localVarPostBody = user; - - // create path and map variables - String localVarPath = "/user/{username}" - .replace("{" + "username" + "}", localVarApiClient.escapeString(username.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - final String[] localVarAccepts = { - }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - "application/json" - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - if (localVarContentType != null) { - localVarHeaderParams.put("Content-Type", localVarContentType); - } - - String[] localVarAuthNames = new String[] { "api_key" }; - return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call updateUserValidateBeforeCall(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { - // verify the required parameter 'username' is set - if (username == null) { - throw new ApiException("Missing the required parameter 'username' when calling updateUser(Async)"); - } - - // verify the required parameter 'user' is set - if (user == null) { - throw new ApiException("Missing the required parameter 'user' when calling updateUser(Async)"); - } - - return updateUserCall(username, user, _callback); - - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted (required) - * @param user Updated user object (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
- */ - public void updateUser(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { - updateUserWithHttpInfo(username, user); - } - - /** - * Updated user - * This can only be done by the logged in user. - * @param username name that need to be deleted (required) - * @param user Updated user object (required) - * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body - * @http.response.details - - - - - -
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
- */ - public ApiResponse updateUserWithHttpInfo(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user) throws ApiException { - okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, user, null); - return localVarApiClient.execute(localVarCall); - } - - /** - * Updated user (asynchronously) - * This can only be done by the logged in user. - * @param username name that need to be deleted (required) - * @param user Updated user object (required) - * @param _callback The callback to be executed when the API call finishes - * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body object - * @http.response.details - - - - - -
Response Details
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
- */ - public okhttp3.Call updateUserAsync(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull User user, final ApiCallback _callback) throws ApiException { - - okhttp3.Call localVarCall = updateUserValidateBeforeCall(username, user, _callback); - localVarApiClient.executeAsync(localVarCall, _callback); - return localVarCall; - } -} diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/Category.java deleted file mode 100644 index 593f0187b68..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/Category.java +++ /dev/null @@ -1,314 +0,0 @@ -/* - * 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.model; - -import java.util.Objects; -import java.util.Locale; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Locale; - -import org.openapitools.client.JSON; - -/** - * A category for a pet - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") -public class Category { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - @javax.annotation.Nullable - private Long id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nullable - private String name; - - public Category() { - } - - public Category id(@javax.annotation.Nullable Long id) { - this.id = id; - return this; - } - - /** - * Get id - * @return id - */ - @javax.annotation.Nullable - public Long getId() { - return id; - } - - public void setId(@javax.annotation.Nullable Long id) { - this.id = id; - } - - - public Category name(@javax.annotation.Nullable String name) { - this.name = name; - return this; - } - - /** - * Get name - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - - public void setName(@javax.annotation.Nullable String name) { - this.name = name; - } - - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the Category instance itself - */ - public Category putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Category category = (Category) o; - return Objects.equals(this.id, category.id) && - Objects.equals(this.name, category.name)&& - Objects.equals(this.additionalProperties, category.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Category {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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 "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("id", "name")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(0); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to Category - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!Category.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in Category is not found in the empty JSON string", Category.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Category.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Category' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Category.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Category value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty(entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public Category read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - Category instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Category given an JSON string - * - * @param jsonString JSON string - * @return An instance of Category - * @throws IOException if the JSON string is invalid with respect to Category - */ - public static Category fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Category.class); - } - - /** - * Convert an instance of Category to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/ModelApiResponse.java deleted file mode 100644 index d2867669bf9..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ /dev/null @@ -1,343 +0,0 @@ -/* - * 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.model; - -import java.util.Objects; -import java.util.Locale; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Locale; - -import org.openapitools.client.JSON; - -/** - * Describes the result of uploading an image resource - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") -public class ModelApiResponse { - public static final String SERIALIZED_NAME_CODE = "code"; - @SerializedName(SERIALIZED_NAME_CODE) - @javax.annotation.Nullable - private Integer code; - - public static final String SERIALIZED_NAME_TYPE = "type"; - @SerializedName(SERIALIZED_NAME_TYPE) - @javax.annotation.Nullable - private String type; - - public static final String SERIALIZED_NAME_MESSAGE = "message"; - @SerializedName(SERIALIZED_NAME_MESSAGE) - @javax.annotation.Nullable - private String message; - - public ModelApiResponse() { - } - - public ModelApiResponse code(@javax.annotation.Nullable Integer code) { - this.code = code; - return this; - } - - /** - * Get code - * @return code - */ - @javax.annotation.Nullable - public Integer getCode() { - return code; - } - - public void setCode(@javax.annotation.Nullable Integer code) { - this.code = code; - } - - - public ModelApiResponse type(@javax.annotation.Nullable String type) { - this.type = type; - return this; - } - - /** - * Get type - * @return type - */ - @javax.annotation.Nullable - public String getType() { - return type; - } - - public void setType(@javax.annotation.Nullable String type) { - this.type = type; - } - - - public ModelApiResponse message(@javax.annotation.Nullable String message) { - this.message = message; - return this; - } - - /** - * Get message - * @return message - */ - @javax.annotation.Nullable - public String getMessage() { - return message; - } - - public void setMessage(@javax.annotation.Nullable String message) { - this.message = message; - } - - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the ModelApiResponse instance itself - */ - public ModelApiResponse putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ModelApiResponse _apiResponse = (ModelApiResponse) o; - return Objects.equals(this.code, _apiResponse.code) && - Objects.equals(this.type, _apiResponse.type) && - Objects.equals(this.message, _apiResponse.message)&& - Objects.equals(this.additionalProperties, _apiResponse.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(code, type, message, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ModelApiResponse {\n"); - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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 "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("code", "type", "message")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(0); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to ModelApiResponse - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ModelApiResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in ModelApiResponse is not found in the empty JSON string", ModelApiResponse.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); - } - if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!ModelApiResponse.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ModelApiResponse' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(ModelApiResponse.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, ModelApiResponse value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty(entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public ModelApiResponse read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - ModelApiResponse instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - - }.nullSafe(); - } - } - - /** - * Create an instance of ModelApiResponse given an JSON string - * - * @param jsonString JSON string - * @return An instance of ModelApiResponse - * @throws IOException if the JSON string is invalid with respect to ModelApiResponse - */ - public static ModelApiResponse fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ModelApiResponse.class); - } - - /** - * Convert an instance of ModelApiResponse to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/Order.java deleted file mode 100644 index 4a266161387..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/Order.java +++ /dev/null @@ -1,477 +0,0 @@ -/* - * 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.model; - -import java.util.Objects; -import java.util.Locale; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Locale; - -import org.openapitools.client.JSON; - -/** - * An order for a pets from the pet store - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") -public class Order { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - @javax.annotation.Nullable - private Long id; - - public static final String SERIALIZED_NAME_PET_ID = "petId"; - @SerializedName(SERIALIZED_NAME_PET_ID) - @javax.annotation.Nullable - private Long petId; - - public static final String SERIALIZED_NAME_QUANTITY = "quantity"; - @SerializedName(SERIALIZED_NAME_QUANTITY) - @javax.annotation.Nullable - private Integer quantity; - - public static final String SERIALIZED_NAME_SHIP_DATE = "shipDate"; - @SerializedName(SERIALIZED_NAME_SHIP_DATE) - @javax.annotation.Nullable - private OffsetDateTime shipDate; - - /** - * Order Status - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - PLACED("placed"), - - APPROVED("approved"), - - DELIVERED("delivered"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static StatusEnum fromValue(String value) { - for (StatusEnum b : StatusEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public StatusEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return StatusEnum.fromValue(value); - } - } - - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - StatusEnum.fromValue(value); - } - } - - public static final String SERIALIZED_NAME_STATUS = "status"; - @SerializedName(SERIALIZED_NAME_STATUS) - @javax.annotation.Nullable - private StatusEnum status; - - public static final String SERIALIZED_NAME_COMPLETE = "complete"; - @SerializedName(SERIALIZED_NAME_COMPLETE) - @javax.annotation.Nullable - private Boolean complete = false; - - public Order() { - } - - public Order id(@javax.annotation.Nullable Long id) { - this.id = id; - return this; - } - - /** - * Get id - * @return id - */ - @javax.annotation.Nullable - public Long getId() { - return id; - } - - public void setId(@javax.annotation.Nullable Long id) { - this.id = id; - } - - - public Order petId(@javax.annotation.Nullable Long petId) { - this.petId = petId; - return this; - } - - /** - * Get petId - * @return petId - */ - @javax.annotation.Nullable - public Long getPetId() { - return petId; - } - - public void setPetId(@javax.annotation.Nullable Long petId) { - this.petId = petId; - } - - - public Order quantity(@javax.annotation.Nullable Integer quantity) { - this.quantity = quantity; - return this; - } - - /** - * Get quantity - * @return quantity - */ - @javax.annotation.Nullable - public Integer getQuantity() { - return quantity; - } - - public void setQuantity(@javax.annotation.Nullable Integer quantity) { - this.quantity = quantity; - } - - - public Order shipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { - this.shipDate = shipDate; - return this; - } - - /** - * Get shipDate - * @return shipDate - */ - @javax.annotation.Nullable - public OffsetDateTime getShipDate() { - return shipDate; - } - - public void setShipDate(@javax.annotation.Nullable OffsetDateTime shipDate) { - this.shipDate = shipDate; - } - - - public Order status(@javax.annotation.Nullable StatusEnum status) { - this.status = status; - return this; - } - - /** - * Order Status - * @return status - */ - @javax.annotation.Nullable - public StatusEnum getStatus() { - return status; - } - - public void setStatus(@javax.annotation.Nullable StatusEnum status) { - this.status = status; - } - - - public Order complete(@javax.annotation.Nullable Boolean complete) { - this.complete = complete; - return this; - } - - /** - * Get complete - * @return complete - */ - @javax.annotation.Nullable - public Boolean getComplete() { - return complete; - } - - public void setComplete(@javax.annotation.Nullable Boolean complete) { - this.complete = complete; - } - - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the Order instance itself - */ - public Order putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Order order = (Order) o; - return Objects.equals(this.id, order.id) && - Objects.equals(this.petId, order.petId) && - Objects.equals(this.quantity, order.quantity) && - Objects.equals(this.shipDate, order.shipDate) && - Objects.equals(this.status, order.status) && - Objects.equals(this.complete, order.complete)&& - Objects.equals(this.additionalProperties, order.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(id, petId, quantity, shipDate, status, complete, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Order {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" petId: ").append(toIndentedString(petId)).append("\n"); - sb.append(" quantity: ").append(toIndentedString(quantity)).append("\n"); - sb.append(" shipDate: ").append(toIndentedString(shipDate)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" complete: ").append(toIndentedString(complete)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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 "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("id", "petId", "quantity", "shipDate", "status", "complete")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(0); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to Order - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!Order.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in Order is not found in the empty JSON string", Order.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); - } - // validate the optional field `status` - if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { - StatusEnum.validateJsonElement(jsonObj.get("status")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Order.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Order' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Order.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Order value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty(entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public Order read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - Order instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Order given an JSON string - * - * @param jsonString JSON string - * @return An instance of Order - * @throws IOException if the JSON string is invalid with respect to Order - */ - public static Order fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Order.class); - } - - /** - * Convert an instance of Order to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/Pet.java deleted file mode 100644 index 7f7a5984bc4..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/Pet.java +++ /dev/null @@ -1,535 +0,0 @@ -/* - * 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.model; - -import java.util.Objects; -import java.util.Locale; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import org.openapitools.client.model.Category; -import org.openapitools.client.model.Tag; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Locale; - -import org.openapitools.client.JSON; - -/** - * A pet for sale in the pet store - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") -public class Pet { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - @javax.annotation.Nullable - private Long id; - - public static final String SERIALIZED_NAME_CATEGORY = "category"; - @SerializedName(SERIALIZED_NAME_CATEGORY) - @javax.annotation.Nullable - private Category category; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nonnull - private String name; - - public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; - @SerializedName(SERIALIZED_NAME_PHOTO_URLS) - @javax.annotation.Nonnull - private List photoUrls = new ArrayList<>(); - - public static final String SERIALIZED_NAME_TAGS = "tags"; - @SerializedName(SERIALIZED_NAME_TAGS) - @javax.annotation.Nullable - private List tags = new ArrayList<>(); - - /** - * pet status in the store - */ - @JsonAdapter(StatusEnum.Adapter.class) - public enum StatusEnum { - AVAILABLE("available"), - - PENDING("pending"), - - SOLD("sold"); - - private String value; - - StatusEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - - @Override - public String toString() { - return String.valueOf(value); - } - - public static StatusEnum fromValue(String value) { - for (StatusEnum b : StatusEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public StatusEnum read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return StatusEnum.fromValue(value); - } - } - - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - StatusEnum.fromValue(value); - } - } - - public static final String SERIALIZED_NAME_STATUS = "status"; - @Deprecated - @SerializedName(SERIALIZED_NAME_STATUS) - @javax.annotation.Nullable - private StatusEnum status; - - public Pet() { - } - - public Pet id(@javax.annotation.Nullable Long id) { - this.id = id; - return this; - } - - /** - * Get id - * @return id - */ - @javax.annotation.Nullable - public Long getId() { - return id; - } - - public void setId(@javax.annotation.Nullable Long id) { - this.id = id; - } - - - public Pet category(@javax.annotation.Nullable Category category) { - this.category = category; - return this; - } - - /** - * Get category - * @return category - */ - @javax.annotation.Nullable - public Category getCategory() { - return category; - } - - public void setCategory(@javax.annotation.Nullable Category category) { - this.category = category; - } - - - public Pet name(@javax.annotation.Nonnull String name) { - this.name = name; - return this; - } - - /** - * Get name - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(@javax.annotation.Nonnull String name) { - this.name = name; - } - - - public Pet photoUrls(@javax.annotation.Nonnull List photoUrls) { - this.photoUrls = photoUrls; - return this; - } - - public Pet addPhotoUrlsItem(String photoUrlsItem) { - if (this.photoUrls == null) { - this.photoUrls = new ArrayList<>(); - } - this.photoUrls.add(photoUrlsItem); - return this; - } - - /** - * Get photoUrls - * @return photoUrls - */ - @javax.annotation.Nonnull - public List getPhotoUrls() { - return photoUrls; - } - - public void setPhotoUrls(@javax.annotation.Nonnull List photoUrls) { - this.photoUrls = photoUrls; - } - - - public Pet tags(@javax.annotation.Nullable List tags) { - this.tags = tags; - return this; - } - - public Pet addTagsItem(Tag tagsItem) { - if (this.tags == null) { - this.tags = new ArrayList<>(); - } - this.tags.add(tagsItem); - return this; - } - - /** - * Get tags - * @return tags - */ - @javax.annotation.Nullable - public List getTags() { - return tags; - } - - public void setTags(@javax.annotation.Nullable List tags) { - this.tags = tags; - } - - - @Deprecated - public Pet status(@javax.annotation.Nullable StatusEnum status) { - this.status = status; - return this; - } - - /** - * pet status in the store - * @return status - * @deprecated - */ - @Deprecated - @javax.annotation.Nullable - public StatusEnum getStatus() { - return status; - } - - @Deprecated - public void setStatus(@javax.annotation.Nullable StatusEnum status) { - this.status = status; - } - - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the Pet instance itself - */ - public Pet putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Pet pet = (Pet) o; - return Objects.equals(this.id, pet.id) && - Objects.equals(this.category, pet.category) && - Objects.equals(this.name, pet.name) && - Objects.equals(this.photoUrls, pet.photoUrls) && - Objects.equals(this.tags, pet.tags) && - Objects.equals(this.status, pet.status)&& - Objects.equals(this.additionalProperties, pet.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(id, category, name, photoUrls, tags, status, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Pet {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" category: ").append(toIndentedString(category)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n"); - sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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 "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("id", "category", "name", "photoUrls", "tags", "status")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(Arrays.asList("name", "photoUrls")); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to Pet - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!Pet.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in Pet is not found in the empty JSON string", Pet.openapiRequiredFields.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : Pet.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `category` - if (jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) { - Category.validateJsonElement(jsonObj.get("category")); - } - if (!jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); - } - // ensure the required json array is present - if (jsonObj.get("photoUrls") == null) { - throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); - } else if (!jsonObj.get("photoUrls").isJsonArray()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `photoUrls` to be an array in the JSON string but got `%s`", jsonObj.get("photoUrls").toString())); - } - if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { - JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); - if (jsonArraytags != null) { - // ensure the json data is an array - if (!jsonObj.get("tags").isJsonArray()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); - } - - // validate the optional field `tags` (array) - for (int i = 0; i < jsonArraytags.size(); i++) { - Tag.validateJsonElement(jsonArraytags.get(i)); - }; - } - } - if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); - } - // validate the optional field `status` - if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { - StatusEnum.validateJsonElement(jsonObj.get("status")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Pet.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Pet' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Pet.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Pet value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty(entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public Pet read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - Pet instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Pet given an JSON string - * - * @param jsonString JSON string - * @return An instance of Pet - * @throws IOException if the JSON string is invalid with respect to Pet - */ - public static Pet fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Pet.class); - } - - /** - * Convert an instance of Pet to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/Tag.java deleted file mode 100644 index 23543935bc5..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/Tag.java +++ /dev/null @@ -1,314 +0,0 @@ -/* - * 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.model; - -import java.util.Objects; -import java.util.Locale; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Locale; - -import org.openapitools.client.JSON; - -/** - * A tag for a pet - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") -public class Tag { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - @javax.annotation.Nullable - private Long id; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - @javax.annotation.Nullable - private String name; - - public Tag() { - } - - public Tag id(@javax.annotation.Nullable Long id) { - this.id = id; - return this; - } - - /** - * Get id - * @return id - */ - @javax.annotation.Nullable - public Long getId() { - return id; - } - - public void setId(@javax.annotation.Nullable Long id) { - this.id = id; - } - - - public Tag name(@javax.annotation.Nullable String name) { - this.name = name; - return this; - } - - /** - * Get name - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - - public void setName(@javax.annotation.Nullable String name) { - this.name = name; - } - - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the Tag instance itself - */ - public Tag putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Tag tag = (Tag) o; - return Objects.equals(this.id, tag.id) && - Objects.equals(this.name, tag.name)&& - Objects.equals(this.additionalProperties, tag.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(id, name, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Tag {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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 "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("id", "name")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(0); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to Tag - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!Tag.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in Tag is not found in the empty JSON string", Tag.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Tag.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Tag' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Tag.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Tag value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty(entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public Tag read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - Tag instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - - }.nullSafe(); - } - } - - /** - * Create an instance of Tag given an JSON string - * - * @param jsonString JSON string - * @return An instance of Tag - * @throws IOException if the JSON string is invalid with respect to Tag - */ - public static Tag fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, Tag.class); - } - - /** - * Convert an instance of Tag to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/User.java deleted file mode 100644 index a913cb3554f..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/main/java/org/openapitools/client/model/User.java +++ /dev/null @@ -1,485 +0,0 @@ -/* - * 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.model; - -import java.util.Objects; -import java.util.Locale; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Locale; - -import org.openapitools.client.JSON; - -/** - * A User who is purchasing from the pet store - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0-SNAPSHOT") -public class User { - public static final String SERIALIZED_NAME_ID = "id"; - @SerializedName(SERIALIZED_NAME_ID) - @javax.annotation.Nullable - private Long id; - - public static final String SERIALIZED_NAME_USERNAME = "username"; - @SerializedName(SERIALIZED_NAME_USERNAME) - @javax.annotation.Nullable - private String username; - - public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; - @SerializedName(SERIALIZED_NAME_FIRST_NAME) - @javax.annotation.Nullable - private String firstName; - - public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; - @SerializedName(SERIALIZED_NAME_LAST_NAME) - @javax.annotation.Nullable - private String lastName; - - public static final String SERIALIZED_NAME_EMAIL = "email"; - @SerializedName(SERIALIZED_NAME_EMAIL) - @javax.annotation.Nullable - private String email; - - public static final String SERIALIZED_NAME_PASSWORD = "password"; - @SerializedName(SERIALIZED_NAME_PASSWORD) - @javax.annotation.Nullable - private String password; - - public static final String SERIALIZED_NAME_PHONE = "phone"; - @SerializedName(SERIALIZED_NAME_PHONE) - @javax.annotation.Nullable - private String phone; - - public static final String SERIALIZED_NAME_USER_STATUS = "userStatus"; - @SerializedName(SERIALIZED_NAME_USER_STATUS) - @javax.annotation.Nullable - private Integer userStatus; - - public User() { - } - - public User id(@javax.annotation.Nullable Long id) { - this.id = id; - return this; - } - - /** - * Get id - * @return id - */ - @javax.annotation.Nullable - public Long getId() { - return id; - } - - public void setId(@javax.annotation.Nullable Long id) { - this.id = id; - } - - - public User username(@javax.annotation.Nullable String username) { - this.username = username; - return this; - } - - /** - * Get username - * @return username - */ - @javax.annotation.Nullable - public String getUsername() { - return username; - } - - public void setUsername(@javax.annotation.Nullable String username) { - this.username = username; - } - - - public User firstName(@javax.annotation.Nullable String firstName) { - this.firstName = firstName; - return this; - } - - /** - * Get firstName - * @return firstName - */ - @javax.annotation.Nullable - public String getFirstName() { - return firstName; - } - - public void setFirstName(@javax.annotation.Nullable String firstName) { - this.firstName = firstName; - } - - - public User lastName(@javax.annotation.Nullable String lastName) { - this.lastName = lastName; - return this; - } - - /** - * Get lastName - * @return lastName - */ - @javax.annotation.Nullable - public String getLastName() { - return lastName; - } - - public void setLastName(@javax.annotation.Nullable String lastName) { - this.lastName = lastName; - } - - - public User email(@javax.annotation.Nullable String email) { - this.email = email; - return this; - } - - /** - * Get email - * @return email - */ - @javax.annotation.Nullable - public String getEmail() { - return email; - } - - public void setEmail(@javax.annotation.Nullable String email) { - this.email = email; - } - - - public User password(@javax.annotation.Nullable String password) { - this.password = password; - return this; - } - - /** - * Get password - * @return password - */ - @javax.annotation.Nullable - public String getPassword() { - return password; - } - - public void setPassword(@javax.annotation.Nullable String password) { - this.password = password; - } - - - public User phone(@javax.annotation.Nullable String phone) { - this.phone = phone; - return this; - } - - /** - * Get phone - * @return phone - */ - @javax.annotation.Nullable - public String getPhone() { - return phone; - } - - public void setPhone(@javax.annotation.Nullable String phone) { - this.phone = phone; - } - - - public User userStatus(@javax.annotation.Nullable Integer userStatus) { - this.userStatus = userStatus; - return this; - } - - /** - * User Status - * @return userStatus - */ - @javax.annotation.Nullable - public Integer getUserStatus() { - return userStatus; - } - - public void setUserStatus(@javax.annotation.Nullable Integer userStatus) { - this.userStatus = userStatus; - } - - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the User instance itself - */ - public User putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); - } - this.additionalProperties.put(key, value); - return this; - } - - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; - } - return this.additionalProperties.get(key); - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - User user = (User) o; - return Objects.equals(this.id, user.id) && - Objects.equals(this.username, user.username) && - Objects.equals(this.firstName, user.firstName) && - Objects.equals(this.lastName, user.lastName) && - Objects.equals(this.email, user.email) && - Objects.equals(this.password, user.password) && - Objects.equals(this.phone, user.phone) && - Objects.equals(this.userStatus, user.userStatus)&& - Objects.equals(this.additionalProperties, user.additionalProperties); - } - - @Override - public int hashCode() { - return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus, additionalProperties); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class User {\n"); - sb.append(" id: ").append(toIndentedString(id)).append("\n"); - sb.append(" username: ").append(toIndentedString(username)).append("\n"); - sb.append(" firstName: ").append(toIndentedString(firstName)).append("\n"); - sb.append(" lastName: ").append(toIndentedString(lastName)).append("\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" password: ").append(toIndentedString(password)).append("\n"); - sb.append(" phone: ").append(toIndentedString(phone)).append("\n"); - sb.append(" userStatus: ").append(toIndentedString(userStatus)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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 "); - } - - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus")); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(0); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to User - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!User.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("username") != null && !jsonObj.get("username").isJsonNull()) && !jsonObj.get("username").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `username` to be a primitive type in the JSON string but got `%s`", jsonObj.get("username").toString())); - } - if ((jsonObj.get("firstName") != null && !jsonObj.get("firstName").isJsonNull()) && !jsonObj.get("firstName").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `firstName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("firstName").toString())); - } - if ((jsonObj.get("lastName") != null && !jsonObj.get("lastName").isJsonNull()) && !jsonObj.get("lastName").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `lastName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastName").toString())); - } - if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); - } - if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); - } - if ((jsonObj.get("phone") != null && !jsonObj.get("phone").isJsonNull()) && !jsonObj.get("phone").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `phone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!User.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'User' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(User.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, User value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty(entry.getKey(), (Character) entry.getValue()); - else { - JsonElement jsonElement = gson.toJsonTree(entry.getValue()); - if (jsonElement.isJsonArray()) { - obj.add(entry.getKey(), jsonElement.getAsJsonArray()); - } else { - obj.add(entry.getKey(), jsonElement.getAsJsonObject()); - } - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public User read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - User instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - - }.nullSafe(); - } - } - - /** - * Create an instance of User given an JSON string - * - * @param jsonString JSON string - * @return An instance of User - * @throws IOException if the JSON string is invalid with respect to User - */ - public static User fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, User.class); - } - - /** - * Convert an instance of User to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } -} - diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/api/StoreApiTest.java deleted file mode 100644 index 3ca20d0b210..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/api/StoreApiTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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.api; - -import org.openapitools.client.ApiException; -import org.openapitools.client.model.Order; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * API tests for StoreApi - */ -@Disabled -public class StoreApiTest { - - private final StoreApi api = new StoreApi(); - - /** - * Delete purchase order by ID - * - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * - * @throws ApiException if the Api call fails - */ - @Test - public void deleteOrderTest() throws ApiException { - String orderId = null; - api.deleteOrder(orderId); - // TODO: test validations - } - - /** - * Returns pet inventories by status - * - * Returns a map of status codes to quantities - * - * @throws ApiException if the Api call fails - */ - @Test - public void getInventoryTest() throws ApiException { - Map response = api.getInventory(); - // TODO: test validations - } - - /** - * Find purchase order by ID - * - * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - * - * @throws ApiException if the Api call fails - */ - @Test - public void getOrderByIdTest() throws ApiException { - Long orderId = null; - Order response = api.getOrderById(orderId); - // TODO: test validations - } - - /** - * Place an order for a pet - * - * - * - * @throws ApiException if the Api call fails - */ - @Test - public void placeOrderTest() throws ApiException { - Order order = null; - Order response = api.placeOrder(order); - // TODO: test validations - } - -} diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/api/UserApiTest.java deleted file mode 100644 index a46743c4435..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/api/UserApiTest.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * 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.api; - -import org.openapitools.client.ApiException; -import java.time.OffsetDateTime; -import org.openapitools.client.model.User; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * API tests for UserApi - */ -@Disabled -public class UserApiTest { - - private final UserApi api = new UserApi(); - - /** - * Create user - * - * This can only be done by the logged in user. - * - * @throws ApiException if the Api call fails - */ - @Test - public void createUserTest() throws ApiException { - User user = null; - api.createUser(user); - // TODO: test validations - } - - /** - * Creates list of users with given input array - * - * - * - * @throws ApiException if the Api call fails - */ - @Test - public void createUsersWithArrayInputTest() throws ApiException { - List user = null; - api.createUsersWithArrayInput(user); - // TODO: test validations - } - - /** - * Creates list of users with given input array - * - * - * - * @throws ApiException if the Api call fails - */ - @Test - public void createUsersWithListInputTest() throws ApiException { - List user = null; - api.createUsersWithListInput(user); - // TODO: test validations - } - - /** - * Delete user - * - * This can only be done by the logged in user. - * - * @throws ApiException if the Api call fails - */ - @Test - public void deleteUserTest() throws ApiException { - String username = null; - api.deleteUser(username); - // TODO: test validations - } - - /** - * Get user by user name - * - * - * - * @throws ApiException if the Api call fails - */ - @Test - public void getUserByNameTest() throws ApiException { - String username = null; - User response = api.getUserByName(username); - // TODO: test validations - } - - /** - * Logs user into the system - * - * - * - * @throws ApiException if the Api call fails - */ - @Test - public void loginUserTest() throws ApiException { - String username = null; - String password = null; - String response = api.loginUser(username, password); - // TODO: test validations - } - - /** - * Logs out current logged in user session - * - * - * - * @throws ApiException if the Api call fails - */ - @Test - public void logoutUserTest() throws ApiException { - api.logoutUser(); - // TODO: test validations - } - - /** - * Updated user - * - * This can only be done by the logged in user. - * - * @throws ApiException if the Api call fails - */ - @Test - public void updateUserTest() throws ApiException { - String username = null; - User user = null; - api.updateUser(username, user); - // TODO: test validations - } - -} diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/CategoryTest.java b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/CategoryTest.java deleted file mode 100644 index 0609d116a38..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/CategoryTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -/** - * Model tests for Category - */ -public class CategoryTest { - private final Category model = new Category(); - - /** - * Model tests for Category - */ - @Test - public void testCategory() { - // TODO: test Category - } - - /** - * Test the property 'id' - */ - @Test - public void idTest() { - // TODO: test id - } - - /** - * Test the property 'name' - */ - @Test - public void nameTest() { - // TODO: test name - } - -} diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java deleted file mode 100644 index 6018546d053..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/ModelApiResponseTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -/** - * Model tests for ModelApiResponse - */ -public class ModelApiResponseTest { - private final ModelApiResponse model = new ModelApiResponse(); - - /** - * Model tests for ModelApiResponse - */ - @Test - public void testModelApiResponse() { - // TODO: test ModelApiResponse - } - - /** - * Test the property 'code' - */ - @Test - public void codeTest() { - // TODO: test code - } - - /** - * Test the property 'type' - */ - @Test - public void typeTest() { - // TODO: test type - } - - /** - * Test the property 'message' - */ - @Test - public void messageTest() { - // TODO: test message - } - -} diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/OrderTest.java b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/OrderTest.java deleted file mode 100644 index bde30a7233d..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/OrderTest.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -/** - * Model tests for Order - */ -public class OrderTest { - private final Order model = new Order(); - - /** - * Model tests for Order - */ - @Test - public void testOrder() { - // TODO: test Order - } - - /** - * Test the property 'id' - */ - @Test - public void idTest() { - // TODO: test id - } - - /** - * Test the property 'petId' - */ - @Test - public void petIdTest() { - // TODO: test petId - } - - /** - * Test the property 'quantity' - */ - @Test - public void quantityTest() { - // TODO: test quantity - } - - /** - * Test the property 'shipDate' - */ - @Test - public void shipDateTest() { - // TODO: test shipDate - } - - /** - * Test the property 'status' - */ - @Test - public void statusTest() { - // TODO: test status - } - - /** - * Test the property 'complete' - */ - @Test - public void completeTest() { - // TODO: test complete - } - -} diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/PetTest.java b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/PetTest.java deleted file mode 100644 index 1dbb74a230c..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/PetTest.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import org.openapitools.client.model.Category; -import org.openapitools.client.model.Tag; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -/** - * Model tests for Pet - */ -public class PetTest { - private final Pet model = new Pet(); - - /** - * Model tests for Pet - */ - @Test - public void testPet() { - // TODO: test Pet - } - - /** - * Test the property 'id' - */ - @Test - public void idTest() { - // TODO: test id - } - - /** - * Test the property 'category' - */ - @Test - public void categoryTest() { - // TODO: test category - } - - /** - * Test the property 'name' - */ - @Test - public void nameTest() { - // TODO: test name - } - - /** - * Test the property 'photoUrls' - */ - @Test - public void photoUrlsTest() { - // TODO: test photoUrls - } - - /** - * Test the property 'tags' - */ - @Test - public void tagsTest() { - // TODO: test tags - } - - /** - * Test the property 'status' - */ - @Test - public void statusTest() { - // TODO: test status - } - -} diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/TagTest.java b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/TagTest.java deleted file mode 100644 index 0a89a2bc6f4..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/TagTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -/** - * Model tests for Tag - */ -public class TagTest { - private final Tag model = new Tag(); - - /** - * Model tests for Tag - */ - @Test - public void testTag() { - // TODO: test Tag - } - - /** - * Test the property 'id' - */ - @Test - public void idTest() { - // TODO: test id - } - - /** - * Test the property 'name' - */ - @Test - public void nameTest() { - // TODO: test name - } - -} diff --git a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/UserTest.java b/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/UserTest.java deleted file mode 100644 index 42c042309ce..00000000000 --- a/samples/client/petstore/java/okhttp-gson-3.1-duplicated-operationid/src/test/java/org/openapitools/client/model/UserTest.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.util.Arrays; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -/** - * Model tests for User - */ -public class UserTest { - private final User model = new User(); - - /** - * Model tests for User - */ - @Test - public void testUser() { - // TODO: test User - } - - /** - * Test the property 'id' - */ - @Test - public void idTest() { - // TODO: test id - } - - /** - * Test the property 'username' - */ - @Test - public void usernameTest() { - // TODO: test username - } - - /** - * Test the property 'firstName' - */ - @Test - public void firstNameTest() { - // TODO: test firstName - } - - /** - * Test the property 'lastName' - */ - @Test - public void lastNameTest() { - // TODO: test lastName - } - - /** - * Test the property 'email' - */ - @Test - public void emailTest() { - // TODO: test email - } - - /** - * Test the property 'password' - */ - @Test - public void passwordTest() { - // TODO: test password - } - - /** - * Test the property 'phone' - */ - @Test - public void phoneTest() { - // TODO: test phone - } - - /** - * Test the property 'userStatus' - */ - @Test - public void userStatusTest() { - // TODO: test userStatus - } - -}