forked from loafle/openapi-generator-original
[Java][Spring] Fix spring cloud client due to enhancement in adding server example responses. (#5497)
* add use spring cloud client option * uncomment spring cloud client test * remove scala-related tests from pom.xml for circleci * fix mismstach tag
This commit is contained in:
parent
e8feca2753
commit
42a5a13fef
@ -206,8 +206,8 @@ public class SpringCodegen extends AbstractJavaCodegen implements BeanValidation
|
||||
if (!additionalProperties.containsKey(SINGLE_CONTENT_TYPES)) {
|
||||
additionalProperties.put(SINGLE_CONTENT_TYPES, "true");
|
||||
this.setSingleContentTypes(true);
|
||||
|
||||
}
|
||||
additionalProperties.put("useSpringCloudClient", true);
|
||||
|
||||
} else {
|
||||
apiTemplateFiles.put("apiController.mustache", "Controller.java");
|
||||
|
@ -16,7 +16,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
{{#useSpringCloudClient}}
|
||||
import java.io.IOException;
|
||||
{{/useSpringCloudClient}}
|
||||
|
||||
import java.util.List;
|
||||
{{#async}}
|
||||
@ -52,11 +54,20 @@ public interface {{classname}} {
|
||||
produces = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}}{{#hasConsumes}}
|
||||
consumes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}}{{/singleContentTypes}}
|
||||
method = RequestMethod.{{httpMethod}})
|
||||
{{#useSpringCloudClient}}
|
||||
{{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}){{^jdk8}};{{/jdk8}}{{#jdk8}} {
|
||||
// do some magic!
|
||||
return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK){{#async}}){{/async}};
|
||||
}{{/jdk8}}
|
||||
|
||||
{{/useSpringCloudClient}}
|
||||
{{^useSpringCloudClient}}
|
||||
{{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},{{/allParams}} @RequestHeader("Accept") String accept){{#examples}}{{#-first}} throws IOException{{/-first}}{{/examples}}{{^jdk8}};{{/jdk8}}{{#jdk8}} {
|
||||
// do some magic!
|
||||
return {{#async}}CompletableFuture.completedFuture({{/async}}new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK){{#async}}){{/async}};
|
||||
}{{/jdk8}}
|
||||
|
||||
{{/useSpringCloudClient}}
|
||||
{{/operation}}
|
||||
}
|
||||
{{/operations}}
|
||||
|
@ -17,8 +17,10 @@ import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
{{^useSpringCloudClient}}
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import java.io.IOException;
|
||||
{{/useSpringCloudClient}}
|
||||
|
||||
import java.util.List;
|
||||
{{#async}}
|
||||
@ -52,6 +54,25 @@ public class {{classname}}Controller implements {{classname}} {
|
||||
public {{#async}}Callable<{{/async}}ResponseEntity<{{>returnTypes}}>{{#async}}>{{/async}} {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}},
|
||||
{{/allParams}}@RequestHeader("Accept") String accept){{#examples}}{{#-first}} throws IOException{{/-first}}{{/examples}} {
|
||||
// do some magic!
|
||||
{{#useSpringCloudClient}}
|
||||
{{^isDelegate}}
|
||||
{{^async}}
|
||||
return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK);
|
||||
{{/async}}
|
||||
{{#async}}
|
||||
return new Callable<ResponseEntity<{{>returnTypes}}>>() {
|
||||
@Override
|
||||
public ResponseEntity<{{>returnTypes}}> call() throws Exception {
|
||||
return new ResponseEntity<{{>returnTypes}}>(HttpStatus.OK);
|
||||
}
|
||||
};
|
||||
{{/async}}
|
||||
{{/isDelegate}}
|
||||
{{#isDelegate}}
|
||||
return delegate.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
{{/isDelegate}}
|
||||
{{/useSpringCloudClient}}
|
||||
{{^useSpringCloudClient}}
|
||||
{{^isDelegate}}
|
||||
{{^async}}
|
||||
{{#examples}}
|
||||
@ -75,6 +96,7 @@ public class {{classname}}Controller implements {{classname}} {
|
||||
{{#isDelegate}}
|
||||
return delegate.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
{{/isDelegate}}
|
||||
{{/useSpringCloudClient}}
|
||||
}
|
||||
|
||||
{{/operation}}
|
||||
|
4
pom.xml
4
pom.xml
@ -831,15 +831,13 @@
|
||||
<module>samples/server/petstore/jaxrs-resteasy/joda</module>
|
||||
<module>samples/server/petstore/scalatra</module>
|
||||
<module>samples/server/petstore/spring-mvc</module>
|
||||
<!-- comment out due to change in method signature
|
||||
<module>samples/client/petstore/spring-cloud</module> -->
|
||||
<module>samples/client/petstore/spring-cloud</module>
|
||||
<module>samples/server/petstore/springboot</module>
|
||||
<module>samples/server/petstore/springboot-beanvalidation</module>
|
||||
<module>samples/server/petstore/jaxrs-cxf</module>
|
||||
<module>samples/server/petstore/jaxrs-cxf-annotated-base-path</module>
|
||||
<module>samples/server/petstore/jaxrs-cxf-cdi</module>
|
||||
<module>samples/server/petstore/jaxrs-cxf-non-spring-app</module>
|
||||
|
||||
<!--<module>samples/server/petstore/java-msf4j</module> note: JDK8 only -->
|
||||
</modules>
|
||||
</profile>
|
||||
|
@ -31,7 +31,6 @@ public interface PetApi {
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
|
||||
|
||||
@RequestMapping(value = "/pet",
|
||||
produces = "application/json",
|
||||
consumes = "application/json",
|
||||
@ -47,7 +46,6 @@ public interface PetApi {
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) })
|
||||
|
||||
@RequestMapping(value = "/pet/{petId}",
|
||||
produces = "application/json",
|
||||
consumes = "application/json",
|
||||
@ -64,12 +62,11 @@ public interface PetApi {
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Pet.class),
|
||||
@ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) })
|
||||
|
||||
@RequestMapping(value = "/pet/findByStatus",
|
||||
produces = "application/json",
|
||||
consumes = "application/json",
|
||||
method = RequestMethod.GET)
|
||||
com.netflix.hystrix.HystrixCommand<ResponseEntity<List<Pet>>> findPetsByStatus( @NotNull @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) throws IOException;
|
||||
com.netflix.hystrix.HystrixCommand<ResponseEntity<List<Pet>>> findPetsByStatus( @NotNull@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);
|
||||
|
||||
|
||||
@ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = {
|
||||
@ -81,12 +78,11 @@ public interface PetApi {
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Pet.class),
|
||||
@ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) })
|
||||
|
||||
@RequestMapping(value = "/pet/findByTags",
|
||||
produces = "application/json",
|
||||
consumes = "application/json",
|
||||
method = RequestMethod.GET)
|
||||
com.netflix.hystrix.HystrixCommand<ResponseEntity<List<Pet>>> findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List<String> tags) throws IOException;
|
||||
com.netflix.hystrix.HystrixCommand<ResponseEntity<List<Pet>>> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List<String> tags);
|
||||
|
||||
|
||||
@ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = {
|
||||
@ -96,12 +92,11 @@ public interface PetApi {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Pet.class),
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class),
|
||||
@ApiResponse(code = 404, message = "Pet not found", response = Pet.class) })
|
||||
|
||||
@RequestMapping(value = "/pet/{petId}",
|
||||
produces = "application/json",
|
||||
consumes = "application/json",
|
||||
method = RequestMethod.GET)
|
||||
com.netflix.hystrix.HystrixCommand<ResponseEntity<Pet>> getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) throws IOException;
|
||||
com.netflix.hystrix.HystrixCommand<ResponseEntity<Pet>> getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId);
|
||||
|
||||
|
||||
@ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = {
|
||||
@ -114,7 +109,6 @@ public interface PetApi {
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
|
||||
@ApiResponse(code = 404, message = "Pet not found", response = Void.class),
|
||||
@ApiResponse(code = 405, message = "Validation exception", response = Void.class) })
|
||||
|
||||
@RequestMapping(value = "/pet",
|
||||
produces = "application/json",
|
||||
consumes = "application/json",
|
||||
@ -130,7 +124,6 @@ public interface PetApi {
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
|
||||
|
||||
@RequestMapping(value = "/pet/{petId}",
|
||||
produces = "application/json",
|
||||
consumes = "application/x-www-form-urlencoded",
|
||||
@ -146,11 +139,10 @@ public interface PetApi {
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
|
||||
@RequestMapping(value = "/pet/{petId}/uploadImage",
|
||||
produces = "application/json",
|
||||
consumes = "multipart/form-data",
|
||||
method = RequestMethod.POST)
|
||||
com.netflix.hystrix.HystrixCommand<ResponseEntity<ModelApiResponse>> uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server" ) @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestParam("file") MultipartFile file) throws IOException;
|
||||
com.netflix.hystrix.HystrixCommand<ResponseEntity<ModelApiResponse>> uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server" ) @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestParam("file") MultipartFile file);
|
||||
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ public interface StoreApi {
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
|
||||
@ApiResponse(code = 404, message = "Order not found", response = Void.class) })
|
||||
|
||||
@RequestMapping(value = "/store/order/{orderId}",
|
||||
produces = "application/json",
|
||||
consumes = "application/json",
|
||||
@ -39,12 +38,11 @@ public interface StoreApi {
|
||||
}, tags={ "store", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Integer.class) })
|
||||
|
||||
@RequestMapping(value = "/store/inventory",
|
||||
produces = "application/json",
|
||||
consumes = "application/json",
|
||||
method = RequestMethod.GET)
|
||||
com.netflix.hystrix.HystrixCommand<ResponseEntity<Map<String, Integer>>> getInventory() throws IOException;
|
||||
com.netflix.hystrix.HystrixCommand<ResponseEntity<Map<String, Integer>>> getInventory();
|
||||
|
||||
|
||||
@ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", })
|
||||
@ -52,23 +50,21 @@ public interface StoreApi {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Order.class),
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class),
|
||||
@ApiResponse(code = 404, message = "Order not found", response = Order.class) })
|
||||
|
||||
@RequestMapping(value = "/store/order/{orderId}",
|
||||
produces = "application/json",
|
||||
consumes = "application/json",
|
||||
method = RequestMethod.GET)
|
||||
com.netflix.hystrix.HystrixCommand<ResponseEntity<Order>> getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId) throws IOException;
|
||||
com.netflix.hystrix.HystrixCommand<ResponseEntity<Order>> getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId);
|
||||
|
||||
|
||||
@ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Order.class),
|
||||
@ApiResponse(code = 400, message = "Invalid Order", response = Order.class) })
|
||||
|
||||
@RequestMapping(value = "/store/order",
|
||||
produces = "application/json",
|
||||
consumes = "application/json",
|
||||
method = RequestMethod.POST)
|
||||
com.netflix.hystrix.HystrixCommand<ResponseEntity<Order>> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) throws IOException;
|
||||
com.netflix.hystrix.HystrixCommand<ResponseEntity<Order>> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body);
|
||||
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ public interface UserApi {
|
||||
@ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Void.class) })
|
||||
|
||||
@RequestMapping(value = "/user",
|
||||
produces = "application/json",
|
||||
consumes = "application/json",
|
||||
@ -36,7 +35,6 @@ public interface UserApi {
|
||||
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Void.class) })
|
||||
|
||||
@RequestMapping(value = "/user/createWithArray",
|
||||
produces = "application/json",
|
||||
consumes = "application/json",
|
||||
@ -47,7 +45,6 @@ public interface UserApi {
|
||||
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Void.class) })
|
||||
|
||||
@RequestMapping(value = "/user/createWithList",
|
||||
produces = "application/json",
|
||||
consumes = "application/json",
|
||||
@ -59,7 +56,6 @@ public interface UserApi {
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class),
|
||||
@ApiResponse(code = 404, message = "User not found", response = Void.class) })
|
||||
|
||||
@RequestMapping(value = "/user/{username}",
|
||||
produces = "application/json",
|
||||
consumes = "application/json",
|
||||
@ -72,30 +68,27 @@ public interface UserApi {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = User.class),
|
||||
@ApiResponse(code = 400, message = "Invalid username supplied", response = User.class),
|
||||
@ApiResponse(code = 404, message = "User not found", response = User.class) })
|
||||
|
||||
@RequestMapping(value = "/user/{username}",
|
||||
produces = "application/json",
|
||||
consumes = "application/json",
|
||||
method = RequestMethod.GET)
|
||||
com.netflix.hystrix.HystrixCommand<ResponseEntity<User>> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) throws IOException;
|
||||
com.netflix.hystrix.HystrixCommand<ResponseEntity<User>> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username);
|
||||
|
||||
|
||||
@ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = String.class),
|
||||
@ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) })
|
||||
|
||||
@RequestMapping(value = "/user/login",
|
||||
produces = "application/json",
|
||||
consumes = "application/json",
|
||||
method = RequestMethod.GET)
|
||||
com.netflix.hystrix.HystrixCommand<ResponseEntity<String>> loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password) throws IOException;
|
||||
com.netflix.hystrix.HystrixCommand<ResponseEntity<String>> loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password);
|
||||
|
||||
|
||||
@ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = Void.class) })
|
||||
|
||||
@RequestMapping(value = "/user/logout",
|
||||
produces = "application/json",
|
||||
consumes = "application/json",
|
||||
@ -107,7 +100,6 @@ public interface UserApi {
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class),
|
||||
@ApiResponse(code = 404, message = "User not found", response = Void.class) })
|
||||
|
||||
@RequestMapping(value = "/user/{username}",
|
||||
produces = "application/json",
|
||||
consumes = "application/json",
|
||||
|
@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* A category for a pet
|
||||
*/
|
||||
@ -28,6 +30,8 @@ public class Category {
|
||||
* @return id
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
@ -46,6 +50,8 @@ public class Category {
|
||||
* @return name
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* Describes the result of uploading an image resource
|
||||
*/
|
||||
@ -31,6 +33,8 @@ public class ModelApiResponse {
|
||||
* @return code
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
@ -49,6 +53,8 @@ public class ModelApiResponse {
|
||||
* @return type
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
@ -67,6 +73,8 @@ public class ModelApiResponse {
|
||||
* @return message
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
@ -7,7 +7,9 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.joda.time.DateTime;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* An order for a pets from the pet store
|
||||
*/
|
||||
@ -75,6 +77,8 @@ public class Order {
|
||||
* @return id
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
@ -93,6 +97,8 @@ public class Order {
|
||||
* @return petId
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public Long getPetId() {
|
||||
return petId;
|
||||
}
|
||||
@ -111,6 +117,8 @@ public class Order {
|
||||
* @return quantity
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public Integer getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
@ -129,6 +137,8 @@ public class Order {
|
||||
* @return shipDate
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public DateTime getShipDate() {
|
||||
return shipDate;
|
||||
}
|
||||
@ -147,6 +157,8 @@ public class Order {
|
||||
* @return status
|
||||
**/
|
||||
@ApiModelProperty(value = "Order Status")
|
||||
|
||||
@Valid
|
||||
public StatusEnum getStatus() {
|
||||
return status;
|
||||
}
|
||||
@ -165,6 +177,8 @@ public class Order {
|
||||
* @return complete
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public Boolean getComplete() {
|
||||
return complete;
|
||||
}
|
||||
|
@ -10,7 +10,9 @@ import io.swagger.model.Category;
|
||||
import io.swagger.model.Tag;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* A pet for sale in the pet store
|
||||
*/
|
||||
@ -78,6 +80,8 @@ public class Pet {
|
||||
* @return id
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
@ -96,6 +100,8 @@ public class Pet {
|
||||
* @return category
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public Category getCategory() {
|
||||
return category;
|
||||
}
|
||||
@ -115,6 +121,8 @@ public class Pet {
|
||||
**/
|
||||
@ApiModelProperty(example = "doggie", required = true, value = "")
|
||||
@NotNull
|
||||
|
||||
@Valid
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@ -139,6 +147,8 @@ public class Pet {
|
||||
**/
|
||||
@ApiModelProperty(required = true, value = "")
|
||||
@NotNull
|
||||
|
||||
@Valid
|
||||
public List<String> getPhotoUrls() {
|
||||
return photoUrls;
|
||||
}
|
||||
@ -165,6 +175,8 @@ public class Pet {
|
||||
* @return tags
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public List<Tag> getTags() {
|
||||
return tags;
|
||||
}
|
||||
@ -183,6 +195,8 @@ public class Pet {
|
||||
* @return status
|
||||
**/
|
||||
@ApiModelProperty(value = "pet status in the store")
|
||||
|
||||
@Valid
|
||||
public StatusEnum getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* A tag for a pet
|
||||
*/
|
||||
@ -28,6 +30,8 @@ public class Tag {
|
||||
* @return id
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
@ -46,6 +50,8 @@ public class Tag {
|
||||
* @return name
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
@ -5,7 +5,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* A User who is purchasing from the pet store
|
||||
*/
|
||||
@ -46,6 +48,8 @@ public class User {
|
||||
* @return id
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
@ -64,6 +68,8 @@ public class User {
|
||||
* @return username
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
@ -82,6 +88,8 @@ public class User {
|
||||
* @return firstName
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
@ -100,6 +108,8 @@ public class User {
|
||||
* @return lastName
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
@ -118,6 +128,8 @@ public class User {
|
||||
* @return email
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
@ -136,6 +148,8 @@ public class User {
|
||||
* @return password
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
@ -154,6 +168,8 @@ public class User {
|
||||
* @return phone
|
||||
**/
|
||||
@ApiModelProperty(value = "")
|
||||
|
||||
@Valid
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
@ -172,6 +188,8 @@ public class User {
|
||||
* @return userStatus
|
||||
**/
|
||||
@ApiModelProperty(value = "User Status")
|
||||
|
||||
@Valid
|
||||
public Integer getUserStatus() {
|
||||
return userStatus;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user