Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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}};
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -621,7 +621,7 @@ paths:
enum:
- '>'
- '$'
in: header
in: header
description: Header parameter enum test (string array)
- name: enum_header_string
type: string
Expand All @@ -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: '$'
Expand All @@ -649,19 +649,19 @@ 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
in: query
description: Query parameter enum test (double)
- name: enum_query_double
type: number
format: double
format: double
enum:
- 1.1
- -1.2
Expand All @@ -674,7 +674,7 @@ paths:
description: Not found
post:
tags:
- fake
- fake
summary: |
Fake endpoint for testing various parameters
假端點
Expand Down Expand Up @@ -1046,7 +1046,7 @@ definitions:
format: date-time
uuid:
type: string
format: uuid
format: uuid
password:
type: string
format: password
Expand Down Expand Up @@ -1103,7 +1103,7 @@ definitions:
dateTime:
type: string
format: date-time
map:
map:
type: object
additionalProperties:
$ref: '#/definitions/Animal'
Expand Down Expand Up @@ -1134,6 +1134,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:
Expand All @@ -1142,14 +1159,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
Expand Down Expand Up @@ -1217,7 +1234,7 @@ definitions:
type: string
enum:
- ">="
- "$"
- "$"
array_enum:
type: array
items:
Expand Down
9 changes: 9 additions & 0 deletions samples/server/petstore/jaxrs/jersey2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -77,7 +77,7 @@ public Response testEndpointParameters(@ApiParam(value = "None", required=true)

@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),

Expand All @@ -88,7 +88,7 @@ public Response testEnumParameters(@ApiParam(value = "Form parameter enum test (
,@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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public AdditionalPropertiesClass putMapPropertyItem(String key, String mapProper
* Get mapProperty
* @return mapProperty
**/
@JsonProperty("map_property")
@ApiModelProperty(value = "")
public Map<String, String> getMapProperty() {
return mapProperty;
Expand All @@ -70,6 +71,7 @@ public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map<String,
* Get mapOfMapProperty
* @return mapOfMapProperty
**/
@JsonProperty("map_of_map_property")
@ApiModelProperty(value = "")
public Map<String, Map<String, String>> getMapOfMapProperty() {
return mapOfMapProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
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;

Expand All @@ -39,6 +41,7 @@ public Animal className(String className) {
* Get className
* @return className
**/
@JsonProperty("className")
@ApiModelProperty(required = true, value = "")
public String getClassName() {
return className;
Expand All @@ -57,6 +60,7 @@ public Animal color(String color) {
* Get color
* @return color
**/
@JsonProperty("color")
@ApiModelProperty(value = "")
public String getColor() {
return color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayAr
* Get arrayArrayNumber
* @return arrayArrayNumber
**/
@JsonProperty("ArrayArrayNumber")
@ApiModelProperty(value = "")
public List<List<BigDecimal>> getArrayArrayNumber() {
return arrayArrayNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) {
* Get arrayNumber
* @return arrayNumber
**/
@JsonProperty("ArrayNumber")
@ApiModelProperty(value = "")
public List<BigDecimal> getArrayNumber() {
return arrayNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public ArrayTest addArrayOfStringItem(String arrayOfStringItem) {
* Get arrayOfString
* @return arrayOfString
**/
@JsonProperty("array_of_string")
@ApiModelProperty(value = "")
public List<String> getArrayOfString() {
return arrayOfString;
Expand All @@ -73,6 +74,7 @@ public ArrayTest addArrayArrayOfIntegerItem(List<Long> arrayArrayOfIntegerItem)
* Get arrayArrayOfInteger
* @return arrayArrayOfInteger
**/
@JsonProperty("array_array_of_integer")
@ApiModelProperty(value = "")
public List<List<Long>> getArrayArrayOfInteger() {
return arrayArrayOfInteger;
Expand All @@ -96,6 +98,7 @@ public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelI
* Get arrayArrayOfModel
* @return arrayArrayOfModel
**/
@JsonProperty("array_array_of_model")
@ApiModelProperty(value = "")
public List<List<ReadOnlyFirst>> getArrayArrayOfModel() {
return arrayArrayOfModel;
Expand Down
Loading