Merge remote-tracking branch 'origin/master' into 230_merge_master

This commit is contained in:
wing328
2017-06-05 23:27:11 +08:00
1289 changed files with 22425 additions and 48047 deletions

View File

@@ -0,0 +1 @@
2.3.0-SNAPSHOT

View File

@@ -180,4 +180,17 @@ public interface FakeApi extends ApiClient.Api {
return this;
}
}
/**
* test json serialization of form data
*
* @param param field1 (required)
* @param param2 field2 (required)
*/
@RequestLine("GET /fake/jsonFormData")
@Headers({
"Content-Type: application/json",
"Accept: application/json",
})
void testJsonFormData(@Param("param") String param, @Param("param2") String param2);
}

View File

@@ -41,12 +41,12 @@ public class EnumArrays {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@@ -79,12 +79,12 @@ public class EnumArrays {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -35,12 +35,12 @@ public enum EnumClass {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -42,12 +42,12 @@ public class EnumTest {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@@ -80,12 +80,12 @@ public class EnumTest {
this.value = value;
}
@JsonValue
public Integer getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@@ -118,12 +118,12 @@ public class EnumTest {
this.value = value;
}
@JsonValue
public Double getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -45,12 +45,12 @@ public class MapTest {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -54,12 +54,12 @@ public class Order {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -35,12 +35,12 @@ public enum OuterEnum {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -60,12 +60,12 @@ public class Pet {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -0,0 +1 @@
2.3.0-SNAPSHOT

View File

@@ -11,6 +11,7 @@ Method | HTTP request | Description
[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
[**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data
<a name="fakeOuterBooleanSerialize"></a>
@@ -375,3 +376,49 @@ No authorization required
- **Content-Type**: */*
- **Accept**: */*
<a name="testJsonFormData"></a>
# **testJsonFormData**
> testJsonFormData(param, param2)
test json serialization of form data
### Example
```java
// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.FakeApi;
FakeApi apiInstance = new FakeApi();
String param = "param_example"; // String | field1
String param2 = "param2_example"; // String | field2
try {
apiInstance.testJsonFormData(param, param2);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testJsonFormData");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**param** | **String**| field1 |
**param2** | **String**| field2 |
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined

View File

@@ -386,6 +386,56 @@ if (enumQueryDouble != null)
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
}
/**
* test json serialization of form data
*
* @param param field1 (required)
* @param param2 field2 (required)
* @throws ApiException if fails to make API call
*/
public void testJsonFormData(String param, String param2) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'param' is set
if (param == null) {
throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData");
}
// verify the required parameter 'param2' is set
if (param2 == null) {
throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData");
}
// create path and map variables
String localVarPath = "/fake/jsonFormData";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
if (param != null)
localVarFormParams.put("param", param);
if (param2 != null)
localVarFormParams.put("param2", param2);
final String[] localVarAccepts = {
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
}
}

View File

@@ -41,12 +41,12 @@ public class EnumArrays {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@@ -79,12 +79,12 @@ public class EnumArrays {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -35,12 +35,12 @@ public enum EnumClass {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -42,12 +42,12 @@ public class EnumTest {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@@ -80,12 +80,12 @@ public class EnumTest {
this.value = value;
}
@JsonValue
public Integer getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@@ -118,12 +118,12 @@ public class EnumTest {
this.value = value;
}
@JsonValue
public Double getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -45,12 +45,12 @@ public class MapTest {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -54,12 +54,12 @@ public class Order {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -35,12 +35,12 @@ public enum OuterEnum {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -60,12 +60,12 @@ public class Pet {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -1,20 +1,17 @@
package io.swagger.client.model;
import java.io.StringWriter;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;
import java.util.List;
import org.junit.Test;
import io.swagger.client.Pair;
import org.junit.*;
import static org.junit.Assert.*;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.SerializationFeature.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public class EnumValueTest {
@Test
public void testEnumClass() {
assertEquals(EnumClass._ABC.toString(), "_abc");
@@ -31,13 +28,19 @@ public class EnumValueTest {
enumTest.setEnumNumber(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1);
assertEquals(EnumTest.EnumStringEnum.UPPER.toString(), "UPPER");
assertEquals(EnumTest.EnumStringEnum.UPPER.getValue(), "UPPER");
assertEquals(EnumTest.EnumStringEnum.LOWER.toString(), "lower");
assertEquals(EnumTest.EnumStringEnum.LOWER.getValue(), "lower");
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_1.toString(), "1");
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_1.getValue() == 1);
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.toString(), "-1");
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.getValue() == -1);
assertEquals(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.toString(), "1.1");
assertTrue(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.getValue() == 1.1);
assertEquals(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.toString(), "-1.2");
assertTrue(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.getValue() == -1.2);
try {
// test serialization (object => json)
@@ -45,7 +48,7 @@ public class EnumValueTest {
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
ObjectWriter ow = mapper.writer();
String json = ow.writeValueAsString(enumTest);
assertEquals(json, "{\"enum_string\":\"lower\",\"enum_integer\":\"1\",\"enum_number\":\"1.1\",\"outerEnum\":null}");
assertEquals(json, "{\"enum_string\":\"lower\",\"enum_integer\":1,\"enum_number\":1.1,\"outerEnum\":null}");
// test deserialization (json => object)
EnumTest fromString = mapper.readValue(json, EnumTest.class);
@@ -56,7 +59,5 @@ public class EnumValueTest {
} catch (Exception e) {
fail("Exception thrown during serialization/deserialzation of JSON: " + e.getMessage());
}
}
}

View File

@@ -1 +1 @@
2.2.3-SNAPSHOT
2.3.0-SNAPSHOT

View File

@@ -11,6 +11,7 @@ Method | HTTP request | Description
[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
[**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data
<a name="fakeOuterBooleanSerialize"></a>
@@ -375,3 +376,49 @@ No authorization required
- **Content-Type**: */*
- **Accept**: */*
<a name="testJsonFormData"></a>
# **testJsonFormData**
> testJsonFormData(param, param2)
test json serialization of form data
### Example
```java
// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.FakeApi;
FakeApi apiInstance = new FakeApi();
String param = "param_example"; // String | field1
String param2 = "param2_example"; // String | field2
try {
apiInstance.testJsonFormData(param, param2);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testJsonFormData");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**param** | **String**| field1 |
**param2** | **String**| field2 |
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined

View File

@@ -372,6 +372,56 @@ if (enumQueryDouble != null)
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
}
/**
* test json serialization of form data
*
* @param param field1 (required)
* @param param2 field2 (required)
* @throws ApiException if fails to make API call
*/
public void testJsonFormData(String param, String param2) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'param' is set
if (param == null) {
throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData");
}
// verify the required parameter 'param2' is set
if (param2 == null) {
throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData");
}
// create path and map variables
String localVarPath = "/fake/jsonFormData";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
if (param != null)
localVarFormParams.put("param", param);
if (param2 != null)
localVarFormParams.put("param2", param2);
final String[] localVarAccepts = {
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
}
}

View File

@@ -41,12 +41,12 @@ public class EnumArrays {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@@ -79,12 +79,12 @@ public class EnumArrays {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -35,12 +35,12 @@ public enum EnumClass {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -42,12 +42,12 @@ public class EnumTest {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@@ -80,12 +80,12 @@ public class EnumTest {
this.value = value;
}
@JsonValue
public Integer getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@@ -118,12 +118,12 @@ public class EnumTest {
this.value = value;
}
@JsonValue
public Double getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -45,12 +45,12 @@ public class MapTest {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -54,12 +54,12 @@ public class Order {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -35,12 +35,12 @@ public enum OuterEnum {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -60,12 +60,12 @@ public class Pet {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -0,0 +1 @@
2.3.0-SNAPSHOT

View File

@@ -11,6 +11,7 @@ Method | HTTP request | Description
[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
[**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data
<a name="fakeOuterBooleanSerialize"></a>
@@ -375,3 +376,49 @@ No authorization required
- **Content-Type**: */*
- **Accept**: */*
<a name="testJsonFormData"></a>
# **testJsonFormData**
> testJsonFormData(param, param2)
test json serialization of form data
### Example
```java
// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.FakeApi;
FakeApi apiInstance = new FakeApi();
String param = "param_example"; // String | field1
String param2 = "param2_example"; // String | field2
try {
apiInstance.testJsonFormData(param, param2);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testJsonFormData");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**param** | **String**| field1 |
**param2** | **String**| field2 |
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined

View File

@@ -372,6 +372,56 @@ if (enumQueryDouble != null)
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
}
/**
* test json serialization of form data
*
* @param param field1 (required)
* @param param2 field2 (required)
* @throws ApiException if fails to make API call
*/
public void testJsonFormData(String param, String param2) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'param' is set
if (param == null) {
throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData");
}
// verify the required parameter 'param2' is set
if (param2 == null) {
throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData");
}
// create path and map variables
String localVarPath = "/fake/jsonFormData";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
if (param != null)
localVarFormParams.put("param", param);
if (param2 != null)
localVarFormParams.put("param2", param2);
final String[] localVarAccepts = {
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
}
}

View File

@@ -41,12 +41,12 @@ public class EnumArrays {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@@ -79,12 +79,12 @@ public class EnumArrays {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -35,12 +35,12 @@ public enum EnumClass {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -42,12 +42,12 @@ public class EnumTest {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@@ -80,12 +80,12 @@ public class EnumTest {
this.value = value;
}
@JsonValue
public Integer getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@@ -118,12 +118,12 @@ public class EnumTest {
this.value = value;
}
@JsonValue
public Double getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -45,12 +45,12 @@ public class MapTest {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -54,12 +54,12 @@ public class Order {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -35,12 +35,12 @@ public enum OuterEnum {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -60,12 +60,12 @@ public class Pet {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -1 +1 @@
2.2.3-SNAPSHOT
2.3.0-SNAPSHOT

View File

@@ -11,6 +11,7 @@ Method | HTTP request | Description
[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
[**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data
<a name="fakeOuterBooleanSerialize"></a>
@@ -375,3 +376,49 @@ No authorization required
- **Content-Type**: */*
- **Accept**: */*
<a name="testJsonFormData"></a>
# **testJsonFormData**
> testJsonFormData(param, param2)
test json serialization of form data
### Example
```java
// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.FakeApi;
FakeApi apiInstance = new FakeApi();
String param = "param_example"; // String | field1
String param2 = "param2_example"; // String | field2
try {
apiInstance.testJsonFormData(param, param2);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testJsonFormData");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**param** | **String**| field1 |
**param2** | **String**| field2 |
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined

View File

@@ -372,6 +372,56 @@ if (enumQueryDouble != null)
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
}
/**
* test json serialization of form data
*
* @param param field1 (required)
* @param param2 field2 (required)
* @throws ApiException if fails to make API call
*/
public void testJsonFormData(String param, String param2) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'param' is set
if (param == null) {
throw new ApiException(400, "Missing the required parameter 'param' when calling testJsonFormData");
}
// verify the required parameter 'param2' is set
if (param2 == null) {
throw new ApiException(400, "Missing the required parameter 'param2' when calling testJsonFormData");
}
// create path and map variables
String localVarPath = "/fake/jsonFormData";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
if (param != null)
localVarFormParams.put("param", param);
if (param2 != null)
localVarFormParams.put("param2", param2);
final String[] localVarAccepts = {
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
}
}

View File

@@ -41,12 +41,12 @@ public class EnumArrays {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@@ -79,12 +79,12 @@ public class EnumArrays {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -35,12 +35,12 @@ public enum EnumClass {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -42,12 +42,12 @@ public class EnumTest {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@@ -80,12 +80,12 @@ public class EnumTest {
this.value = value;
}
@JsonValue
public Integer getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}
@@ -118,12 +118,12 @@ public class EnumTest {
this.value = value;
}
@JsonValue
public Double getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -45,12 +45,12 @@ public class MapTest {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -54,12 +54,12 @@ public class Order {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -35,12 +35,12 @@ public enum OuterEnum {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -60,12 +60,12 @@ public class Pet {
this.value = value;
}
@JsonValue
public String getValue() {
return value;
}
@Override
@JsonValue
public String toString() {
return String.valueOf(value);
}

View File

@@ -1,20 +1,17 @@
package io.swagger.client.model;
import java.io.StringWriter;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;
import java.util.List;
import org.junit.Test;
import io.swagger.client.Pair;
import org.junit.*;
import static org.junit.Assert.*;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.SerializationFeature.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public class EnumValueTest {
@Test
public void testEnumClass() {
assertEquals(EnumClass._ABC.toString(), "_abc");
@@ -31,13 +28,19 @@ public class EnumValueTest {
enumTest.setEnumNumber(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1);
assertEquals(EnumTest.EnumStringEnum.UPPER.toString(), "UPPER");
assertEquals(EnumTest.EnumStringEnum.UPPER.getValue(), "UPPER");
assertEquals(EnumTest.EnumStringEnum.LOWER.toString(), "lower");
assertEquals(EnumTest.EnumStringEnum.LOWER.getValue(), "lower");
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_1.toString(), "1");
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_1.getValue() == 1);
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.toString(), "-1");
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.getValue() == -1);
assertEquals(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.toString(), "1.1");
assertTrue(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.getValue() == 1.1);
assertEquals(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.toString(), "-1.2");
assertTrue(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.getValue() == -1.2);
try {
// test serialization (object => json)
@@ -45,7 +48,7 @@ public class EnumValueTest {
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
ObjectWriter ow = mapper.writer();
String json = ow.writeValueAsString(enumTest);
assertEquals(json, "{\"enum_string\":\"lower\",\"enum_integer\":\"1\",\"enum_number\":\"1.1\",\"outerEnum\":null}");
assertEquals(json, "{\"enum_string\":\"lower\",\"enum_integer\":1,\"enum_number\":1.1,\"outerEnum\":null}");
// test deserialization (json => object)
EnumTest fromString = mapper.readValue(json, EnumTest.class);
@@ -56,7 +59,5 @@ public class EnumValueTest {
} catch (Exception e) {
fail("Exception thrown during serialization/deserialzation of JSON: " + e.getMessage());
}
}
}

View File

@@ -11,6 +11,7 @@ Method | HTTP request | Description
[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
[**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data
<a name="fakeOuterBooleanSerialize"></a>
@@ -375,3 +376,49 @@ No authorization required
- **Content-Type**: */*
- **Accept**: */*
<a name="testJsonFormData"></a>
# **testJsonFormData**
> testJsonFormData(param, param2)
test json serialization of form data
### Example
```java
// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.FakeApi;
FakeApi apiInstance = new FakeApi();
String param = "param_example"; // String | field1
String param2 = "param2_example"; // String | field2
try {
apiInstance.testJsonFormData(param, param2);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testJsonFormData");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**param** | **String**| field1 |
**param2** | **String**| field2 |
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined

View File

@@ -1039,4 +1039,138 @@ public class FakeApi {
apiClient.executeAsync(call, callback);
return call;
}
/**
* Build call for testJsonFormData
* @param param field1 (required)
* @param param2 field2 (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call testJsonFormDataCall(String param, String param2, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/fake/jsonFormData";
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
if (param != null)
localVarFormParams.put("param", param);
if (param2 != null)
localVarFormParams.put("param2", param2);
final String[] localVarAccepts = {
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call testJsonFormDataValidateBeforeCall(String param, String param2, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'param' is set
if (param == null) {
throw new ApiException("Missing the required parameter 'param' when calling testJsonFormData(Async)");
}
// verify the required parameter 'param2' is set
if (param2 == null) {
throw new ApiException("Missing the required parameter 'param2' when calling testJsonFormData(Async)");
}
com.squareup.okhttp.Call call = testJsonFormDataCall(param, param2, progressListener, progressRequestListener);
return call;
}
/**
* test json serialization of form data
*
* @param param field1 (required)
* @param param2 field2 (required)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void testJsonFormData(String param, String param2) throws ApiException {
testJsonFormDataWithHttpInfo(param, param2);
}
/**
* test json serialization of form data
*
* @param param field1 (required)
* @param param2 field2 (required)
* @return ApiResponse&lt;Void&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> testJsonFormDataWithHttpInfo(String param, String param2) throws ApiException {
com.squareup.okhttp.Call call = testJsonFormDataValidateBeforeCall(param, param2, null, null);
return apiClient.execute(call);
}
/**
* test json serialization of form data (asynchronously)
*
* @param param field1 (required)
* @param param2 field2 (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
*/
public com.squareup.okhttp.Call testJsonFormDataAsync(String param, String param2, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = testJsonFormDataValidateBeforeCall(param, param2, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
}
}

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import android.os.Parcelable;
import android.os.Parcel;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

View File

@@ -14,10 +14,15 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.client.model.ReadOnlyFirst;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import android.os.Parcelable;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import android.os.Parcelable;
import android.os.Parcel;

View File

@@ -14,10 +14,15 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.client.model.Animal;
import java.io.IOException;
import android.os.Parcelable;
import android.os.Parcel;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import android.os.Parcelable;
import android.os.Parcel;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import android.os.Parcelable;
import android.os.Parcel;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import android.os.Parcelable;
import android.os.Parcel;

View File

@@ -14,10 +14,15 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.client.model.Animal;
import java.io.IOException;
import android.os.Parcelable;
import android.os.Parcel;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import android.os.Parcelable;
@@ -30,11 +35,10 @@ public class EnumArrays implements Parcelable {
/**
* Gets or Sets justSymbol
*/
@JsonAdapter(JustSymbolEnum.Adapter.class)
public enum JustSymbolEnum {
@SerializedName(">=")
GREATER_THAN_OR_EQUAL_TO(">="),
@SerializedName("$")
DOLLAR("$");
private String value;
@@ -51,6 +55,28 @@ public class EnumArrays implements Parcelable {
public String toString() {
return String.valueOf(value);
}
public static JustSymbolEnum fromValue(String text) {
for (JustSymbolEnum b : JustSymbolEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<JustSymbolEnum> {
@Override
public void write(final JsonWriter jsonWriter, final JustSymbolEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public JustSymbolEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return JustSymbolEnum.fromValue(String.valueOf(value));
}
}
}
@SerializedName("just_symbol")
@@ -59,11 +85,10 @@ public class EnumArrays implements Parcelable {
/**
* Gets or Sets arrayEnum
*/
@JsonAdapter(ArrayEnumEnum.Adapter.class)
public enum ArrayEnumEnum {
@SerializedName("fish")
FISH("fish"),
@SerializedName("crab")
CRAB("crab");
private String value;
@@ -80,6 +105,28 @@ public class EnumArrays implements Parcelable {
public String toString() {
return String.valueOf(value);
}
public static ArrayEnumEnum fromValue(String text) {
for (ArrayEnumEnum b : ArrayEnumEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<ArrayEnumEnum> {
@Override
public void write(final JsonWriter jsonWriter, final ArrayEnumEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public ArrayEnumEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return ArrayEnumEnum.fromValue(String.valueOf(value));
}
}
}
@SerializedName("array_enum")

View File

@@ -18,19 +18,22 @@ import com.google.gson.annotations.SerializedName;
import android.os.Parcelable;
import android.os.Parcel;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* Gets or Sets EnumClass
*/
@JsonAdapter(EnumClass.Adapter.class)
public enum EnumClass {
@SerializedName("_abc")
_ABC("_abc"),
@SerializedName("-efg")
_EFG("-efg"),
@SerializedName("(xyz)")
_XYZ_("(xyz)");
private String value;
@@ -47,5 +50,27 @@ public enum EnumClass {
public String toString() {
return String.valueOf(value);
}
public static EnumClass fromValue(String text) {
for (EnumClass b : EnumClass.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<EnumClass> {
@Override
public void write(final JsonWriter jsonWriter, final EnumClass enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public EnumClass read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return EnumClass.fromValue(String.valueOf(value));
}
}
}

View File

@@ -14,10 +14,15 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.client.model.OuterEnum;
import java.io.IOException;
import android.os.Parcelable;
import android.os.Parcel;
@@ -29,14 +34,12 @@ public class EnumTest implements Parcelable {
/**
* Gets or Sets enumString
*/
@JsonAdapter(EnumStringEnum.Adapter.class)
public enum EnumStringEnum {
@SerializedName("UPPER")
UPPER("UPPER"),
@SerializedName("lower")
LOWER("lower"),
@SerializedName("")
EMPTY("");
private String value;
@@ -53,6 +56,28 @@ public class EnumTest implements Parcelable {
public String toString() {
return String.valueOf(value);
}
public static EnumStringEnum fromValue(String text) {
for (EnumStringEnum b : EnumStringEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<EnumStringEnum> {
@Override
public void write(final JsonWriter jsonWriter, final EnumStringEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public EnumStringEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return EnumStringEnum.fromValue(String.valueOf(value));
}
}
}
@SerializedName("enum_string")
@@ -61,11 +86,10 @@ public class EnumTest implements Parcelable {
/**
* Gets or Sets enumInteger
*/
@JsonAdapter(EnumIntegerEnum.Adapter.class)
public enum EnumIntegerEnum {
@SerializedName("1")
NUMBER_1(1),
@SerializedName("-1")
NUMBER_MINUS_1(-1);
private Integer value;
@@ -82,6 +106,28 @@ public class EnumTest implements Parcelable {
public String toString() {
return String.valueOf(value);
}
public static EnumIntegerEnum fromValue(String text) {
for (EnumIntegerEnum b : EnumIntegerEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<EnumIntegerEnum> {
@Override
public void write(final JsonWriter jsonWriter, final EnumIntegerEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public EnumIntegerEnum read(final JsonReader jsonReader) throws IOException {
Integer value = jsonReader.nextInt();
return EnumIntegerEnum.fromValue(String.valueOf(value));
}
}
}
@SerializedName("enum_integer")
@@ -90,11 +136,10 @@ public class EnumTest implements Parcelable {
/**
* Gets or Sets enumNumber
*/
@JsonAdapter(EnumNumberEnum.Adapter.class)
public enum EnumNumberEnum {
@SerializedName("1.1")
NUMBER_1_DOT_1(1.1),
@SerializedName("-1.2")
NUMBER_MINUS_1_DOT_2(-1.2);
private Double value;
@@ -111,6 +156,28 @@ public class EnumTest implements Parcelable {
public String toString() {
return String.valueOf(value);
}
public static EnumNumberEnum fromValue(String text) {
for (EnumNumberEnum b : EnumNumberEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<EnumNumberEnum> {
@Override
public void write(final JsonWriter jsonWriter, final EnumNumberEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public EnumNumberEnum read(final JsonReader jsonReader) throws IOException {
Double value = jsonReader.nextDouble();
return EnumNumberEnum.fromValue(String.valueOf(value));
}
}
}
@SerializedName("enum_number")

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.UUID;
import org.threeten.bp.LocalDate;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import android.os.Parcelable;
import android.os.Parcel;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -34,11 +39,10 @@ public class MapTest implements Parcelable {
/**
* Gets or Sets inner
*/
@JsonAdapter(InnerEnum.Adapter.class)
public enum InnerEnum {
@SerializedName("UPPER")
UPPER("UPPER"),
@SerializedName("lower")
LOWER("lower");
private String value;
@@ -55,6 +59,28 @@ public class MapTest implements Parcelable {
public String toString() {
return String.valueOf(value);
}
public static InnerEnum fromValue(String text) {
for (InnerEnum b : InnerEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<InnerEnum> {
@Override
public void write(final JsonWriter jsonWriter, final InnerEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public InnerEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return InnerEnum.fromValue(String.valueOf(value));
}
}
}
@SerializedName("map_of_enum_string")

View File

@@ -14,10 +14,15 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.client.model.Animal;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import android.os.Parcelable;
import android.os.Parcel;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import android.os.Parcelable;
import android.os.Parcel;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import android.os.Parcelable;
import android.os.Parcel;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import android.os.Parcelable;
import android.os.Parcel;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.math.BigDecimal;
import android.os.Parcelable;
import android.os.Parcel;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import org.threeten.bp.OffsetDateTime;
import android.os.Parcelable;
import android.os.Parcel;
@@ -41,14 +46,12 @@ public class Order implements Parcelable {
/**
* Order Status
*/
@JsonAdapter(StatusEnum.Adapter.class)
public enum StatusEnum {
@SerializedName("placed")
PLACED("placed"),
@SerializedName("approved")
APPROVED("approved"),
@SerializedName("delivered")
DELIVERED("delivered");
private String value;
@@ -65,6 +68,28 @@ public class Order implements Parcelable {
public String toString() {
return String.valueOf(value);
}
public static StatusEnum fromValue(String text) {
for (StatusEnum b : StatusEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<StatusEnum> {
@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(String.valueOf(value));
}
}
}
@SerializedName("status")

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.math.BigDecimal;
import android.os.Parcelable;
import android.os.Parcel;

View File

@@ -18,19 +18,22 @@ import com.google.gson.annotations.SerializedName;
import android.os.Parcelable;
import android.os.Parcel;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* Gets or Sets OuterEnum
*/
@JsonAdapter(OuterEnum.Adapter.class)
public enum OuterEnum {
@SerializedName("placed")
PLACED("placed"),
@SerializedName("approved")
APPROVED("approved"),
@SerializedName("delivered")
DELIVERED("delivered");
private String value;
@@ -47,5 +50,27 @@ public enum OuterEnum {
public String toString() {
return String.valueOf(value);
}
public static OuterEnum fromValue(String text) {
for (OuterEnum b : OuterEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<OuterEnum> {
@Override
public void write(final JsonWriter jsonWriter, final OuterEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public OuterEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return OuterEnum.fromValue(String.valueOf(value));
}
}
}

View File

@@ -14,11 +14,16 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.client.model.Category;
import io.swagger.client.model.Tag;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import android.os.Parcelable;
@@ -47,14 +52,12 @@ public class Pet implements Parcelable {
/**
* pet status in the store
*/
@JsonAdapter(StatusEnum.Adapter.class)
public enum StatusEnum {
@SerializedName("available")
AVAILABLE("available"),
@SerializedName("pending")
PENDING("pending"),
@SerializedName("sold")
SOLD("sold");
private String value;
@@ -71,6 +74,28 @@ public class Pet implements Parcelable {
public String toString() {
return String.valueOf(value);
}
public static StatusEnum fromValue(String text) {
for (StatusEnum b : StatusEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<StatusEnum> {
@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(String.valueOf(value));
}
}
}
@SerializedName("status")

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import android.os.Parcelable;
import android.os.Parcel;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import android.os.Parcelable;
import android.os.Parcel;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import android.os.Parcelable;
import android.os.Parcel;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import android.os.Parcelable;
import android.os.Parcel;

View File

@@ -11,6 +11,7 @@ Method | HTTP request | Description
[**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \&quot;client\&quot; model
[**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
[**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters
[**testJsonFormData**](FakeApi.md#testJsonFormData) | **GET** /fake/jsonFormData | test json serialization of form data
<a name="fakeOuterBooleanSerialize"></a>
@@ -375,3 +376,49 @@ No authorization required
- **Content-Type**: */*
- **Accept**: */*
<a name="testJsonFormData"></a>
# **testJsonFormData**
> testJsonFormData(param, param2)
test json serialization of form data
### Example
```java
// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.FakeApi;
FakeApi apiInstance = new FakeApi();
String param = "param_example"; // String | field1
String param2 = "param2_example"; // String | field2
try {
apiInstance.testJsonFormData(param, param2);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testJsonFormData");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**param** | **String**| field1 |
**param2** | **String**| field2 |
### Return type
null (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined

View File

@@ -1039,4 +1039,138 @@ public class FakeApi {
apiClient.executeAsync(call, callback);
return call;
}
/**
* Build call for testJsonFormData
* @param param field1 (required)
* @param param2 field2 (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call testJsonFormDataCall(String param, String param2, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/fake/jsonFormData";
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
if (param != null)
localVarFormParams.put("param", param);
if (param2 != null)
localVarFormParams.put("param2", param2);
final String[] localVarAccepts = {
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call testJsonFormDataValidateBeforeCall(String param, String param2, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'param' is set
if (param == null) {
throw new ApiException("Missing the required parameter 'param' when calling testJsonFormData(Async)");
}
// verify the required parameter 'param2' is set
if (param2 == null) {
throw new ApiException("Missing the required parameter 'param2' when calling testJsonFormData(Async)");
}
com.squareup.okhttp.Call call = testJsonFormDataCall(param, param2, progressListener, progressRequestListener);
return call;
}
/**
* test json serialization of form data
*
* @param param field1 (required)
* @param param2 field2 (required)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void testJsonFormData(String param, String param2) throws ApiException {
testJsonFormDataWithHttpInfo(param, param2);
}
/**
* test json serialization of form data
*
* @param param field1 (required)
* @param param2 field2 (required)
* @return ApiResponse&lt;Void&gt;
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse<Void> testJsonFormDataWithHttpInfo(String param, String param2) throws ApiException {
com.squareup.okhttp.Call call = testJsonFormDataValidateBeforeCall(param, param2, null, null);
return apiClient.execute(call);
}
/**
* test json serialization of form data (asynchronously)
*
* @param param field1 (required)
* @param param2 field2 (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
*/
public com.squareup.okhttp.Call testJsonFormDataAsync(String param, String param2, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = testJsonFormDataValidateBeforeCall(param, param2, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
}
}

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
/**
* Animal

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

View File

@@ -14,10 +14,15 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.client.model.ReadOnlyFirst;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
/**
* Capitalization

View File

@@ -14,10 +14,15 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.client.model.Animal;
import java.io.IOException;
/**
* Cat

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
/**
* Category

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
/**
* Model for testing model with \&quot;_class\&quot; property

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
/**
* Client

View File

@@ -14,10 +14,15 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.client.model.Animal;
import java.io.IOException;
/**
* Dog

View File

@@ -14,9 +14,14 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -28,11 +33,10 @@ public class EnumArrays {
/**
* Gets or Sets justSymbol
*/
@JsonAdapter(JustSymbolEnum.Adapter.class)
public enum JustSymbolEnum {
@SerializedName(">=")
GREATER_THAN_OR_EQUAL_TO(">="),
@SerializedName("$")
DOLLAR("$");
private String value;
@@ -49,6 +53,28 @@ public class EnumArrays {
public String toString() {
return String.valueOf(value);
}
public static JustSymbolEnum fromValue(String text) {
for (JustSymbolEnum b : JustSymbolEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<JustSymbolEnum> {
@Override
public void write(final JsonWriter jsonWriter, final JustSymbolEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public JustSymbolEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return JustSymbolEnum.fromValue(String.valueOf(value));
}
}
}
@SerializedName("just_symbol")
@@ -57,11 +83,10 @@ public class EnumArrays {
/**
* Gets or Sets arrayEnum
*/
@JsonAdapter(ArrayEnumEnum.Adapter.class)
public enum ArrayEnumEnum {
@SerializedName("fish")
FISH("fish"),
@SerializedName("crab")
CRAB("crab");
private String value;
@@ -78,6 +103,28 @@ public class EnumArrays {
public String toString() {
return String.valueOf(value);
}
public static ArrayEnumEnum fromValue(String text) {
for (ArrayEnumEnum b : ArrayEnumEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<ArrayEnumEnum> {
@Override
public void write(final JsonWriter jsonWriter, final ArrayEnumEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public ArrayEnumEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return ArrayEnumEnum.fromValue(String.valueOf(value));
}
}
}
@SerializedName("array_enum")

View File

@@ -16,19 +16,22 @@ package io.swagger.client.model;
import java.util.Objects;
import com.google.gson.annotations.SerializedName;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* Gets or Sets EnumClass
*/
@JsonAdapter(EnumClass.Adapter.class)
public enum EnumClass {
@SerializedName("_abc")
_ABC("_abc"),
@SerializedName("-efg")
_EFG("-efg"),
@SerializedName("(xyz)")
_XYZ_("(xyz)");
private String value;
@@ -45,5 +48,27 @@ public enum EnumClass {
public String toString() {
return String.valueOf(value);
}
public static EnumClass fromValue(String text) {
for (EnumClass b : EnumClass.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<EnumClass> {
@Override
public void write(final JsonWriter jsonWriter, final EnumClass enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public EnumClass read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return EnumClass.fromValue(String.valueOf(value));
}
}
}

View File

@@ -14,10 +14,15 @@
package io.swagger.client.model;
import java.util.Objects;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.client.model.OuterEnum;
import java.io.IOException;
/**
* EnumTest
@@ -27,14 +32,12 @@ public class EnumTest {
/**
* Gets or Sets enumString
*/
@JsonAdapter(EnumStringEnum.Adapter.class)
public enum EnumStringEnum {
@SerializedName("UPPER")
UPPER("UPPER"),
@SerializedName("lower")
LOWER("lower"),
@SerializedName("")
EMPTY("");
private String value;
@@ -51,6 +54,28 @@ public class EnumTest {
public String toString() {
return String.valueOf(value);
}
public static EnumStringEnum fromValue(String text) {
for (EnumStringEnum b : EnumStringEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<EnumStringEnum> {
@Override
public void write(final JsonWriter jsonWriter, final EnumStringEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public EnumStringEnum read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return EnumStringEnum.fromValue(String.valueOf(value));
}
}
}
@SerializedName("enum_string")
@@ -59,11 +84,10 @@ public class EnumTest {
/**
* Gets or Sets enumInteger
*/
@JsonAdapter(EnumIntegerEnum.Adapter.class)
public enum EnumIntegerEnum {
@SerializedName("1")
NUMBER_1(1),
@SerializedName("-1")
NUMBER_MINUS_1(-1);
private Integer value;
@@ -80,6 +104,28 @@ public class EnumTest {
public String toString() {
return String.valueOf(value);
}
public static EnumIntegerEnum fromValue(String text) {
for (EnumIntegerEnum b : EnumIntegerEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<EnumIntegerEnum> {
@Override
public void write(final JsonWriter jsonWriter, final EnumIntegerEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public EnumIntegerEnum read(final JsonReader jsonReader) throws IOException {
Integer value = jsonReader.nextInt();
return EnumIntegerEnum.fromValue(String.valueOf(value));
}
}
}
@SerializedName("enum_integer")
@@ -88,11 +134,10 @@ public class EnumTest {
/**
* Gets or Sets enumNumber
*/
@JsonAdapter(EnumNumberEnum.Adapter.class)
public enum EnumNumberEnum {
@SerializedName("1.1")
NUMBER_1_DOT_1(1.1),
@SerializedName("-1.2")
NUMBER_MINUS_1_DOT_2(-1.2);
private Double value;
@@ -109,6 +154,28 @@ public class EnumTest {
public String toString() {
return String.valueOf(value);
}
public static EnumNumberEnum fromValue(String text) {
for (EnumNumberEnum b : EnumNumberEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
public static class Adapter extends TypeAdapter<EnumNumberEnum> {
@Override
public void write(final JsonWriter jsonWriter, final EnumNumberEnum enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public EnumNumberEnum read(final JsonReader jsonReader) throws IOException {
Double value = jsonReader.nextDouble();
return EnumNumberEnum.fromValue(String.valueOf(value));
}
}
}
@SerializedName("enum_number")

Some files were not shown because too many files have changed in this diff Show More