(this, dtf);
+ }
+
+ @Override
+ public T deserialize(JsonParser parser, DeserializationContext context) throws IOException {
+ //NOTE: Timestamps contain no timezone info, and are always in configured TZ. Only
+ //string values have to be adjusted to the configured TZ.
+ switch (parser.getCurrentTokenId()) {
+ case JsonTokenId.ID_NUMBER_FLOAT: {
+ BigDecimal value = parser.getDecimalValue();
+ long seconds = value.longValue();
+ int nanoseconds = DecimalUtils.extractNanosecondDecimal(value, seconds);
+ return fromNanoseconds.apply(new FromDecimalArguments(
+ seconds, nanoseconds, getZone(context)));
+ }
+
+ case JsonTokenId.ID_NUMBER_INT: {
+ long timestamp = parser.getLongValue();
+ if (context.isEnabled(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)) {
+ return this.fromNanoseconds.apply(new FromDecimalArguments(
+ timestamp, 0, this.getZone(context)
+ ));
+ }
+ return this.fromMilliseconds.apply(new FromIntegerArguments(
+ timestamp, this.getZone(context)
+ ));
+ }
+
+ case JsonTokenId.ID_STRING: {
+ String string = parser.getText().trim();
+ if (string.length() == 0) {
+ return null;
+ }
+ if (string.endsWith("+0000")) {
+ string = string.substring(0, string.length() - 5) + "Z";
+ }
+ T value;
+ try {
+ TemporalAccessor acc = _formatter.parse(string);
+ value = parsedToValue.apply(acc);
+ if (context.isEnabled(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)) {
+ return adjust.apply(value, this.getZone(context));
+ }
+ } catch (DateTimeException e) {
+ throw _peelDTE(e);
+ }
+ return value;
+ }
+ }
+ throw context.mappingException("Expected type float, integer, or string.");
+ }
+
+ private ZoneId getZone(DeserializationContext context) {
+ // Instants are always in UTC, so don't waste compute cycles
+ return (_valueClass == Instant.class) ? null : DateTimeUtils.timeZoneToZoneId(context.getTimeZone());
+ }
+
+ private static class FromIntegerArguments {
+ public final long value;
+ public final ZoneId zoneId;
+
+ private FromIntegerArguments(long value, ZoneId zoneId) {
+ this.value = value;
+ this.zoneId = zoneId;
+ }
+ }
+
+ private static class FromDecimalArguments {
+ public final long integer;
+ public final int fraction;
+ public final ZoneId zoneId;
+
+ private FromDecimalArguments(long integer, int fraction, ZoneId zoneId) {
+ this.integer = integer;
+ this.fraction = fraction;
+ this.zoneId = zoneId;
+ }
+ }
+}
diff --git a/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/api/FakeApi.java
index add04d01dee2..b948228e33b5 100644
--- a/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/api/FakeApi.java
+++ b/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/api/FakeApi.java
@@ -4,8 +4,8 @@ import io.swagger.client.ApiClient;
import java.math.BigDecimal;
import io.swagger.client.model.Client;
-import org.joda.time.DateTime;
-import org.joda.time.LocalDate;
+import org.threeten.bp.LocalDate;
+import org.threeten.bp.OffsetDateTime;
import java.util.ArrayList;
import java.util.HashMap;
@@ -105,7 +105,7 @@ public class FakeApi {
* @param paramCallback None
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
- 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, DateTime dateTime, String password, String paramCallback) throws RestClientException {
+ 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 RestClientException {
Object postBody = null;
// verify the required parameter 'number' is set
diff --git a/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java
new file mode 100644
index 000000000000..272bcc563c6a
--- /dev/null
+++ b/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java
@@ -0,0 +1,84 @@
+package io.swagger.client.api;
+
+import io.swagger.client.ApiClient;
+
+import io.swagger.client.model.Client;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.RestClientException;
+import org.springframework.web.client.HttpClientErrorException;
+import org.springframework.web.util.UriComponentsBuilder;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+
+
+@Component("io.swagger.client.api.FakeClassnameTags123Api")
+public class FakeClassnameTags123Api {
+ private ApiClient apiClient;
+
+ public FakeClassnameTags123Api() {
+ this(new ApiClient());
+ }
+
+ @Autowired
+ public FakeClassnameTags123Api(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
+ *
+ * 200 - successful operation
+ * @param body client model
+ * @return Client
+ * @throws RestClientException if an error occurs while attempting to invoke the API
+ */
+ public Client testClassname(Client body) throws RestClientException {
+ Object postBody = body;
+
+ // verify the required parameter 'body' is set
+ if (body == null) {
+ throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling testClassname");
+ }
+
+ String path = UriComponentsBuilder.fromPath("/fake_classname_test").build().toUriString();
+
+ final MultiValueMap queryParams = new LinkedMultiValueMap();
+ final HttpHeaders headerParams = new HttpHeaders();
+ final MultiValueMap formParams = new LinkedMultiValueMap();
+
+ final String[] accepts = {
+ "application/json"
+ };
+ final List accept = apiClient.selectHeaderAccept(accepts);
+ final String[] contentTypes = {
+ "application/json"
+ };
+ final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
+
+ String[] authNames = new String[] { };
+
+ ParameterizedTypeReference returnType = new ParameterizedTypeReference() {};
+ return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
+ }
+}
diff --git a/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/model/FormatTest.java
index c2aa5f35fed0..3897095d8402 100644
--- a/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/model/FormatTest.java
+++ b/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/model/FormatTest.java
@@ -21,8 +21,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.UUID;
-import org.joda.time.DateTime;
-import org.joda.time.LocalDate;
+import org.threeten.bp.LocalDate;
+import org.threeten.bp.OffsetDateTime;
/**
* FormatTest
@@ -60,7 +60,7 @@ public class FormatTest {
private LocalDate date = null;
@JsonProperty("dateTime")
- private DateTime dateTime = null;
+ private OffsetDateTime dateTime = null;
@JsonProperty("uuid")
private UUID uuid = null;
@@ -258,7 +258,7 @@ public class FormatTest {
this.date = date;
}
- public FormatTest dateTime(DateTime dateTime) {
+ public FormatTest dateTime(OffsetDateTime dateTime) {
this.dateTime = dateTime;
return this;
}
@@ -268,11 +268,11 @@ public class FormatTest {
* @return dateTime
**/
@ApiModelProperty(value = "")
- public DateTime getDateTime() {
+ public OffsetDateTime getDateTime() {
return dateTime;
}
- public void setDateTime(DateTime dateTime) {
+ public void setDateTime(OffsetDateTime dateTime) {
this.dateTime = dateTime;
}
diff --git a/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java
index 9cd0ca678b89..229669da93c8 100644
--- a/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java
+++ b/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/model/MixedPropertiesAndAdditionalPropertiesClass.java
@@ -24,7 +24,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import org.joda.time.DateTime;
+import org.threeten.bp.OffsetDateTime;
/**
* MixedPropertiesAndAdditionalPropertiesClass
@@ -35,7 +35,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
private UUID uuid = null;
@JsonProperty("dateTime")
- private DateTime dateTime = null;
+ private OffsetDateTime dateTime = null;
@JsonProperty("map")
private Map map = null;
@@ -58,7 +58,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
this.uuid = uuid;
}
- public MixedPropertiesAndAdditionalPropertiesClass dateTime(DateTime dateTime) {
+ public MixedPropertiesAndAdditionalPropertiesClass dateTime(OffsetDateTime dateTime) {
this.dateTime = dateTime;
return this;
}
@@ -68,11 +68,11 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
* @return dateTime
**/
@ApiModelProperty(value = "")
- public DateTime getDateTime() {
+ public OffsetDateTime getDateTime() {
return dateTime;
}
- public void setDateTime(DateTime dateTime) {
+ public void setDateTime(OffsetDateTime dateTime) {
this.dateTime = dateTime;
}
diff --git a/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/model/Order.java
index 5ca9dcda14e8..2bed74ffa8c9 100644
--- a/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/model/Order.java
+++ b/samples/client/petstore/java/resttemplate/src/main/java/io/swagger/client/model/Order.java
@@ -19,7 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
-import org.joda.time.DateTime;
+import org.threeten.bp.OffsetDateTime;
/**
* Order
@@ -36,7 +36,7 @@ public class Order {
private Integer quantity = null;
@JsonProperty("shipDate")
- private DateTime shipDate = null;
+ private OffsetDateTime shipDate = null;
/**
* Order Status
@@ -135,7 +135,7 @@ public class Order {
this.quantity = quantity;
}
- public Order shipDate(DateTime shipDate) {
+ public Order shipDate(OffsetDateTime shipDate) {
this.shipDate = shipDate;
return this;
}
@@ -145,11 +145,11 @@ public class Order {
* @return shipDate
**/
@ApiModelProperty(value = "")
- public DateTime getShipDate() {
+ public OffsetDateTime getShipDate() {
return shipDate;
}
- public void setShipDate(DateTime shipDate) {
+ public void setShipDate(OffsetDateTime shipDate) {
this.shipDate = shipDate;
}
diff --git a/samples/client/petstore/java/resttemplate/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/resttemplate/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java
new file mode 100644
index 000000000000..641e4fc7008a
--- /dev/null
+++ b/samples/client/petstore/java/resttemplate/src/test/java/io/swagger/client/api/FakeClassnameTags123ApiTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+
+package io.swagger.client.api;
+
+import io.swagger.client.model.Client;
+import org.junit.Test;
+import org.junit.Ignore;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * API tests for FakeClassnameTags123Api
+ */
+@Ignore
+public class FakeClassnameTags123ApiTest {
+
+ private final FakeClassnameTags123Api api = new FakeClassnameTags123Api();
+
+
+ /**
+ * To test class name in snake case
+ *
+ *
+ *
+ * @throws ApiException
+ * if the Api call fails
+ */
+ @Test
+ public void testClassnameTest() {
+ Client body = null;
+ Client response = api.testClassname(body);
+
+ // TODO: test validations
+ }
+
+}