[java-server] Fix improper quoting of default values for query parameters (#708)

This commit is contained in:
OmriHarary
2018-08-21 04:17:31 -04:00
committed by Jérémie Bresson
parent fcfd8ea76e
commit ca0c35aa15
54 changed files with 588 additions and 155 deletions

View File

@@ -1 +1 @@
{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{#defaultValue}}@DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}
{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}) {{#defaultValue}}@DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}

View File

@@ -1 +1 @@
{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#defaultValue}}@DefaultValue("{{{defaultValue}}}") {{/defaultValue}}{{{dataType}}} {{paramName}}{{/isQueryParam}}
{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#defaultValue}}@DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}) {{/defaultValue}}{{{dataType}}} {{paramName}}{{/isQueryParam}}

View File

@@ -1 +1 @@
{{#isQueryParam}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}
{{#isQueryParam}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}){{#defaultValue}} @DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}

View File

@@ -1 +1 @@
{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}
{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#defaultValue}} @DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}

View File

@@ -1 +1 @@
{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} {{#useSwaggerAnnotations}}{{#description}} @ApiParam("{{description}}"){{/description}}{{/useSwaggerAnnotations}} {{{dataType}}} {{paramName}}{{/isQueryParam}}
{{#isQueryParam}}@QueryParam("{{baseName}}"){{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#defaultValue}} @DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}} {{#useSwaggerAnnotations}}{{#description}} @ApiParam("{{description}}"){{/description}}{{/useSwaggerAnnotations}} {{{dataType}}} {{paramName}}{{/isQueryParam}}

View File

@@ -1 +1 @@
{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{defaultValue}}}"{{/defaultValue}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestParam(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{>optionalDataType}} {{paramName}}{{/isQueryParam}}
{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestParam(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}) {{>optionalDataType}} {{paramName}}{{/isQueryParam}}

View File

@@ -68,7 +68,7 @@ public class {{classname}}Verticle extends AbstractVerticle {
{{{dataType}}} {{paramName}} = {{paramName}}Param;
{{/required}}
{{^required}}
{{{dataType}}} {{paramName}} = ({{paramName}}Param == null) ? {{#defaultValue}}{{defaultValue}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} : {{paramName}}Param;
{{{dataType}}} {{paramName}} = ({{paramName}}Param == null) ? {{#defaultValue}}{{#isEnum}}"{{/isEnum}}{{{defaultValue}}}{{#isEnum}}"{{/isEnum}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} : {{paramName}}Param;
{{/required}}
{{/isString}}
{{^isString}}

View File

@@ -1 +1 @@
{{#isQueryParam}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{#defaultValue}} @DefaultValue("{{{defaultValue}}}"){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}
{{#isQueryParam}}@ApiParam(value = "{{{description}}}"{{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}){{#defaultValue}} @DefaultValue({{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}){{/defaultValue}} @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{/isQueryParam}}

View File

@@ -1 +1 @@
{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{defaultValue}}}"{{/defaultValue}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestParam(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{>optionalDataType}} {{paramName}}{{/isQueryParam}}
{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestParam(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}) {{>optionalDataType}} {{paramName}}{{/isQueryParam}}

View File

@@ -1 +1 @@
3.0.0-SNAPSHOT
3.2.0-SNAPSHOT

View File

@@ -31,7 +31,6 @@ public class Order {
@ApiModelProperty(value = "")
private Date shipDate = null;
@XmlType(name="StatusEnum")
@XmlEnum(String.class)
public enum StatusEnum {
@@ -60,7 +59,7 @@ public enum StatusEnum {
return b;
}
}
return null;
throw new IllegalArgumentException("Unexpected value '" + v + "'");
}
}
@@ -170,7 +169,7 @@ public enum StatusEnum {
* @return complete
**/
@JsonProperty("complete")
public Boolean isComplete() {
public Boolean getComplete() {
return complete;
}

View File

@@ -37,7 +37,6 @@ public class Pet {
@ApiModelProperty(value = "")
private List<Tag> tags = null;
@XmlType(name="StatusEnum")
@XmlEnum(String.class)
public enum StatusEnum {
@@ -66,7 +65,7 @@ public enum StatusEnum {
return b;
}
}
return null;
throw new IllegalArgumentException("Unexpected value '" + v + "'");
}
}

View File

@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@@ -1 +1 @@
3.0.0-SNAPSHOT
3.2.0-SNAPSHOT

View File

@@ -34,12 +34,12 @@ public class AnotherFakeApi {
@Path("/dummy")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags", response = Client.class, tags={ "$another-fake?", })
@io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", })
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) })
public Response testSpecialTags(@ApiParam(value = "client model" ,required=true) Client client
public Response call123testSpecialTags(@ApiParam(value = "client model" ,required=true) Client client
)
throws NotFoundException {
return delegate.testSpecialTags(client);
return delegate.call123testSpecialTags(client);
}
}

View File

@@ -18,6 +18,6 @@ import javax.ws.rs.core.SecurityContext;
public abstract class AnotherFakeApiService {
public abstract Response testSpecialTags(Client client
public abstract Response call123testSpecialTags(Client client
) throws NotFoundException;
}

View File

@@ -11,7 +11,9 @@ import java.math.BigDecimal;
import org.openapitools.model.Client;
import java.util.Date;
import java.io.File;
import org.openapitools.model.FileSchemaTestClass;
import java.util.Map;
import org.openapitools.model.ModelApiResponse;
import org.openapitools.model.OuterComposite;
import org.openapitools.model.User;
@@ -43,10 +45,10 @@ public class FakeApi {
@io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", })
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) })
public Response fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) Boolean booleanPostBody
public Response fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) Boolean body
)
throws NotFoundException {
return delegate.fakeOuterBooleanSerialize(booleanPostBody);
return delegate.fakeOuterBooleanSerialize(body);
}
@POST
@Path("/outer/composite")
@@ -85,6 +87,18 @@ public class FakeApi {
return delegate.fakeOuterStringSerialize(body);
}
@PUT
@Path("/body-with-file-schema")
@Consumes({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "", notes = "For this test, the body for this request much reference a schema named `File`.", response = Void.class, tags={ "fake", })
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) })
public Response testBodyWithFileSchema(@ApiParam(value = "" ,required=true) FileSchemaTestClass fileSchemaTestClass
)
throws NotFoundException {
return delegate.testBodyWithFileSchema(fileSchemaTestClass);
}
@PUT
@Path("/body-with-query-params")
@Consumes({ "application/json" })
@@ -120,22 +134,22 @@ public class FakeApi {
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class),
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) })
public Response testEndpointParameters(@ApiParam(value = "None", required=true) @FormParam("number") BigDecimal number
,@ApiParam(value = "None", required=true) @FormParam("double") Double _double
,@ApiParam(value = "None", required=true) @FormParam("pattern_without_delimiter") String patternWithoutDelimiter
,@ApiParam(value = "None", required=true) @FormParam("byte") byte[] _byte
,@ApiParam(value = "None", allowableValues="range=[10, 100]") @FormParam("integer") Integer integer
,@ApiParam(value = "None", allowableValues="range=[20, 200]") @FormParam("int32") Integer int32
,@ApiParam(value = "None") @FormParam("int64") Long int64
,@ApiParam(value = "None") @FormParam("float") Float _float
,@ApiParam(value = "None") @FormParam("string") String string
public Response testEndpointParameters(@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("number") BigDecimal number
,@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("double") Double _double
,@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("pattern_without_delimiter") String patternWithoutDelimiter
,@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("byte") byte[] _byte
,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("integer") Integer integer
,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("int32") Integer int32
,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("int64") Long int64
,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("float") Float _float
,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("string") String string
,
@FormDataParam("binary") InputStream binaryInputStream,
@FormDataParam("binary") FileInfo binaryDetail
,@ApiParam(value = "None") @FormParam("date") Date date
,@ApiParam(value = "None") @FormParam("dateTime") Date dateTime
,@ApiParam(value = "None") @FormParam("password") String password
,@ApiParam(value = "None") @FormParam("callback") String paramCallback
,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("date") Date date
,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("dateTime") Date dateTime
,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("password") String password
,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("callback") String paramCallback
)
throws NotFoundException {
return delegate.testEndpointParameters(number,_double,patternWithoutDelimiter,_byte,integer,int32,int64,_float,string,binaryInputStream, binaryDetail,date,dateTime,password,paramCallback);
@@ -155,8 +169,8 @@ public class FakeApi {
,@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)", allowableValues="1, -2") @QueryParam("enum_query_integer") Integer enumQueryInteger
,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @QueryParam("enum_query_double") Double enumQueryDouble
,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @FormParam("enum_form_string_array") List<String> enumFormStringArray
,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)") @FormParam("enum_form_string") String enumFormString
,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $", defaultValue="$") @DefaultValue("$") @FormParam("enum_form_string_array") List<String> enumFormStringArray
,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @FormParam("enum_form_string") String enumFormString
)
throws NotFoundException {
return delegate.testEnumParameters(enumHeaderStringArray,enumHeaderString,enumQueryStringArray,enumQueryString,enumQueryInteger,enumQueryDouble,enumFormStringArray,enumFormString);
@@ -168,7 +182,7 @@ public class FakeApi {
@io.swagger.annotations.ApiOperation(value = "test inline additionalProperties", notes = "", response = Void.class, tags={ "fake", })
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) })
public Response testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true) String requestBody
public Response testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true) Map<String, String> requestBody
)
throws NotFoundException {
return delegate.testInlineAdditionalProperties(requestBody);
@@ -180,10 +194,31 @@ public class FakeApi {
@io.swagger.annotations.ApiOperation(value = "test json serialization of form data", notes = "", response = Void.class, tags={ "fake", })
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) })
public Response testJsonFormData(@ApiParam(value = "field1", required=true) @FormParam("param") String param
,@ApiParam(value = "field2", required=true) @FormParam("param2") String param2
public Response testJsonFormData(@ApiParam(value = "field1", required=true, defaultValue="null") @DefaultValue("null") @FormParam("param") String param
,@ApiParam(value = "field2", required=true, defaultValue="null") @DefaultValue("null") @FormParam("param2") String param2
)
throws NotFoundException {
return delegate.testJsonFormData(param,param2);
}
@POST
@Path("/{petId}/uploadImageWithRequiredFile")
@Consumes({ "multipart/form-data" })
@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "uploads an image (required)", notes = "", response = ModelApiResponse.class, authorizations = {
@io.swagger.annotations.Authorization(value = "petstore_auth", scopes = {
@io.swagger.annotations.AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
@io.swagger.annotations.AuthorizationScope(scope = "read:pets", description = "read your pets")
})
}, tags={ "pet", })
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
public Response uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId
,
@FormDataParam("requiredFile") InputStream requiredFileInputStream,
@FormDataParam("requiredFile") FileInfo requiredFileDetail
,@ApiParam(value = "Additional data to pass to server", defaultValue="null")@FormDataParam("additionalMetadata") String additionalMetadata
)
throws NotFoundException {
return delegate.uploadFileWithRequiredFile(petId,requiredFileInputStream, requiredFileDetail,additionalMetadata);
}
}

View File

@@ -10,7 +10,9 @@ import java.math.BigDecimal;
import org.openapitools.model.Client;
import java.util.Date;
import java.io.File;
import org.openapitools.model.FileSchemaTestClass;
import java.util.Map;
import org.openapitools.model.ModelApiResponse;
import org.openapitools.model.OuterComposite;
import org.openapitools.model.User;
@@ -24,13 +26,15 @@ import javax.ws.rs.core.SecurityContext;
public abstract class FakeApiService {
public abstract Response fakeOuterBooleanSerialize(Boolean booleanPostBody
public abstract Response fakeOuterBooleanSerialize(Boolean body
) throws NotFoundException;
public abstract Response fakeOuterCompositeSerialize(OuterComposite outerComposite
) throws NotFoundException;
public abstract Response fakeOuterNumberSerialize(BigDecimal body
) throws NotFoundException;
public abstract Response fakeOuterStringSerialize(String body
) throws NotFoundException;
public abstract Response testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass
) throws NotFoundException;
public abstract Response testBodyWithQueryParams(String query
,User user
@@ -61,9 +65,13 @@ public abstract class FakeApiService {
,List<String> enumFormStringArray
,String enumFormString
) throws NotFoundException;
public abstract Response testInlineAdditionalProperties(String requestBody
public abstract Response testInlineAdditionalProperties(Map<String, String> requestBody
) throws NotFoundException;
public abstract Response testJsonFormData(String param
,String param2
) throws NotFoundException;
public abstract Response uploadFileWithRequiredFile(Long petId
,InputStream requiredFileInputStream, FileInfo requiredFileDetail
,String additionalMetadata
) throws NotFoundException;
}

View File

@@ -157,8 +157,8 @@ public class PetApi {
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
public Response updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathParam("petId") Long petId
,@ApiParam(value = "Updated name of the pet") @FormParam("name") String name
,@ApiParam(value = "Updated status of the pet") @FormParam("status") String status
,@ApiParam(value = "Updated name of the pet", defaultValue="null") @DefaultValue("null") @FormParam("name") String name
,@ApiParam(value = "Updated status of the pet", defaultValue="null") @DefaultValue("null") @FormParam("status") String status
)
throws NotFoundException {
return delegate.updatePetWithForm(petId,name,status);
@@ -176,7 +176,7 @@ public class PetApi {
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
public Response uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId
,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata
,@ApiParam(value = "Additional data to pass to server", defaultValue="null")@FormDataParam("additionalMetadata") String additionalMetadata
,
@FormDataParam("file") InputStream fileInputStream,
@FormDataParam("file") FileInfo fileDetail

View File

@@ -69,7 +69,7 @@ public class StoreApi {
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class),
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Order.class) })
public Response getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true, allowableValues="range=[1, 5]") @PathParam("order_id") Long orderId
public Response getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathParam("order_id") Long orderId
)
throws NotFoundException {
return delegate.getOrderById(orderId);

View File

@@ -0,0 +1,50 @@
package org.openapitools.model;
import java.util.Objects;
import java.util.ArrayList;
import java.util.List;
import org.openapitools.model.Animal;
/**
* AnimalFarm
*/
public class AnimalFarm extends ArrayList<Animal> {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return true;
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AnimalFarm {\n");
sb.append(" ").append(toIndentedString(super.toString())).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

@@ -25,7 +25,7 @@ public class Cat extends Animal {
* @return declawed
**/
@ApiModelProperty(value = "")
public Boolean isDeclawed() {
public Boolean getDeclawed() {
return declawed;
}

View File

@@ -41,7 +41,7 @@ public class EnumArrays {
return b;
}
}
return null;
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}
@@ -75,10 +75,10 @@ public class EnumArrays {
return b;
}
}
return null;
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}
@JsonProperty("array_enum")
private List<ArrayEnumEnum> arrayEnum = null;

View File

@@ -35,7 +35,7 @@ public enum EnumClass {
return b;
}
}
return null;
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}

View File

@@ -42,7 +42,7 @@ public class EnumTest {
return b;
}
}
return null;
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}
@@ -78,7 +78,7 @@ public class EnumTest {
return b;
}
}
return null;
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}
@@ -112,7 +112,7 @@ public class EnumTest {
return b;
}
}
return null;
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}
@@ -146,7 +146,7 @@ public class EnumTest {
return b;
}
}
return null;
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}

