[Java] Threetenbp dates support (#4029)

* [feign] add threetenbp support for feign clients

* [okhttp] add threetenbp support for okhttp clients

* [jersey] add threetenbp support for jersey clients

* [retrofit2] add threetenbp support for retrofit2 clients

* [spring] add threetenbp support for spring generators

* add a workaround in tests for a bug in the petstore

The petstore doesn't manage fractional digits of dates correctly when there are less than 3
This commit is contained in:
Christophe Bornet
2016-11-04 10:55:16 +01:00
committed by wing328
parent c1e6f00242
commit 70d93883cf
336 changed files with 6397 additions and 1821 deletions

View File

@@ -107,7 +107,7 @@ dependencies {
compile "com.fasterxml.jackson.core:jackson-core:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version",
compile "com.brsanthu:migbase64:2.2"
testCompile "junit:junit:$junit_version"
}

View File

@@ -13,10 +13,10 @@ lazy val root = (project in file(".")).
"org.glassfish.jersey.core" % "jersey-client" % "2.22.2",
"org.glassfish.jersey.media" % "jersey-media-multipart" % "2.22.2",
"org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.22.2",
"com.fasterxml.jackson.core" % "jackson-core" % "2.7.5",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.5",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.7.5",
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.7.5",
"com.fasterxml.jackson.core" % "jackson-core" % "2.7.5" % "compile",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.5" % "compile",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.7.5" % "compile",
"com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.7.5" % "compile",
"com.brsanthu" % "migbase64" % "2.2",
"junit" % "junit" % "4.12" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test"

View File

@@ -54,7 +54,7 @@ No authorization required
<a name="testEndpointParameters"></a>
# **testEndpointParameters**
> testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password)
> testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback)
Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
@@ -90,8 +90,9 @@ byte[] binary = B; // byte[] | None
LocalDate date = new LocalDate(); // LocalDate | None
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
String password = "password_example"; // String | None
String paramCallback = "paramCallback_example"; // String | None
try {
apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password);
apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback);
} catch (ApiException e) {
System.err.println("Exception when calling FakeApi#testEndpointParameters");
e.printStackTrace();
@@ -115,6 +116,7 @@ Name | Type | Description | Notes
**date** | **LocalDate**| None | [optional]
**dateTime** | **OffsetDateTime**| None | [optional]
**password** | **String**| None | [optional]
**paramCallback** | **String**| None | [optional]
### Return type

View File

@@ -0,0 +1,52 @@
# FakeclassnametagsApi
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**testClassname**](FakeclassnametagsApi.md#testClassname) | **PATCH** /fake_classname_test | To test class name in snake case
<a name="testClassname"></a>
# **testClassname**
> Client testClassname(body)
To test class name in snake case
### Example
```java
// Import classes:
//import io.swagger.client.ApiException;
//import io.swagger.client.api.FakeclassnametagsApi;
FakeclassnametagsApi apiInstance = new FakeclassnametagsApi();
Client body = new Client(); // Client | client model
try {
Client result = apiInstance.testClassname(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling FakeclassnametagsApi#testClassname");
e.printStackTrace();
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Client**](Client.md)| client model |
### Return type
[**Client**](Client.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json

View File

@@ -1,90 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -39,7 +39,6 @@ import java.io.File;
import java.io.UnsupportedEncodingException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -70,14 +69,7 @@ public class ApiClient {
json = new JSON();
httpClient = buildHttpClient(debugging);
// Use RFC3339 format for date and datetime.
// See http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14
this.dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
// Use UTC as the default time zone.
this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
this.json.setDateFormat((DateFormat) dateFormat.clone());
this.dateFormat = new RFC3339DateFormat();
// Set default User-Agent.
setUserAgent("Swagger-Codegen/1.0.0/java");

View File

@@ -2,7 +2,7 @@ package io.swagger.client;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.datatype.jsr310.*;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import java.text.DateFormat;
@@ -19,6 +19,7 @@ public class JSON implements ContextResolver<ObjectMapper> {
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
mapper.setDateFormat(new RFC3339DateFormat());
mapper.registerModule(new JavaTimeModule());
}

View File

@@ -0,0 +1,44 @@
/*
* Swagger Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.swagger.client;
import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
import com.fasterxml.jackson.databind.util.ISO8601Utils;
import java.text.FieldPosition;
import java.util.Date;
public class RFC3339DateFormat extends ISO8601DateFormat {
// Same as ISO8601DateFormat but serializing milliseconds.
@Override
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
String value = ISO8601Utils.format(date, true);
toAppendTo.append(value);
return toAppendTo;
}
}

View File

@@ -94,9 +94,10 @@ public class FakeApi {
* @param date None (optional)
* @param dateTime None (optional)
* @param password None (optional)
* @param paramCallback None (optional)
* @throws ApiException if fails to make API call
*/
public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, LocalDate date, OffsetDateTime dateTime, String password) throws ApiException {
public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'number' is set
@@ -155,6 +156,8 @@ if (dateTime != null)
localVarFormParams.put("dateTime", dateTime);
if (password != null)
localVarFormParams.put("password", password);
if (paramCallback != null)
localVarFormParams.put("callback", paramCallback);
final String[] localVarAccepts = {
"application/xml; charset=utf-8", "application/json; charset=utf-8"

View File

@@ -0,0 +1,78 @@
package io.swagger.client.api;
import io.swagger.client.ApiException;
import io.swagger.client.ApiClient;
import io.swagger.client.Configuration;
import io.swagger.client.Pair;
import javax.ws.rs.core.GenericType;
import io.swagger.client.model.Client;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class FakeclassnametagsApi {
private ApiClient apiClient;
public FakeclassnametagsApi() {
this(Configuration.getDefaultApiClient());
}
public FakeclassnametagsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* To test class name in snake case
*
* @param body client model (required)
* @return Client
* @throws ApiException if fails to make API call
*/
public Client testClassname(Client body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling testClassname");
}
// create path and map variables
String localVarPath = "/fake_classname_test".replaceAll("\\{format\\}","json");
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
GenericType<Client> localVarReturnType = new GenericType<Client>() {};
return apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}

View File

@@ -34,12 +34,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* AdditionalPropertiesClass
*/
public class AdditionalPropertiesClass {
public class AdditionalPropertiesClass {
@JsonProperty("map_property")
private Map<String, String> mapProperty = new HashMap<String, String>();
@@ -132,5 +131,6 @@ public class AdditionalPropertiesClass {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Animal
*/
public class Animal {
public class Animal {
@JsonProperty("className")
private String className = null;
@@ -119,5 +118,6 @@ public class Animal {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -30,12 +30,11 @@ import io.swagger.client.model.Animal;
import java.util.ArrayList;
import java.util.List;
/**
* AnimalFarm
*/
public class AnimalFarm extends ArrayList<Animal> {
public class AnimalFarm extends ArrayList<Animal> {
@Override
public boolean equals(java.lang.Object o) {
@@ -72,5 +71,6 @@ public class AnimalFarm extends ArrayList<Animal> {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -34,12 +34,11 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* ArrayOfArrayOfNumberOnly
*/
public class ArrayOfArrayOfNumberOnly {
public class ArrayOfArrayOfNumberOnly {
@JsonProperty("ArrayArrayNumber")
private List<List<BigDecimal>> arrayArrayNumber = new ArrayList<List<BigDecimal>>();
@@ -104,5 +103,6 @@ public class ArrayOfArrayOfNumberOnly {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -34,12 +34,11 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* ArrayOfNumberOnly
*/
public class ArrayOfNumberOnly {
public class ArrayOfNumberOnly {
@JsonProperty("ArrayNumber")
private List<BigDecimal> arrayNumber = new ArrayList<BigDecimal>();
@@ -104,5 +103,6 @@ public class ArrayOfNumberOnly {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -34,12 +34,11 @@ import io.swagger.client.model.ReadOnlyFirst;
import java.util.ArrayList;
import java.util.List;
/**
* ArrayTest
*/
public class ArrayTest {
public class ArrayTest {
@JsonProperty("array_of_string")
private List<String> arrayOfString = new ArrayList<String>();
@@ -160,5 +159,6 @@ public class ArrayTest {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -32,12 +32,11 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.client.model.Animal;
/**
* Cat
*/
public class Cat extends Animal {
public class Cat extends Animal {
@JsonProperty("declawed")
private Boolean declawed = null;
@@ -98,5 +97,6 @@ public class Cat extends Animal {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Category
*/
public class Category {
public class Category {
@JsonProperty("id")
private Long id = null;
@@ -119,5 +118,6 @@ public class Category {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Client
*/
public class Client {
public class Client {
@JsonProperty("client")
private String client = null;
@@ -96,5 +95,6 @@ public class Client {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -32,12 +32,11 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.client.model.Animal;
/**
* Dog
*/
public class Dog extends Animal {
public class Dog extends Animal {
@JsonProperty("breed")
private String breed = null;
@@ -98,5 +97,6 @@ public class Dog extends Animal {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -33,12 +33,11 @@ import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
* EnumArrays
*/
public class EnumArrays {
public class EnumArrays {
/**
* Gets or Sets justSymbol
*/
@@ -186,5 +185,6 @@ public class EnumArrays {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -27,7 +27,6 @@ package io.swagger.client.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonCreator;
/**

View File

@@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* EnumTest
*/
public class EnumTest {
public class EnumTest {
/**
* Gets or Sets enumString
*/
@@ -232,5 +231,6 @@ public class EnumTest {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -35,12 +35,11 @@ import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.UUID;
/**
* FormatTest
*/
public class FormatTest {
public class FormatTest {
@JsonProperty("integer")
private Integer integer = null;
@@ -386,5 +385,6 @@ public class FormatTest {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* HasOnlyReadOnly
*/
public class HasOnlyReadOnly {
public class HasOnlyReadOnly {
@JsonProperty("bar")
private String bar = null;
@@ -101,5 +100,6 @@ public class HasOnlyReadOnly {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -34,12 +34,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* MapTest
*/
public class MapTest {
public class MapTest {
@JsonProperty("map_map_of_string")
private Map<String, Map<String, String>> mapMapOfString = new HashMap<String, Map<String, String>>();
@@ -162,5 +161,6 @@ public class MapTest {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -37,12 +37,11 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
* MixedPropertiesAndAdditionalPropertiesClass
*/
public class MixedPropertiesAndAdditionalPropertiesClass {
public class MixedPropertiesAndAdditionalPropertiesClass {
@JsonProperty("uuid")
private UUID uuid = null;
@@ -153,5 +152,6 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -31,13 +31,12 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Model for testing model name starting with number
*/
@ApiModel(description = "Model for testing model name starting with number")
public class Model200Response {
public class Model200Response {
@JsonProperty("name")
private Integer name = null;
@@ -120,5 +119,6 @@ public class Model200Response {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* ModelApiResponse
*/
public class ModelApiResponse {
public class ModelApiResponse {
@JsonProperty("code")
private Integer code = null;
@@ -142,5 +141,6 @@ public class ModelApiResponse {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -31,13 +31,12 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Model for testing reserved words
*/
@ApiModel(description = "Model for testing reserved words")
public class ModelReturn {
public class ModelReturn {
@JsonProperty("return")
private Integer _return = null;
@@ -97,5 +96,6 @@ public class ModelReturn {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -31,13 +31,12 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Model for testing model name same as property name
*/
@ApiModel(description = "Model for testing model name same as property name")
public class Name {
public class Name {
@JsonProperty("name")
private Integer name = null;
@@ -148,5 +147,6 @@ public class Name {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -32,12 +32,11 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
/**
* NumberOnly
*/
public class NumberOnly {
public class NumberOnly {
@JsonProperty("JustNumber")
private BigDecimal justNumber = null;
@@ -97,5 +96,6 @@ public class NumberOnly {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -32,12 +32,11 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.OffsetDateTime;
/**
* Order
*/
public class Order {
public class Order {
@JsonProperty("id")
private Long id = null;
@@ -244,5 +243,6 @@ public class Order {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -35,12 +35,11 @@ import io.swagger.client.model.Tag;
import java.util.ArrayList;
import java.util.List;
/**
* Pet
*/
public class Pet {
public class Pet {
@JsonProperty("id")
private Long id = null;
@@ -257,5 +256,6 @@ public class Pet {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* ReadOnlyFirst
*/
public class ReadOnlyFirst {
public class ReadOnlyFirst {
@JsonProperty("bar")
private String bar = null;
@@ -110,5 +109,6 @@ public class ReadOnlyFirst {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* SpecialModelName
*/
public class SpecialModelName {
public class SpecialModelName {
@JsonProperty("$special[property.name]")
private Long specialPropertyName = null;
@@ -96,5 +95,6 @@ public class SpecialModelName {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Tag
*/
public class Tag {
public class Tag {
@JsonProperty("id")
private Long id = null;
@@ -119,5 +118,6 @@ public class Tag {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -31,12 +31,11 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* User
*/
public class User {
public class User {
@JsonProperty("id")
private Long id = null;
@@ -257,5 +256,6 @@ public class User {
}
return o.toString().replace("\n", "\n ");
}
}

View File

@@ -0,0 +1,61 @@
/*
* Swagger Petstore
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.swagger.client.api;
import io.swagger.client.ApiException;
import io.swagger.client.model.Client;
import org.junit.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* API tests for FakeclassnametagsApi
*/
public class FakeclassnametagsApiTest {
private final FakeclassnametagsApi api = new FakeclassnametagsApi();
/**
* To test class name in snake case
*
*
*
* @throws ApiException
* if the Api call fails
*/
@Test
public void testClassnameTest() throws ApiException {
Client body = null;
// Client response = api.testClassname(body);
// TODO: test validations
}
}

View File

@@ -81,9 +81,10 @@ public class StoreApiTest {
private Order createOrder() {
Order order = new Order();
order.setPetId(new Long(200));
order.setQuantity(new Integer(13));
order.setShipDate(OffsetDateTime.now());
order.setPetId(200L);
order.setQuantity(13);
//Ensure 3 fractional digits because of a bug in the petstore server
order.setShipDate(OffsetDateTime.now().withNano(123000000));
order.setStatus(Order.StatusEnum.PLACED);
order.setComplete(true);