[JAX-RS/jersey2] Fix for incorrect JSON field name capitalization (#4458)

* Fix for all capital field name

* Cosmetic: remove trailing spaces

* Adding ./bin/jaxrs-petstore-server.sh output.
This commit is contained in:
Yuta HIGUCHI 2017-01-10 07:37:25 -08:00 committed by wing328
parent 4d4af71446
commit de5ea8a9d6
36 changed files with 581 additions and 29 deletions

View File

@ -66,6 +66,9 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
{{#vendorExtensions.extraAnnotation}}
{{vendorExtensions.extraAnnotation}}
{{/vendorExtensions.extraAnnotation}}
{{#jackson}}
@JsonProperty("{{baseName}}")
{{/jackson}}
@ApiModelProperty({{#example}}example = "{{example}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
public {{{datatypeWithEnum}}} {{getter}}() {
return {{name}};

View File

@ -1,16 +1,16 @@
swagger: '2.0'
info:
description: "This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\"
version: 1.0.0
title: Swagger Petstore
version: 1.0.0
title: Swagger Petstore
termsOfService: 'http://swagger.io/terms/'
contact:
email: apiteam@swagger.io
email: apiteam@swagger.io
license:
name: Apache 2.0
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
host: petstore.swagger.io
basePath: /v2
host: petstore.swagger.io
basePath: /v2
tags:
- name: pet
description: Everything about your Pets
@ -611,7 +611,7 @@ paths:
- _abc
- '-efg'
- (xyz)
in: formData
in: formData
description: Form parameter enum test (string)
- name: enum_header_string_array
type: array
@ -621,7 +621,7 @@ paths:
enum:
- '>'
- '$'
in: header
in: header
description: Header parameter enum test (string array)
- name: enum_header_string
type: string
@ -633,7 +633,7 @@ paths:
in: header
description: Header parameter enum test (string)
- name: enum_query_string_array
type: array
type: array
items:
type: string
default: '$'
@ -649,11 +649,11 @@ paths:
- _abc
- '-efg'
- (xyz)
in: query
in: query
description: Query parameter enum test (string)
- name: enum_query_integer
type: integer
format: int32
format: int32
enum:
- 1
- -2
@ -661,7 +661,7 @@ paths:
description: Query parameter enum test (double)
- name: enum_query_double
type: number
format: double
format: double
enum:
- 1.1
- -1.2
@ -674,7 +674,7 @@ paths:
description: Not found
post:
tags:
- fake
- fake
summary: |
Fake endpoint for testing various parameters
假端點
@ -1046,7 +1046,7 @@ definitions:
format: date-time
uuid:
type: string
format: uuid
format: uuid
password:
type: string
format: password
@ -1104,7 +1104,7 @@ definitions:
dateTime:
type: string
format: date-time
map:
map:
type: object
additionalProperties:
$ref: '#/definitions/Animal'
@ -1135,6 +1135,23 @@ definitions:
foo:
type: string
readOnly: true
Capitalization:
type: object
properties:
smallCamel:
type: string
CapitalCamel:
type: string
small_Snake:
type: string
Capital_Snake:
type: string
SCA_ETH_Flow_Points:
type: string
ATT_NAME:
description: >
Name of the pet
type: string
MapTest:
type: object
properties:
@ -1143,14 +1160,14 @@ definitions:
additionalProperties:
type: object
additionalProperties:
type: string
type: string
# comment out the following (map of map of enum) as many language not yet support this
#map_map_of_enum:
# type: object
# additionalProperties:
# type: object
# additionalProperties:
# type: string
# type: string
# enum:
# - UPPER
# - lower
@ -1218,7 +1235,7 @@ definitions:
type: string
enum:
- ">="
- "$"
- "$"
array_enum:
type: array
items:

View File

@ -5,6 +5,15 @@
<packaging>jar</packaging>
<name>swagger-jaxrs-server</name>
<version>1.0.0</version>
<licenses>
<license>
<name>Unlicense</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>

View File

@ -36,7 +36,7 @@ public class FakeApi {
@Consumes({ "application/json" })
@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "To test \"client\" model", notes = "", response = Client.class, tags={ "fake", })
@io.swagger.annotations.ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", })
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) })
public Response testClientModel(@ApiParam(value = "client model" ,required=true) Client body
@ -77,7 +77,7 @@ public class FakeApi {
@Consumes({ "*/*" })
@Produces({ "*/*" })
@io.swagger.annotations.ApiOperation(value = "To test enum parameters", notes = "", response = void.class, tags={ "fake", })
@io.swagger.annotations.ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = void.class, tags={ "fake", })
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = void.class),
@ -88,7 +88,7 @@ public class FakeApi {
,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString
,@ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $") @QueryParam("enum_query_string_array") List<String> enumQueryStringArray
,@ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString
,@ApiParam(value = "Query parameter enum test (double)") @QueryParam("enum_query_integer") BigDecimal enumQueryInteger
,@ApiParam(value = "Query parameter enum test (double)") @QueryParam("enum_query_integer") Integer enumQueryInteger
,@ApiParam(value = "Query parameter enum test (double)") @FormParam("enum_query_double") Double enumQueryDouble
,@Context SecurityContext securityContext)
throws NotFoundException {

View File

@ -21,5 +21,5 @@ import javax.ws.rs.core.SecurityContext;
public abstract class FakeApiService {
public abstract Response testClientModel(Client body,SecurityContext securityContext) throws NotFoundException;
public abstract Response testEndpointParameters(BigDecimal number,Double _double,String patternWithoutDelimiter,byte[] _byte,Integer integer,Integer int32,Long int64,Float _float,String string,byte[] binary,Date date,Date dateTime,String password,String paramCallback,SecurityContext securityContext) throws NotFoundException;
public abstract Response testEnumParameters(List<String> enumFormStringArray,String enumFormString,List<String> enumHeaderStringArray,String enumHeaderString,List<String> enumQueryStringArray,String enumQueryString,BigDecimal enumQueryInteger,Double enumQueryDouble,SecurityContext securityContext) throws NotFoundException;
public abstract Response testEnumParameters(List<String> enumFormStringArray,String enumFormString,List<String> enumHeaderStringArray,String enumHeaderString,List<String> enumQueryStringArray,String enumQueryString,Integer enumQueryInteger,Double enumQueryDouble,SecurityContext securityContext) throws NotFoundException;
}

View File

@ -47,6 +47,7 @@ public class AdditionalPropertiesClass {
* Get mapProperty
* @return mapProperty
**/
@JsonProperty("map_property")
@ApiModelProperty(value = "")
public Map<String, String> getMapProperty() {
return mapProperty;
@ -70,6 +71,7 @@ public class AdditionalPropertiesClass {
* Get mapOfMapProperty
* @return mapOfMapProperty
**/
@JsonProperty("map_of_map_property")
@ApiModelProperty(value = "")
public Map<String, Map<String, String>> getMapOfMapProperty() {
return mapOfMapProperty;

View File

@ -16,6 +16,8 @@ package io.swagger.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -39,6 +41,7 @@ public class Animal {
* Get className
* @return className
**/
@JsonProperty("className")
@ApiModelProperty(required = true, value = "")
public String getClassName() {
return className;
@ -57,6 +60,7 @@ public class Animal {
* Get color
* @return color
**/
@JsonProperty("color")
@ApiModelProperty(value = "")
public String getColor() {
return color;

View File

@ -44,6 +44,7 @@ public class ArrayOfArrayOfNumberOnly {
* Get arrayArrayNumber
* @return arrayArrayNumber
**/
@JsonProperty("ArrayArrayNumber")
@ApiModelProperty(value = "")
public List<List<BigDecimal>> getArrayArrayNumber() {
return arrayArrayNumber;

View File

@ -44,6 +44,7 @@ public class ArrayOfNumberOnly {
* Get arrayNumber
* @return arrayNumber
**/
@JsonProperty("ArrayNumber")
@ApiModelProperty(value = "")
public List<BigDecimal> getArrayNumber() {
return arrayNumber;

View File

@ -50,6 +50,7 @@ public class ArrayTest {
* Get arrayOfString
* @return arrayOfString
**/
@JsonProperty("array_of_string")
@ApiModelProperty(value = "")
public List<String> getArrayOfString() {
return arrayOfString;
@ -73,6 +74,7 @@ public class ArrayTest {
* Get arrayArrayOfInteger
* @return arrayArrayOfInteger
**/
@JsonProperty("array_array_of_integer")
@ApiModelProperty(value = "")
public List<List<Long>> getArrayArrayOfInteger() {
return arrayArrayOfInteger;
@ -96,6 +98,7 @@ public class ArrayTest {
* Get arrayArrayOfModel
* @return arrayArrayOfModel
**/
@JsonProperty("array_array_of_model")
@ApiModelProperty(value = "")
public List<List<ReadOnlyFirst>> getArrayArrayOfModel() {
return arrayArrayOfModel;

View File

@ -0,0 +1,209 @@
/*
* 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.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Capitalization
*/
public class Capitalization {
@JsonProperty("smallCamel")
private String smallCamel = null;
@JsonProperty("CapitalCamel")
private String capitalCamel = null;
@JsonProperty("small_Snake")
private String smallSnake = null;
@JsonProperty("Capital_Snake")
private String capitalSnake = null;
@JsonProperty("SCA_ETH_Flow_Points")
private String scAETHFlowPoints = null;
@JsonProperty("ATT_NAME")
private String ATT_NAME = null;
public Capitalization smallCamel(String smallCamel) {
this.smallCamel = smallCamel;
return this;
}
/**
* Get smallCamel
* @return smallCamel
**/
@JsonProperty("smallCamel")
@ApiModelProperty(value = "")
public String getSmallCamel() {
return smallCamel;
}
public void setSmallCamel(String smallCamel) {
this.smallCamel = smallCamel;
}
public Capitalization capitalCamel(String capitalCamel) {
this.capitalCamel = capitalCamel;
return this;
}
/**
* Get capitalCamel
* @return capitalCamel
**/
@JsonProperty("CapitalCamel")
@ApiModelProperty(value = "")
public String getCapitalCamel() {
return capitalCamel;
}
public void setCapitalCamel(String capitalCamel) {
this.capitalCamel = capitalCamel;
}
public Capitalization smallSnake(String smallSnake) {
this.smallSnake = smallSnake;
return this;
}
/**
* Get smallSnake
* @return smallSnake
**/
@JsonProperty("small_Snake")
@ApiModelProperty(value = "")
public String getSmallSnake() {
return smallSnake;
}
public void setSmallSnake(String smallSnake) {
this.smallSnake = smallSnake;
}
public Capitalization capitalSnake(String capitalSnake) {
this.capitalSnake = capitalSnake;
return this;
}
/**
* Get capitalSnake
* @return capitalSnake
**/
@JsonProperty("Capital_Snake")
@ApiModelProperty(value = "")
public String getCapitalSnake() {
return capitalSnake;
}
public void setCapitalSnake(String capitalSnake) {
this.capitalSnake = capitalSnake;
}
public Capitalization scAETHFlowPoints(String scAETHFlowPoints) {
this.scAETHFlowPoints = scAETHFlowPoints;
return this;
}
/**
* Get scAETHFlowPoints
* @return scAETHFlowPoints
**/
@JsonProperty("SCA_ETH_Flow_Points")
@ApiModelProperty(value = "")
public String getScAETHFlowPoints() {
return scAETHFlowPoints;
}
public void setScAETHFlowPoints(String scAETHFlowPoints) {
this.scAETHFlowPoints = scAETHFlowPoints;
}
public Capitalization ATT_NAME(String ATT_NAME) {
this.ATT_NAME = ATT_NAME;
return this;
}
/**
* Name of the pet
* @return ATT_NAME
**/
@JsonProperty("ATT_NAME")
@ApiModelProperty(value = "Name of the pet ")
public String getATTNAME() {
return ATT_NAME;
}
public void setATTNAME(String ATT_NAME) {
this.ATT_NAME = ATT_NAME;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Capitalization capitalization = (Capitalization) o;
return Objects.equals(this.smallCamel, capitalization.smallCamel) &&
Objects.equals(this.capitalCamel, capitalization.capitalCamel) &&
Objects.equals(this.smallSnake, capitalization.smallSnake) &&
Objects.equals(this.capitalSnake, capitalization.capitalSnake) &&
Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) &&
Objects.equals(this.ATT_NAME, capitalization.ATT_NAME);
}
@Override
public int hashCode() {
return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Capitalization {\n");
sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n");
sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n");
sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n");
sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n");
sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n");
sb.append(" ATT_NAME: ").append(toIndentedString(ATT_NAME)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -37,6 +37,7 @@ public class Cat extends Animal {
* Get declawed
* @return declawed
**/
@JsonProperty("declawed")
@ApiModelProperty(value = "")
public Boolean getDeclawed() {
return declawed;

View File

@ -39,6 +39,7 @@ public class Category {
* Get id
* @return id
**/
@JsonProperty("id")
@ApiModelProperty(value = "")
public Long getId() {
return id;
@ -57,6 +58,7 @@ public class Category {
* Get name
* @return name
**/
@JsonProperty("name")
@ApiModelProperty(value = "")
public String getName() {
return name;

View File

@ -0,0 +1,90 @@
/*
* 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.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* Model for testing model with \&quot;_class\&quot; property
*/
@ApiModel(description = "Model for testing model with \"_class\" property")
public class ClassModel {
@JsonProperty("_class")
private String propertyClass = null;
public ClassModel propertyClass(String propertyClass) {
this.propertyClass = propertyClass;
return this;
}
/**
* Get propertyClass
* @return propertyClass
**/
@JsonProperty("_class")
@ApiModelProperty(value = "")
public String getPropertyClass() {
return propertyClass;
}
public void setPropertyClass(String propertyClass) {
this.propertyClass = propertyClass;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ClassModel classModel = (ClassModel) o;
return Objects.equals(this.propertyClass, classModel.propertyClass);
}
@Override
public int hashCode() {
return Objects.hash(propertyClass);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ClassModel {\n");
sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -36,6 +36,7 @@ public class Client {
* Get client
* @return client
**/
@JsonProperty("client")
@ApiModelProperty(value = "")
public String getClient() {
return client;

View File

@ -37,6 +37,7 @@ public class Dog extends Animal {
* Get breed
* @return breed
**/
@JsonProperty("breed")
@ApiModelProperty(value = "")
public String getBreed() {
return breed;

View File

@ -104,6 +104,7 @@ public class EnumArrays {
* Get justSymbol
* @return justSymbol
**/
@JsonProperty("just_symbol")
@ApiModelProperty(value = "")
public JustSymbolEnum getJustSymbol() {
return justSymbol;
@ -127,6 +128,7 @@ public class EnumArrays {
* Get arrayEnum
* @return arrayEnum
**/
@JsonProperty("array_enum")
@ApiModelProperty(value = "")
public List<ArrayEnumEnum> getArrayEnum() {
return arrayEnum;

View File

@ -19,6 +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 io.swagger.model.OuterEnum;
/**
* EnumTest
@ -129,6 +130,9 @@ public class EnumTest {
@JsonProperty("enum_number")
private EnumNumberEnum enumNumber = null;
@JsonProperty("outerEnum")
private OuterEnum outerEnum = null;
public EnumTest enumString(EnumStringEnum enumString) {
this.enumString = enumString;
return this;
@ -138,6 +142,7 @@ public class EnumTest {
* Get enumString
* @return enumString
**/
@JsonProperty("enum_string")
@ApiModelProperty(value = "")
public EnumStringEnum getEnumString() {
return enumString;
@ -156,6 +161,7 @@ public class EnumTest {
* Get enumInteger
* @return enumInteger
**/
@JsonProperty("enum_integer")
@ApiModelProperty(value = "")
public EnumIntegerEnum getEnumInteger() {
return enumInteger;
@ -174,6 +180,7 @@ public class EnumTest {
* Get enumNumber
* @return enumNumber
**/
@JsonProperty("enum_number")
@ApiModelProperty(value = "")
public EnumNumberEnum getEnumNumber() {
return enumNumber;
@ -183,6 +190,25 @@ public class EnumTest {
this.enumNumber = enumNumber;
}
public EnumTest outerEnum(OuterEnum outerEnum) {
this.outerEnum = outerEnum;
return this;
}
/**
* Get outerEnum
* @return outerEnum
**/
@JsonProperty("outerEnum")
@ApiModelProperty(value = "")
public OuterEnum getOuterEnum() {
return outerEnum;
}
public void setOuterEnum(OuterEnum outerEnum) {
this.outerEnum = outerEnum;
}
@Override
public boolean equals(java.lang.Object o) {
@ -195,12 +221,13 @@ public class EnumTest {
EnumTest enumTest = (EnumTest) o;
return Objects.equals(this.enumString, enumTest.enumString) &&
Objects.equals(this.enumInteger, enumTest.enumInteger) &&
Objects.equals(this.enumNumber, enumTest.enumNumber);
Objects.equals(this.enumNumber, enumTest.enumNumber) &&
Objects.equals(this.outerEnum, enumTest.outerEnum);
}
@Override
public int hashCode() {
return Objects.hash(enumString, enumInteger, enumNumber);
return Objects.hash(enumString, enumInteger, enumNumber, outerEnum);
}
@ -212,6 +239,7 @@ public class EnumTest {
sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n");
sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n");
sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n");
sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).append("\n");
sb.append("}");
return sb.toString();
}

View File

@ -72,10 +72,11 @@ public class FormatTest {
/**
* Get integer
* minimum: 10.0
* maximum: 100.0
* minimum: 10
* maximum: 100
* @return integer
**/
@JsonProperty("integer")
@ApiModelProperty(value = "")
public Integer getInteger() {
return integer;
@ -92,10 +93,11 @@ public class FormatTest {
/**
* Get int32
* minimum: 20.0
* maximum: 200.0
* minimum: 20
* maximum: 200
* @return int32
**/
@JsonProperty("int32")
@ApiModelProperty(value = "")
public Integer getInt32() {
return int32;
@ -114,6 +116,7 @@ public class FormatTest {
* Get int64
* @return int64
**/
@JsonProperty("int64")
@ApiModelProperty(value = "")
public Long getInt64() {
return int64;
@ -134,6 +137,7 @@ public class FormatTest {
* maximum: 543.2
* @return number
**/
@JsonProperty("number")
@ApiModelProperty(required = true, value = "")
public BigDecimal getNumber() {
return number;
@ -154,6 +158,7 @@ public class FormatTest {
* maximum: 987.6
* @return _float
**/
@JsonProperty("float")
@ApiModelProperty(value = "")
public Float getFloat() {
return _float;
@ -174,6 +179,7 @@ public class FormatTest {
* maximum: 123.4
* @return _double
**/
@JsonProperty("double")
@ApiModelProperty(value = "")
public Double getDouble() {
return _double;
@ -192,6 +198,7 @@ public class FormatTest {
* Get string
* @return string
**/
@JsonProperty("string")
@ApiModelProperty(value = "")
public String getString() {
return string;
@ -210,6 +217,7 @@ public class FormatTest {
* Get _byte
* @return _byte
**/
@JsonProperty("byte")
@ApiModelProperty(required = true, value = "")
public byte[] getByte() {
return _byte;
@ -228,6 +236,7 @@ public class FormatTest {
* Get binary
* @return binary
**/
@JsonProperty("binary")
@ApiModelProperty(value = "")
public byte[] getBinary() {
return binary;
@ -246,6 +255,7 @@ public class FormatTest {
* Get date
* @return date
**/
@JsonProperty("date")
@ApiModelProperty(required = true, value = "")
public Date getDate() {
return date;
@ -264,6 +274,7 @@ public class FormatTest {
* Get dateTime
* @return dateTime
**/
@JsonProperty("dateTime")
@ApiModelProperty(value = "")
public Date getDateTime() {
return dateTime;
@ -282,6 +293,7 @@ public class FormatTest {
* Get uuid
* @return uuid
**/
@JsonProperty("uuid")
@ApiModelProperty(value = "")
public String getUuid() {
return uuid;
@ -300,6 +312,7 @@ public class FormatTest {
* Get password
* @return password
**/
@JsonProperty("password")
@ApiModelProperty(required = true, value = "")
public String getPassword() {
return password;

View File

@ -34,6 +34,7 @@ public class HasOnlyReadOnly {
* Get bar
* @return bar
**/
@JsonProperty("bar")
@ApiModelProperty(value = "")
public String getBar() {
return bar;
@ -43,6 +44,7 @@ public class HasOnlyReadOnly {
* Get foo
* @return foo
**/
@JsonProperty("foo")
@ApiModelProperty(value = "")
public String getFoo() {
return foo;

View File

@ -79,6 +79,7 @@ public class MapTest {
* Get mapMapOfString
* @return mapMapOfString
**/
@JsonProperty("map_map_of_string")
@ApiModelProperty(value = "")
public Map<String, Map<String, String>> getMapMapOfString() {
return mapMapOfString;
@ -102,6 +103,7 @@ public class MapTest {
* Get mapOfEnumString
* @return mapOfEnumString
**/
@JsonProperty("map_of_enum_string")
@ApiModelProperty(value = "")
public Map<String, InnerEnum> getMapOfEnumString() {
return mapOfEnumString;

View File

@ -47,6 +47,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
* Get uuid
* @return uuid
**/
@JsonProperty("uuid")
@ApiModelProperty(value = "")
public String getUuid() {
return uuid;
@ -65,6 +66,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
* Get dateTime
* @return dateTime
**/
@JsonProperty("dateTime")
@ApiModelProperty(value = "")
public Date getDateTime() {
return dateTime;
@ -88,6 +90,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
* Get map
* @return map
**/
@JsonProperty("map")
@ApiModelProperty(value = "")
public Map<String, Animal> getMap() {
return map;

View File

@ -40,6 +40,7 @@ public class Model200Response {
* Get name
* @return name
**/
@JsonProperty("name")
@ApiModelProperty(value = "")
public Integer getName() {
return name;
@ -58,6 +59,7 @@ public class Model200Response {
* Get propertyClass
* @return propertyClass
**/
@JsonProperty("class")
@ApiModelProperty(value = "")
public String getPropertyClass() {
return propertyClass;

View File

@ -42,6 +42,7 @@ public class ModelApiResponse {
* Get code
* @return code
**/
@JsonProperty("code")
@ApiModelProperty(value = "")
public Integer getCode() {
return code;
@ -60,6 +61,7 @@ public class ModelApiResponse {
* Get type
* @return type
**/
@JsonProperty("type")
@ApiModelProperty(value = "")
public String getType() {
return type;
@ -78,6 +80,7 @@ public class ModelApiResponse {
* Get message
* @return message
**/
@JsonProperty("message")
@ApiModelProperty(value = "")
public String getMessage() {
return message;

View File

@ -37,6 +37,7 @@ public class ModelReturn {
* Get _return
* @return _return
**/
@JsonProperty("return")
@ApiModelProperty(value = "")
public Integer getReturn() {
return _return;

View File

@ -46,6 +46,7 @@ public class Name {
* Get name
* @return name
**/
@JsonProperty("name")
@ApiModelProperty(required = true, value = "")
public Integer getName() {
return name;
@ -59,6 +60,7 @@ public class Name {
* Get snakeCase
* @return snakeCase
**/
@JsonProperty("snake_case")
@ApiModelProperty(value = "")
public Integer getSnakeCase() {
return snakeCase;
@ -73,6 +75,7 @@ public class Name {
* Get property
* @return property
**/
@JsonProperty("property")
@ApiModelProperty(value = "")
public String getProperty() {
return property;
@ -86,6 +89,7 @@ public class Name {
* Get _123Number
* @return _123Number
**/
@JsonProperty("123Number")
@ApiModelProperty(value = "")
public Integer get123Number() {
return _123Number;

View File

@ -37,6 +37,7 @@ public class NumberOnly {
* Get justNumber
* @return justNumber
**/
@JsonProperty("JustNumber")
@ApiModelProperty(value = "")
public BigDecimal getJustNumber() {
return justNumber;

View File

@ -86,6 +86,7 @@ public class Order {
* Get id
* @return id
**/
@JsonProperty("id")
@ApiModelProperty(value = "")
public Long getId() {
return id;
@ -104,6 +105,7 @@ public class Order {
* Get petId
* @return petId
**/
@JsonProperty("petId")
@ApiModelProperty(value = "")
public Long getPetId() {
return petId;
@ -122,6 +124,7 @@ public class Order {
* Get quantity
* @return quantity
**/
@JsonProperty("quantity")
@ApiModelProperty(value = "")
public Integer getQuantity() {
return quantity;
@ -140,6 +143,7 @@ public class Order {
* Get shipDate
* @return shipDate
**/
@JsonProperty("shipDate")
@ApiModelProperty(value = "")
public Date getShipDate() {
return shipDate;
@ -158,6 +162,7 @@ public class Order {
* Order Status
* @return status
**/
@JsonProperty("status")
@ApiModelProperty(value = "Order Status")
public StatusEnum getStatus() {
return status;
@ -176,6 +181,7 @@ public class Order {
* Get complete
* @return complete
**/
@JsonProperty("complete")
@ApiModelProperty(value = "")
public Boolean getComplete() {
return complete;

View File

@ -0,0 +1,53 @@
/*
* 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.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.annotation.JsonCreator;
/**
* Gets or Sets OuterEnum
*/
public enum OuterEnum {
PLACED("placed"),
APPROVED("approved"),
DELIVERED("delivered");
private String value;
OuterEnum(String value) {
this.value = value;
}
@Override
public String toString() {
return String.valueOf(value);
}
@JsonCreator
public static OuterEnum fromValue(String text) {
for (OuterEnum b : OuterEnum.values()) {
if (String.valueOf(b.value).equals(text)) {
return b;
}
}
return null;
}
}

View File

@ -89,6 +89,7 @@ public class Pet {
* Get id
* @return id
**/
@JsonProperty("id")
@ApiModelProperty(value = "")
public Long getId() {
return id;
@ -107,6 +108,7 @@ public class Pet {
* Get category
* @return category
**/
@JsonProperty("category")
@ApiModelProperty(value = "")
public Category getCategory() {
return category;
@ -125,6 +127,7 @@ public class Pet {
* Get name
* @return name
**/
@JsonProperty("name")
@ApiModelProperty(example = "doggie", required = true, value = "")
public String getName() {
return name;
@ -148,6 +151,7 @@ public class Pet {
* Get photoUrls
* @return photoUrls
**/
@JsonProperty("photoUrls")
@ApiModelProperty(required = true, value = "")
public List<String> getPhotoUrls() {
return photoUrls;
@ -171,6 +175,7 @@ public class Pet {
* Get tags
* @return tags
**/
@JsonProperty("tags")
@ApiModelProperty(value = "")
public List<Tag> getTags() {
return tags;
@ -189,6 +194,7 @@ public class Pet {
* pet status in the store
* @return status
**/
@JsonProperty("status")
@ApiModelProperty(value = "pet status in the store")
public StatusEnum getStatus() {
return status;

View File

@ -34,6 +34,7 @@ public class ReadOnlyFirst {
* Get bar
* @return bar
**/
@JsonProperty("bar")
@ApiModelProperty(value = "")
public String getBar() {
return bar;
@ -48,6 +49,7 @@ public class ReadOnlyFirst {
* Get baz
* @return baz
**/
@JsonProperty("baz")
@ApiModelProperty(value = "")
public String getBaz() {
return baz;

View File

@ -36,6 +36,7 @@ public class SpecialModelName {
* Get specialPropertyName
* @return specialPropertyName
**/
@JsonProperty("$special[property.name]")
@ApiModelProperty(value = "")
public Long getSpecialPropertyName() {
return specialPropertyName;

View File

@ -39,6 +39,7 @@ public class Tag {
* Get id
* @return id
**/
@JsonProperty("id")
@ApiModelProperty(value = "")
public Long getId() {
return id;
@ -57,6 +58,7 @@ public class Tag {
* Get name
* @return name
**/
@JsonProperty("name")
@ApiModelProperty(value = "")
public String getName() {
return name;

View File

@ -57,6 +57,7 @@ public class User {
* Get id
* @return id
**/
@JsonProperty("id")
@ApiModelProperty(value = "")
public Long getId() {
return id;
@ -75,6 +76,7 @@ public class User {
* Get username
* @return username
**/
@JsonProperty("username")
@ApiModelProperty(value = "")
public String getUsername() {
return username;
@ -93,6 +95,7 @@ public class User {
* Get firstName
* @return firstName
**/
@JsonProperty("firstName")
@ApiModelProperty(value = "")
public String getFirstName() {
return firstName;
@ -111,6 +114,7 @@ public class User {
* Get lastName
* @return lastName
**/
@JsonProperty("lastName")
@ApiModelProperty(value = "")
public String getLastName() {
return lastName;
@ -129,6 +133,7 @@ public class User {
* Get email
* @return email
**/
@JsonProperty("email")
@ApiModelProperty(value = "")
public String getEmail() {
return email;
@ -147,6 +152,7 @@ public class User {
* Get password
* @return password
**/
@JsonProperty("password")
@ApiModelProperty(value = "")
public String getPassword() {
return password;
@ -165,6 +171,7 @@ public class User {
* Get phone
* @return phone
**/
@JsonProperty("phone")
@ApiModelProperty(value = "")
public String getPhone() {
return phone;
@ -183,6 +190,7 @@ public class User {
* User Status
* @return userStatus
**/
@JsonProperty("userStatus")
@ApiModelProperty(value = "User Status")
public Integer getUserStatus() {
return userStatus;

View File

@ -30,7 +30,7 @@ public class FakeApiServiceImpl extends FakeApiService {
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response testEnumParameters(List<String> enumFormStringArray, String enumFormString, List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, BigDecimal enumQueryInteger, Double enumQueryDouble, SecurityContext securityContext) throws NotFoundException {
public Response testEnumParameters(List<String> enumFormStringArray, String enumFormString, List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, SecurityContext securityContext) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}

View File

@ -0,0 +1,69 @@
package io.swagger.model;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* Tests JSON representation of
*/
public class CapitalizationTest {
private static final String SMALL_CAMEL = "smallCamel";
private static final String SMALL_SNAKE = "small_Snake";
private static final String CAPITAL_CAMEL = "CapitalCamel";
private static final String CAPITAL_SNAKE = "Capital_Snake";
private static final String SCA_ETH_FLOW_POINTS = "SCA_ETH_Flow_Points";
private static final String ATT_NAME = "ATT_NAME";
private static final ObjectMapper MAPPER = new ObjectMapper();
private static final Set<String> EXPECTED
= new HashSet<>(Arrays.asList(SMALL_CAMEL,
SMALL_SNAKE,
CAPITAL_CAMEL,
CAPITAL_SNAKE,
SCA_ETH_FLOW_POINTS,
ATT_NAME));
private Capitalization sut;
@Before
public void setUp() {
sut = new Capitalization();
sut.smallCamel(SMALL_CAMEL);
sut.smallSnake(SMALL_SNAKE);
sut.capitalCamel(CAPITAL_CAMEL);
sut.capitalSnake(CAPITAL_SNAKE);
sut.setScAETHFlowPoints(SCA_ETH_FLOW_POINTS);
sut.setATTNAME(ATT_NAME);
}
@Test
public void test() throws JsonProcessingException {
JsonNode json = MAPPER.valueToTree(sut);
Set<String> fields = new HashSet<>();
Iterator<String> it = json.fieldNames();
while (it.hasNext()) {
fields.add(it.next());
}
assertThat(fields, is(equalTo(EXPECTED)));
}
}