mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-08 03:06:08 +00:00
Issue 6172 (#6173)
* Changes to allow field names as examples for string properties and multiple items in array during example generation * Reverting the version to 2.3.0-SNAPSHOT and autogenerated petstore files
This commit is contained in:
@@ -29,6 +29,11 @@ import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.client.RestClientException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
import org.threeten.bp.*;
|
||||
import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
@@ -308,6 +313,12 @@ public class ApiClient {
|
||||
*/
|
||||
public ApiClient setDateFormat(DateFormat dateFormat) {
|
||||
this.dateFormat = dateFormat;
|
||||
for(HttpMessageConverter converter:restTemplate.getMessageConverters()){
|
||||
if(converter instanceof AbstractJackson2HttpMessageConverter){
|
||||
ObjectMapper mapper = ((AbstractJackson2HttpMessageConverter)converter).getObjectMapper();
|
||||
mapper.setDateFormat(dateFormat);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -563,6 +574,16 @@ public class ApiClient {
|
||||
|
||||
RestTemplate restTemplate = new RestTemplate(messageConverters);
|
||||
|
||||
for(HttpMessageConverter converter:restTemplate.getMessageConverters()){
|
||||
if(converter instanceof AbstractJackson2HttpMessageConverter){
|
||||
ObjectMapper mapper = ((AbstractJackson2HttpMessageConverter)converter).getObjectMapper();
|
||||
ThreeTenModule module = new ThreeTenModule();
|
||||
module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT);
|
||||
module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME);
|
||||
module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME);
|
||||
mapper.registerModule(module);
|
||||
}
|
||||
}
|
||||
// This allows us to read the response more than once - Necessary for debugging.
|
||||
restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(restTemplate.getRequestFactory()));
|
||||
return restTemplate;
|
||||
@@ -636,4 +657,4 @@ public class ApiClient {
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
package io.swagger.client;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonTokenId;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
import com.fasterxml.jackson.datatype.threetenbp.DateTimeUtils;
|
||||
import com.fasterxml.jackson.datatype.threetenbp.DecimalUtils;
|
||||
import com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase;
|
||||
import com.fasterxml.jackson.datatype.threetenbp.function.BiFunction;
|
||||
import com.fasterxml.jackson.datatype.threetenbp.function.Function;
|
||||
import org.threeten.bp.DateTimeException;
|
||||
import org.threeten.bp.Instant;
|
||||
import org.threeten.bp.OffsetDateTime;
|
||||
import org.threeten.bp.ZoneId;
|
||||
import org.threeten.bp.ZonedDateTime;
|
||||
import org.threeten.bp.format.DateTimeFormatter;
|
||||
import org.threeten.bp.temporal.Temporal;
|
||||
import org.threeten.bp.temporal.TemporalAccessor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Deserializer for ThreeTen temporal {@link Instant}s, {@link OffsetDateTime}, and {@link ZonedDateTime}s.
|
||||
* Adapted from the jackson threetenbp InstantDeserializer to add support for deserializing rfc822 format.
|
||||
*
|
||||
* @author Nick Williams
|
||||
*/
|
||||
public class CustomInstantDeserializer<T extends Temporal>
|
||||
extends ThreeTenDateTimeDeserializerBase<T> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final CustomInstantDeserializer<Instant> INSTANT = new CustomInstantDeserializer<Instant>(
|
||||
Instant.class, DateTimeFormatter.ISO_INSTANT,
|
||||
new Function<TemporalAccessor, Instant>() {
|
||||
@Override
|
||||
public Instant apply(TemporalAccessor temporalAccessor) {
|
||||
return Instant.from(temporalAccessor);
|
||||
}
|
||||
},
|
||||
new Function<FromIntegerArguments, Instant>() {
|
||||
@Override
|
||||
public Instant apply(FromIntegerArguments a) {
|
||||
return Instant.ofEpochMilli(a.value);
|
||||
}
|
||||
},
|
||||
new Function<FromDecimalArguments, Instant>() {
|
||||
@Override
|
||||
public Instant apply(FromDecimalArguments a) {
|
||||
return Instant.ofEpochSecond(a.integer, a.fraction);
|
||||
}
|
||||
},
|
||||
null
|
||||
);
|
||||
|
||||
public static final CustomInstantDeserializer<OffsetDateTime> OFFSET_DATE_TIME = new CustomInstantDeserializer<OffsetDateTime>(
|
||||
OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME,
|
||||
new Function<TemporalAccessor, OffsetDateTime>() {
|
||||
@Override
|
||||
public OffsetDateTime apply(TemporalAccessor temporalAccessor) {
|
||||
return OffsetDateTime.from(temporalAccessor);
|
||||
}
|
||||
},
|
||||
new Function<FromIntegerArguments, OffsetDateTime>() {
|
||||
@Override
|
||||
public OffsetDateTime apply(FromIntegerArguments a) {
|
||||
return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId);
|
||||
}
|
||||
},
|
||||
new Function<FromDecimalArguments, OffsetDateTime>() {
|
||||
@Override
|
||||
public OffsetDateTime apply(FromDecimalArguments a) {
|
||||
return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId);
|
||||
}
|
||||
},
|
||||
new BiFunction<OffsetDateTime, ZoneId, OffsetDateTime>() {
|
||||
@Override
|
||||
public OffsetDateTime apply(OffsetDateTime d, ZoneId z) {
|
||||
return d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime()));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
public static final CustomInstantDeserializer<ZonedDateTime> ZONED_DATE_TIME = new CustomInstantDeserializer<ZonedDateTime>(
|
||||
ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME,
|
||||
new Function<TemporalAccessor, ZonedDateTime>() {
|
||||
@Override
|
||||
public ZonedDateTime apply(TemporalAccessor temporalAccessor) {
|
||||
return ZonedDateTime.from(temporalAccessor);
|
||||
}
|
||||
},
|
||||
new Function<FromIntegerArguments, ZonedDateTime>() {
|
||||
@Override
|
||||
public ZonedDateTime apply(FromIntegerArguments a) {
|
||||
return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId);
|
||||
}
|
||||
},
|
||||
new Function<FromDecimalArguments, ZonedDateTime>() {
|
||||
@Override
|
||||
public ZonedDateTime apply(FromDecimalArguments a) {
|
||||
return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId);
|
||||
}
|
||||
},
|
||||
new BiFunction<ZonedDateTime, ZoneId, ZonedDateTime>() {
|
||||
@Override
|
||||
public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) {
|
||||
return zonedDateTime.withZoneSameInstant(zoneId);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
protected final Function<FromIntegerArguments, T> fromMilliseconds;
|
||||
|
||||
protected final Function<FromDecimalArguments, T> fromNanoseconds;
|
||||
|
||||
protected final Function<TemporalAccessor, T> parsedToValue;
|
||||
|
||||
protected final BiFunction<T, ZoneId, T> adjust;
|
||||
|
||||
protected CustomInstantDeserializer(Class<T> supportedType,
|
||||
DateTimeFormatter parser,
|
||||
Function<TemporalAccessor, T> parsedToValue,
|
||||
Function<FromIntegerArguments, T> fromMilliseconds,
|
||||
Function<FromDecimalArguments, T> fromNanoseconds,
|
||||
BiFunction<T, ZoneId, T> adjust) {
|
||||
super(supportedType, parser);
|
||||
this.parsedToValue = parsedToValue;
|
||||
this.fromMilliseconds = fromMilliseconds;
|
||||
this.fromNanoseconds = fromNanoseconds;
|
||||
this.adjust = adjust == null ? new BiFunction<T, ZoneId, T>() {
|
||||
@Override
|
||||
public T apply(T t, ZoneId zoneId) {
|
||||
return t;
|
||||
}
|
||||
} : adjust;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected CustomInstantDeserializer(CustomInstantDeserializer<T> base, DateTimeFormatter f) {
|
||||
super((Class<T>) base.handledType(), f);
|
||||
parsedToValue = base.parsedToValue;
|
||||
fromMilliseconds = base.fromMilliseconds;
|
||||
fromNanoseconds = base.fromNanoseconds;
|
||||
adjust = base.adjust;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JsonDeserializer<T> withDateFormat(DateTimeFormatter dtf) {
|
||||
if (dtf == _formatter) {
|
||||
return this;
|
||||
}
|
||||
return new CustomInstantDeserializer<T>(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 io.swagger.client.model.OuterComposite;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -214,7 +214,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
|
||||
@@ -337,6 +337,50 @@ public class FakeApi {
|
||||
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
/**
|
||||
* test json serialization of form data
|
||||
*
|
||||
* <p><b>200</b> - successful operation
|
||||
* @param param field1
|
||||
* @param param2 field2
|
||||
* @throws RestClientException if an error occurs while attempting to invoke the API
|
||||
*/
|
||||
public void testJsonFormData(String param, String param2) throws RestClientException {
|
||||
Object postBody = null;
|
||||
|
||||
// verify the required parameter 'param' is set
|
||||
if (param == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'param' when calling testJsonFormData");
|
||||
}
|
||||
|
||||
// verify the required parameter 'param2' is set
|
||||
if (param2 == null) {
|
||||
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'param2' when calling testJsonFormData");
|
||||
}
|
||||
|
||||
String path = UriComponentsBuilder.fromPath("/fake/jsonFormData").build().toUriString();
|
||||
|
||||
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
if (param != null)
|
||||
formParams.add("param", param);
|
||||
if (param2 != null)
|
||||
formParams.add("param2", param2);
|
||||
|
||||
final String[] accepts = { };
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = {
|
||||
"application/json"
|
||||
};
|
||||
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
|
||||
apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
*
|
||||
* <p><b>200</b> - 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<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
final HttpHeaders headerParams = new HttpHeaders();
|
||||
final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();
|
||||
|
||||
final String[] accepts = {
|
||||
"application/json"
|
||||
};
|
||||
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
|
||||
final String[] contentTypes = {
|
||||
"application/json"
|
||||
};
|
||||
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
|
||||
|
||||
String[] authNames = new String[] { };
|
||||
|
||||
ParameterizedTypeReference<Client> returnType = new ParameterizedTypeReference<Client>() {};
|
||||
return apiClient.invokeAPI(path, HttpMethod.PATCH, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import javax.xml.bind.annotation.*;
|
||||
@@ -87,7 +87,7 @@ public class FormatTest {
|
||||
@JsonProperty("dateTime")
|
||||
@JacksonXmlProperty(localName = "dateTime")
|
||||
@XmlElement(name = "dateTime")
|
||||
private DateTime dateTime = null;
|
||||
private OffsetDateTime dateTime = null;
|
||||
|
||||
@JsonProperty("uuid")
|
||||
@JacksonXmlProperty(localName = "uuid")
|
||||
@@ -289,7 +289,7 @@ public class FormatTest {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public FormatTest dateTime(DateTime dateTime) {
|
||||
public FormatTest dateTime(OffsetDateTime dateTime) {
|
||||
this.dateTime = dateTime;
|
||||
return this;
|
||||
}
|
||||
@@ -299,11 +299,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import javax.xml.bind.annotation.*;
|
||||
@@ -44,7 +44,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
|
||||
@JsonProperty("dateTime")
|
||||
@JacksonXmlProperty(localName = "dateTime")
|
||||
@XmlElement(name = "dateTime")
|
||||
private DateTime dateTime = null;
|
||||
private OffsetDateTime dateTime = null;
|
||||
|
||||
@JsonProperty("map")
|
||||
@JacksonXmlProperty(localName = "map")
|
||||
@@ -69,7 +69,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public MixedPropertiesAndAdditionalPropertiesClass dateTime(DateTime dateTime) {
|
||||
public MixedPropertiesAndAdditionalPropertiesClass dateTime(OffsetDateTime dateTime) {
|
||||
this.dateTime = dateTime;
|
||||
return this;
|
||||
}
|
||||
@@ -79,11 +79,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
|
||||
import javax.xml.bind.annotation.*;
|
||||
@@ -49,7 +49,7 @@ public class Order {
|
||||
@JsonProperty("shipDate")
|
||||
@JacksonXmlProperty(localName = "shipDate")
|
||||
@XmlElement(name = "shipDate")
|
||||
private DateTime shipDate = null;
|
||||
private OffsetDateTime shipDate = null;
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
@@ -152,7 +152,7 @@ public class Order {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public Order shipDate(DateTime shipDate) {
|
||||
public Order shipDate(OffsetDateTime shipDate) {
|
||||
this.shipDate = shipDate;
|
||||
return this;
|
||||
}
|
||||
@@ -162,11 +162,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user