View File

@@ -0,0 +1,107 @@
package org.openapitools.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;
import java.util.ArrayList;
import java.util.List;
/**
* FileSchemaTestClass
*/
public class FileSchemaTestClass {
@JsonProperty("file")
private java.io.File file = null;
@JsonProperty("files")
private List<java.io.File> files = null;
public FileSchemaTestClass file(java.io.File file) {
this.file = file;
return this;
}
/**
* Get file
* @return file
**/
@ApiModelProperty(value = "")
public java.io.File getFile() {
return file;
}
public void setFile(java.io.File file) {
this.file = file;
}
public FileSchemaTestClass files(List<java.io.File> files) {
this.files = files;
return this;
}
public FileSchemaTestClass addFilesItem(java.io.File filesItem) {
if (this.files == null) {
this.files = new ArrayList<java.io.File>();
}
this.files.add(filesItem);
return this;
}
/**
* Get files
* @return files
**/
@ApiModelProperty(value = "")
public List<java.io.File> getFiles() {
return files;
}
public void setFiles(List<java.io.File> files) {
this.files = files;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o;
return Objects.equals(this.file, fileSchemaTestClass.file) &&
Objects.equals(this.files, fileSchemaTestClass.files);
}
@Override
public int hashCode() {
return Objects.hash(file, files);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class FileSchemaTestClass {\n");
sb.append(" file: ").append(toIndentedString(file)).append("\n");
sb.append(" files: ").append(toIndentedString(files)).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

@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.openapitools.model.StringBooleanMap;
/**
* MapTest
@@ -45,13 +46,19 @@ public class MapTest {
return b;
}
}
return null;
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}
@JsonProperty("map_of_enum_string")
private Map<String, InnerEnum> mapOfEnumString = null;
@JsonProperty("direct_map")
private Map<String, Boolean> directMap = null;
@JsonProperty("indirect_map")
private StringBooleanMap indirectMap = null;
public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) {
this.mapMapOfString = mapMapOfString;
return this;
@@ -104,6 +111,50 @@ public class MapTest {
this.mapOfEnumString = mapOfEnumString;
}
public MapTest directMap(Map<String, Boolean> directMap) {
this.directMap = directMap;
return this;
}
public MapTest putDirectMapItem(String key, Boolean directMapItem) {
if (this.directMap == null) {
this.directMap = new HashMap<String, Boolean>();
}
this.directMap.put(key, directMapItem);
return this;
}
/**
* Get directMap
* @return directMap
**/
@ApiModelProperty(value = "")
public Map<String, Boolean> getDirectMap() {
return directMap;
}
public void setDirectMap(Map<String, Boolean> directMap) {
this.directMap = directMap;
}
public MapTest indirectMap(StringBooleanMap indirectMap) {
this.indirectMap = indirectMap;
return this;
}
/**
* Get indirectMap
* @return indirectMap
**/
@ApiModelProperty(value = "")
public StringBooleanMap getIndirectMap() {
return indirectMap;
}
public void setIndirectMap(StringBooleanMap indirectMap) {
this.indirectMap = indirectMap;
}
@Override
public boolean equals(java.lang.Object o) {
@@ -115,12 +166,14 @@ public class MapTest {
}
MapTest mapTest = (MapTest) o;
return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) &&
Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString);
Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString) &&
Objects.equals(this.directMap, mapTest.directMap) &&
Objects.equals(this.indirectMap, mapTest.indirectMap);
}
@Override
public int hashCode() {
return Objects.hash(mapMapOfString, mapOfEnumString);
return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap);
}
@Override
@@ -130,6 +183,8 @@ public class MapTest {
sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n");
sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n");
sb.append(" directMap: ").append(toIndentedString(directMap)).append("\n");
sb.append(" indirectMap: ").append(toIndentedString(indirectMap)).append("\n");
sb.append("}");
return sb.toString();
}

