[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}} {{vendorExtensions.extraAnnotation}}
{{/vendorExtensions.extraAnnotation}} {{/vendorExtensions.extraAnnotation}}
{{#jackson}}
@JsonProperty("{{baseName}}")
{{/jackson}}
@ApiModelProperty({{#example}}example = "{{example}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") @ApiModelProperty({{#example}}example = "{{example}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
public {{{datatypeWithEnum}}} {{getter}}() { public {{{datatypeWithEnum}}} {{getter}}() {
return {{name}}; return {{name}};

View File

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

View File

@ -5,6 +5,15 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<name>swagger-jaxrs-server</name> <name>swagger-jaxrs-server</name>
<version>1.0.0</version> <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> <build>
<sourceDirectory>src/main/java</sourceDirectory> <sourceDirectory>src/main/java</sourceDirectory>
<plugins> <plugins>

View File

@ -36,7 +36,7 @@ public class FakeApi {
@Consumes({ "application/json" }) @Consumes({ "application/json" })
@Produces({ "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.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) })
public Response testClientModel(@ApiParam(value = "client model" ,required=true) Client body public Response testClientModel(@ApiParam(value = "client model" ,required=true) Client body
@ -77,7 +77,7 @@ public class FakeApi {
@Consumes({ "*/*" }) @Consumes({ "*/*" })
@Produces({ "*/*" }) @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.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = void.class), @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 = "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 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 (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 ,@ApiParam(value = "Query parameter enum test (double)") @FormParam("enum_query_double") Double enumQueryDouble
,@Context SecurityContext securityContext) ,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {

View File

@ -21,5 +21,5 @@ import javax.ws.rs.core.SecurityContext;
public abstract class FakeApiService { public abstract class FakeApiService {
public abstract Response testClientModel(Client body,SecurityContext securityContext) throws NotFoundException; 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 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 * Get mapProperty
* @return mapProperty * @return mapProperty
**/ **/
@JsonProperty("map_property")
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, String> getMapProperty() { public Map<String, String> getMapProperty() {
return mapProperty; return mapProperty;
@ -70,6 +71,7 @@ public class AdditionalPropertiesClass {
* Get mapOfMapProperty * Get mapOfMapProperty
* @return mapOfMapProperty * @return mapOfMapProperty
**/ **/
@JsonProperty("map_of_map_property")
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Map<String, Map<String, String>> getMapOfMapProperty() { public Map<String, Map<String, String>> getMapOfMapProperty() {
return mapOfMapProperty; return mapOfMapProperty;

View File

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

View File

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

View File

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

View File

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

View File

@ -39,6 +39,7 @@ public class Category {
* Get id * Get id
* @return id * @return id
**/ **/
@JsonProperty("id")
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Long getId() { public Long getId() {
return id; return id;
@ -57,6 +58,7 @@ public class Category {
* Get name * Get name
* @return name * @return name
**/ **/
@JsonProperty("name")
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public String getName() { public String getName() {
return name; 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 * Get client
* @return client * @return client
**/ **/
@JsonProperty("client")
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public String getClient() { public String getClient() {
return client; return client;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -86,6 +86,7 @@ public class Order {
* Get id * Get id
* @return id * @return id
**/ **/
@JsonProperty("id")
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Long getId() { public Long getId() {
return id; return id;
@ -104,6 +105,7 @@ public class Order {
* Get petId * Get petId
* @return petId * @return petId
**/ **/
@JsonProperty("petId")
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Long getPetId() { public Long getPetId() {
return petId; return petId;
@ -122,6 +124,7 @@ public class Order {
* Get quantity * Get quantity
* @return quantity * @return quantity
**/ **/
@JsonProperty("quantity")
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Integer getQuantity() { public Integer getQuantity() {
return quantity; return quantity;
@ -140,6 +143,7 @@ public class Order {
* Get shipDate * Get shipDate
* @return shipDate * @return shipDate
**/ **/
@JsonProperty("shipDate")
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Date getShipDate() { public Date getShipDate() {
return shipDate; return shipDate;
@ -158,6 +162,7 @@ public class Order {
* Order Status * Order Status
* @return status * @return status
**/ **/
@JsonProperty("status")
@ApiModelProperty(value = "Order Status") @ApiModelProperty(value = "Order Status")
public StatusEnum getStatus() { public StatusEnum getStatus() {
return status; return status;
@ -176,6 +181,7 @@ public class Order {
* Get complete * Get complete
* @return complete * @return complete
**/ **/
@JsonProperty("complete")
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Boolean getComplete() { public Boolean getComplete() {
return complete; 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 * Get id
* @return id * @return id
**/ **/
@JsonProperty("id")
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Long getId() { public Long getId() {
return id; return id;
@ -107,6 +108,7 @@ public class Pet {
* Get category * Get category
* @return category * @return category
**/ **/
@JsonProperty("category")
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public Category getCategory() { public Category getCategory() {
return category; return category;
@ -125,6 +127,7 @@ public class Pet {
* Get name * Get name
* @return name * @return name
**/ **/
@JsonProperty("name")
@ApiModelProperty(example = "doggie", required = true, value = "") @ApiModelProperty(example = "doggie", required = true, value = "")
public String getName() { public String getName() {
return name; return name;
@ -148,6 +151,7 @@ public class Pet {
* Get photoUrls * Get photoUrls
* @return photoUrls * @return photoUrls
**/ **/
@JsonProperty("photoUrls")
@ApiModelProperty(required = true, value = "") @ApiModelProperty(required = true, value = "")
public List<String> getPhotoUrls() { public List<String> getPhotoUrls() {
return photoUrls; return photoUrls;
@ -171,6 +175,7 @@ public class Pet {
* Get tags * Get tags
* @return tags * @return tags
**/ **/
@JsonProperty("tags")
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
public List<Tag> getTags() { public List<Tag> getTags() {
return tags; return tags;
@ -189,6 +194,7 @@ public class Pet {
* pet status in the store * pet status in the store
* @return status * @return status
**/ **/
@JsonProperty("status")
@ApiModelProperty(value = "pet status in the store") @ApiModelProperty(value = "pet status in the store")
public StatusEnum getStatus() { public StatusEnum getStatus() {
return status; return status;

View File

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

View File

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

View File

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

View File

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

View File

@ -30,7 +30,7 @@ public class FakeApiServiceImpl extends FakeApiService {
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override @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! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); 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)));
}
}