View File

@@ -54,7 +54,7 @@ public class Order {
return b;
}
}
return null;
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}
@@ -164,7 +164,7 @@ public class Order {
* @return complete
**/
@ApiModelProperty(value = "")
public Boolean isComplete() {
public Boolean getComplete() {
return complete;
}

View File

@@ -35,7 +35,7 @@ public enum OuterEnum {
return b;
}
}
return null;
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}

View File

@@ -60,7 +60,7 @@ public class Pet {
return b;
}
}
return null;
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}

View File

@@ -0,0 +1,49 @@
package org.openapitools.model;
import java.util.Objects;
import java.util.HashMap;
import java.util.Map;
/**
* StringBooleanMap
*/
public class StringBooleanMap extends HashMap<String, Boolean> {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return true;
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class StringBooleanMap {\n");
sb.append(" ").append(toIndentedString(super.toString())).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

@@ -19,7 +19,7 @@ import javax.ws.rs.core.SecurityContext;
public class AnotherFakeApiServiceImpl extends AnotherFakeApiService {
@Override
public Response testSpecialTags(Client client
public Response call123testSpecialTags(Client client
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();

View File

@@ -7,7 +7,9 @@ import java.math.BigDecimal;
import org.openapitools.model.Client;
import java.util.Date;
import java.io.File;
import org.openapitools.model.FileSchemaTestClass;
import java.util.Map;
import org.openapitools.model.ModelApiResponse;
import org.openapitools.model.OuterComposite;
import org.openapitools.model.User;
@@ -25,7 +27,7 @@ import javax.ws.rs.core.SecurityContext;
public class FakeApiServiceImpl extends FakeApiService {
@Override
public Response fakeOuterBooleanSerialize(Boolean booleanPostBody
public Response fakeOuterBooleanSerialize(Boolean body
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
@@ -44,6 +46,12 @@ public class FakeApiServiceImpl extends FakeApiService {
}
@Override
public Response fakeOuterStringSerialize(String body
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
@@ -94,7 +102,7 @@ public class FakeApiServiceImpl extends FakeApiService {
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response testInlineAdditionalProperties(String requestBody
public Response testInlineAdditionalProperties(Map<String, String> requestBody
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
@@ -102,6 +110,14 @@ public class FakeApiServiceImpl extends FakeApiService {
@Override
public Response testJsonFormData(String param
, String param2
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
}
@Override
public Response uploadFileWithRequiredFile(Long petId
, InputStream requiredFileInputStream, FileInfo requiredFileDetail
, String additionalMetadata
) throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();

View File

@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@@ -1 +1 @@
3.0.0-SNAPSHOT
3.2.0-SNAPSHOT

View File

@@ -17,20 +17,20 @@ g)Allow you to integrate with tracing server (Example Zipkin)
h)Allow you to capture log in your microservice and send to Log management server (Ex ELK or splunk)
i)Allow you to configure Oauth2 security based authorization for your microservice
Additonal Features
Additional Features
j)generate sample cucumber file and dependency to drive your Behaviour driven development.
k)generate gatling based perfromance test , which can be excuted via build pipeline like jenkins etc.
k)generate gatling based performance test, which can be excuted via build pipeline like jenkins etc.
Working:
Using swagger specification you can convert any definition to spring boot microservice.
Using OpenAPI specification you can convert any definition to spring boot microservice.
It has the integration with the below services:
eureka registry, zipkin , spring boot admin, circuit breaker.
By default only the circuit breaker annotation is enabled. But one has to write the fallback method. The needed dependency for it is also been enabled. To generate the integration and
related configuration for eureka, zipkin, spring boot admin one has two options:
1) When generating from UI one has to provide vendor extensions inside the swagger specification as below:
1) When generating from UI one has to provide vendor extensions inside the OpenAPI specification as below:
swagger: "2.0"
info:
description: "This is a sample Product Catalogue Server.\
@@ -43,11 +43,11 @@ info:
springBootAdminUri: "http://localhost:8000"
pkmstInterceptor: "true"
PLease note the vendor extensions are inside the info tag of the swagger specification. All the tags are case sensitive. Once given all the related configuration and the dependency
PLease note the vendor extensions are inside the info tag of the OpenAPI specification. All the tags are case sensitive. Once given all the related configuration and the dependency
will be enabled.
2) When generating from the maven plugin one has to provide configuration inside pom as below:
inside the swagger codegen maven plugin under the configuration section
inside the openapi generator maven plugin under the configuration section
<configuration>
<inputSpec>product-openapi.yaml</inputSpec>
@@ -136,7 +136,7 @@ HttpLogging filter is provided for logging in the request and response. Can be f
Spring security is also provided to secure the resources. Please modify according to your needs.
First run:
Import the project in to the eclipse. Run the app as an spring boot application.The project will run on http://localhost:8008
Import the project in to the eclipse. Run the app as a spring boot application.The project will run on http://localhost:8008
Swagger ui available on:
http://localhost:8008/swagger-ui.html
If all the configurations have been enabled(depending on the port) below are some of the URls to access:
@@ -152,4 +152,4 @@ Pkmst examples
https://github.com/ProKarma-Inc/pkmst-getting-started-examples
Pkmst Extensions
https://github.com/ProKarma-Inc/pkmst-extention
https://github.com/ProKarma-Inc/pkmst-extention

View File

@@ -52,10 +52,10 @@
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
@@ -83,35 +83,35 @@
<!-- dependency for zipkin tracing with sleuth -->
<!-- if you only want sleuth -->
<!-- <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency> -->
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency> -->
<!-- Sleuth with Zipkin via Spring Cloud Stream -->
<!-- <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-sleuth-stream</artifactId>
</dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-stream-binder-rabbit</artifactId>
</dependency> -->
</dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-stream-binder-rabbit</artifactId>
</dependency> -->
<!-- Spring Cloud Sleuth Stream Zipkin Collector -->
<!-- <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-sleuth-zipkin-stream</artifactId>
</dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-stream-binder-rabbit</artifactId>
</dependency> -->
</dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-stream-binder-rabbit</artifactId>
</dependency> -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<!--<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix-hystrix-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>-->
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix-hystrix-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
@@ -229,11 +229,11 @@
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
</dependency>
<dependency>
<groupId>org.threeten</groupId>
<artifactId>threetenbp</artifactId>
<version>1.3.6</version>
</dependency>
<dependency>
<groupId>org.threeten</groupId>
<artifactId>threetenbp</artifactId>
<version>1.3.6</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
@@ -263,7 +263,7 @@
<!-- classes that include the name CucumberTest, as an example -->
<exclude>**/*CucumberTest*.java</exclude>
<!-- classes in a package whose last segment is named cucumber, as
an example -->
an example -->
<exclude>**/cucumber/*.java</exclude>
</excludes>
</configuration>
@@ -275,28 +275,28 @@
<version>${scala-maven-plugin.version}</version>
</plugin>
<!--Enable for Gatling -->
<!-- <plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>${gatling-plugin.version}</version>
<configuration>
Run Multiple Simulations
<runMultipleSimulations>true</runMultipleSimulations>
<includes>
<simulationClass>testapi</simulationClass>
</includes>
</configuration>
<executions>
<execution>
<phase>integration-test</phase>
<id>gatling</id>
<goals>
<goal>execute</goal>
</goals>
</execution>
</executions>
</plugin>-->
<!-- <plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>${gatling-plugin.version}</version>
<configuration>
Run Multiple Simulations
<runMultipleSimulations>true</runMultipleSimulations>
<includes>
<simulationClass>testapi</simulationClass>
</includes>
</configuration>
<executions>
<execution>
<phase>integration-test</phase>
<id>gatling</id>
<goals>
<goal>execute</goal>
</goals>
</execution>
</executions>
</plugin>-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
@@ -350,9 +350,9 @@
<version>2.19.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
</plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
</plugin>
</reportPlugins>
</configuration>
</plugin>

View File

@@ -20,7 +20,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
*/
@EnableSwagger2
@Configuration
public class SwaggerDocumentationConfig {
public class OpenAPIDocumentationConfig {
public static final String DEFAULT_INCLUDE_PATTERN = "/pkmst/.*";
@Bean

View File

@@ -1,6 +1,6 @@
/**
* NOTE: This class is auto generated by the swagger code generator program (3.0.0-SNAPSHOT).
* https://github.com/swagger-api/swagger-codegen
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (3.2.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.prokarma.pkmst.controller;
@@ -128,7 +128,7 @@ public interface PetApi {
@RequestMapping(value = "/pet/{petId}",
consumes = { "application/x-www-form-urlencoded" },
method = RequestMethod.POST)
ResponseEntity<Void> updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
ResponseEntity<Void> updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet", defaultValue="null") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestPart(value="status", required=false) String status, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
@ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = {
@@ -143,6 +143,6 @@ public interface PetApi {
produces = { "application/json" },
consumes = { "multipart/form-data" },
method = RequestMethod.POST)
ResponseEntity<ModelApiResponse> uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
ResponseEntity<ModelApiResponse> uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
}

View File

@@ -50,18 +50,48 @@ public class PetApiController implements PetApi {
public ResponseEntity<List<Pet>> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List<String> status,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
if (accept != null && accept.contains("application/json")) {
return new ResponseEntity<List<Pet>>(objectMapper.readValue("", List.class), HttpStatus.OK);
}
if (accept != null && accept.contains("application/xml")) {
return new ResponseEntity<List<Pet>>(objectMapper.readValue("", List.class), HttpStatus.OK);
}
return new ResponseEntity<List<Pet>>(HttpStatus.OK);
}
public ResponseEntity<List<Pet>> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List<String> tags,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
if (accept != null && accept.contains("application/json")) {
return new ResponseEntity<List<Pet>>(objectMapper.readValue("", List.class), HttpStatus.OK);
}
if (accept != null && accept.contains("application/xml")) {
return new ResponseEntity<List<Pet>>(objectMapper.readValue("", List.class), HttpStatus.OK);
}
return new ResponseEntity<List<Pet>>(HttpStatus.OK);
}
public ResponseEntity<Pet> getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
if (accept != null && accept.contains("application/json")) {
return new ResponseEntity<Pet>(objectMapper.readValue("", Pet.class), HttpStatus.OK);
}
if (accept != null && accept.contains("application/xml")) {
return new ResponseEntity<Pet>(objectMapper.readValue("", Pet.class), HttpStatus.OK);
}
return new ResponseEntity<Pet>(HttpStatus.OK);
}
@@ -72,18 +102,23 @@ public class PetApiController implements PetApi {
}
public ResponseEntity<Void> updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,
@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,
@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status,
@ApiParam(value = "Updated name of the pet", defaultValue="null") @RequestPart(value="name", required=false) String name,
@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestPart(value="status", required=false) String status,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
return new ResponseEntity<Void>(HttpStatus.OK);
}
public ResponseEntity<ModelApiResponse> uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,
@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,
@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,
@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
if (accept != null && accept.contains("application/json")) {
return new ResponseEntity<ModelApiResponse>(objectMapper.readValue("", ModelApiResponse.class), HttpStatus.OK);
}
return new ResponseEntity<ModelApiResponse>(HttpStatus.OK);
}

View File

@@ -1,6 +1,6 @@
/**
* NOTE: This class is auto generated by the swagger code generator program (3.0.0-SNAPSHOT).
* https://github.com/swagger-api/swagger-codegen
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (3.2.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.prokarma.pkmst.controller;
@@ -58,7 +58,7 @@ public interface StoreApi {
@RequestMapping(value = "/store/order/{orderId}",
produces = { "application/xml", "application/json" },
method = RequestMethod.GET)
ResponseEntity<Order> getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true, allowableValues="{min=1, max=5}" ) @PathVariable("orderId") Long orderId, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
ResponseEntity<Order> getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
@ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", })

View File

@@ -44,15 +44,35 @@ public class StoreApiController implements StoreApi {
return new ResponseEntity<Map<String, Integer>>(HttpStatus.OK);
}
public ResponseEntity<Order> getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true, allowableValues="{min=1, max=5}" ) @PathVariable("orderId") Long orderId,
public ResponseEntity<Order> getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
if (accept != null && accept.contains("application/json")) {
return new ResponseEntity<Order>(objectMapper.readValue("", Order.class), HttpStatus.OK);
}
if (accept != null && accept.contains("application/xml")) {
return new ResponseEntity<Order>(objectMapper.readValue("", Order.class), HttpStatus.OK);
}
return new ResponseEntity<Order>(HttpStatus.OK);
}
public ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order order,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
if (accept != null && accept.contains("application/json")) {
return new ResponseEntity<Order>(objectMapper.readValue("", Order.class), HttpStatus.OK);
}
if (accept != null && accept.contains("application/xml")) {
return new ResponseEntity<Order>(objectMapper.readValue("", Order.class), HttpStatus.OK);
}
return new ResponseEntity<Order>(HttpStatus.OK);
}

View File

@@ -1,6 +1,6 @@
/**
* NOTE: This class is auto generated by the swagger code generator program (3.0.0-SNAPSHOT).
* https://github.com/swagger-api/swagger-codegen
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (3.2.0-SNAPSHOT).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.prokarma.pkmst.controller;

View File

@@ -60,6 +60,16 @@ public class UserApiController implements UserApi {
public ResponseEntity<User> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true ) @PathVariable("username") String username,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
if (accept != null && accept.contains("application/json")) {
return new ResponseEntity<User>(objectMapper.readValue("", User.class), HttpStatus.OK);
}
if (accept != null && accept.contains("application/xml")) {
return new ResponseEntity<User>(objectMapper.readValue("", User.class), HttpStatus.OK);
}
return new ResponseEntity<User>(HttpStatus.OK);
}

View File

@@ -60,7 +60,7 @@ public class Order {
return b;
}
}
return null;
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}
@@ -170,7 +170,7 @@ public class Order {
* @return complete
**/
@ApiModelProperty(value = "")
public Boolean isComplete() {
public Boolean getComplete() {
return complete;
}

View File

@@ -68,7 +68,7 @@ public class Pet {
return b;
}
}
return null;
throw new IllegalArgumentException("Unexpected value '" + text + "'");
}
}

View File

@@ -1,6 +1,6 @@
# Discovery Server Access
server:
port: -1
port: 8080
# Spring Actuator
management:

View File

@@ -1,6 +1,6 @@
# Discovery Server Access
server:
port: -1
port: 8080
# Spring Actuator
management:

View File

@@ -1 +1 @@
3.0.0-SNAPSHOT
3.2.0-SNAPSHOT

View File

@@ -99,7 +99,7 @@ public class Order {
@JsonProperty("complete")
public Boolean isComplete() {
public Boolean getComplete() {
return complete;
}
public void setComplete(Boolean complete) {

View File

@@ -112,13 +112,14 @@
"in" : "query",
"description" : "Status values that need to be considered for filter",
"required" : true,
"style" : "form",
"explode" : false,
"schema" : {
"type" : "array",
"items" : {
"type" : "string",
"default" : "available",
"enum" : [ "available", "pending", "sold" ]
"enum" : [ "available", "pending", "sold" ],
"default" : "available"
}
}
} ],
@@ -168,6 +169,7 @@
"in" : "query",
"description" : "Tags to filter by",
"required" : true,
"style" : "form",
"explode" : false,
"schema" : {
"type" : "array",

View File

@@ -1 +1 @@
3.0.0-SNAPSHOT
3.2.0-SNAPSHOT

View File

@@ -99,7 +99,7 @@ public class Order {
@JsonProperty("complete")
public Boolean isComplete() {
public Boolean getComplete() {
return complete;
}
public void setComplete(Boolean complete) {

View File

@@ -112,13 +112,14 @@
"in" : "query",
"description" : "Status values that need to be considered for filter",
"required" : true,
"style" : "form",
"explode" : false,
"schema" : {
"type" : "array",
"items" : {
"type" : "string",
"default" : "available",
"enum" : [ "available", "pending", "sold" ]
"enum" : [ "available", "pending", "sold" ],
"default" : "available"
}
}
} ],
@@ -168,6 +169,7 @@
"in" : "query",
"description" : "Tags to filter by",
"required" : true,
"style" : "form",
"explode" : false,
"schema" : {
"type" : "array",