update spring petstore sample

This commit is contained in:
wing328 2017-04-13 17:44:38 +08:00
parent 8cf0f7046e
commit 0682e41d6d
64 changed files with 254 additions and 188 deletions

View File

@ -17,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "Pet", description = "the Pet API") @Api(value = "Pet", description = "the Pet API")
public interface PetApi { public interface PetApi {
@ -34,7 +35,7 @@ public interface PetApi {
produces = "application/json", produces = "application/json",
consumes = "application/json", consumes = "application/json",
method = RequestMethod.POST) method = RequestMethod.POST)
com.netflix.hystrix.HystrixCommand<ResponseEntity<Void>> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body); com.netflix.hystrix.HystrixCommand<ResponseEntity<Void>> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body);
@ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = {
@ -117,7 +118,7 @@ public interface PetApi {
produces = "application/json", produces = "application/json",
consumes = "application/json", consumes = "application/json",
method = RequestMethod.PUT) method = RequestMethod.PUT)
com.netflix.hystrix.HystrixCommand<ResponseEntity<Void>> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body); com.netflix.hystrix.HystrixCommand<ResponseEntity<Void>> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body);
@ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = {

View File

@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "Store", description = "the Store API") @Api(value = "Store", description = "the Store API")
public interface StoreApi { public interface StoreApi {
@ -67,6 +68,6 @@ public interface StoreApi {
produces = "application/json", produces = "application/json",
consumes = "application/json", consumes = "application/json",
method = RequestMethod.POST) method = RequestMethod.POST)
com.netflix.hystrix.HystrixCommand<ResponseEntity<Order>> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body); com.netflix.hystrix.HystrixCommand<ResponseEntity<Order>> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body);
} }

View File

@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "User", description = "the User API") @Api(value = "User", description = "the User API")
public interface UserApi { public interface UserApi {
@ -28,7 +29,7 @@ public interface UserApi {
produces = "application/json", produces = "application/json",
consumes = "application/json", consumes = "application/json",
method = RequestMethod.POST) method = RequestMethod.POST)
com.netflix.hystrix.HystrixCommand<ResponseEntity<Void>> createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body); com.netflix.hystrix.HystrixCommand<ResponseEntity<Void>> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body);
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", })
@ -39,7 +40,7 @@ public interface UserApi {
produces = "application/json", produces = "application/json",
consumes = "application/json", consumes = "application/json",
method = RequestMethod.POST) method = RequestMethod.POST)
com.netflix.hystrix.HystrixCommand<ResponseEntity<Void>> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body); com.netflix.hystrix.HystrixCommand<ResponseEntity<Void>> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body);
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", })
@ -50,7 +51,7 @@ public interface UserApi {
produces = "application/json", produces = "application/json",
consumes = "application/json", consumes = "application/json",
method = RequestMethod.POST) method = RequestMethod.POST)
com.netflix.hystrix.HystrixCommand<ResponseEntity<Void>> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body); com.netflix.hystrix.HystrixCommand<ResponseEntity<Void>> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body);
@ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", })
@ -110,6 +111,6 @@ public interface UserApi {
produces = "application/json", produces = "application/json",
consumes = "application/json", consumes = "application/json",
method = RequestMethod.PUT) method = RequestMethod.PUT)
com.netflix.hystrix.HystrixCommand<ResponseEntity<Void>> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body); com.netflix.hystrix.HystrixCommand<ResponseEntity<Void>> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body);
} }

View File

@ -17,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "pet", description = "the pet API") @Api(value = "pet", description = "the pet API")
public interface PetApi { public interface PetApi {
@ -34,7 +35,7 @@ public interface PetApi {
produces = "application/json", produces = "application/json",
consumes = "application/json", consumes = "application/json",
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body); ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body);
@ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = {
@ -117,7 +118,7 @@ public interface PetApi {
produces = "application/json", produces = "application/json",
consumes = "application/json", consumes = "application/json",
method = RequestMethod.PUT) method = RequestMethod.PUT)
ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body); ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body);
@ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = {

View File

@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "store", description = "the store API") @Api(value = "store", description = "the store API")
public interface StoreApi { public interface StoreApi {
@ -67,6 +68,6 @@ public interface StoreApi {
produces = "application/json", produces = "application/json",
consumes = "application/json", consumes = "application/json",
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body); ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body);
} }

View File

@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "user", description = "the user API") @Api(value = "user", description = "the user API")
public interface UserApi { public interface UserApi {
@ -28,7 +29,7 @@ public interface UserApi {
produces = "application/json", produces = "application/json",
consumes = "application/json", consumes = "application/json",
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body); ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body);
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", })
@ -39,7 +40,7 @@ public interface UserApi {
produces = "application/json", produces = "application/json",
consumes = "application/json", consumes = "application/json",
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body); ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body);
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", })
@ -50,7 +51,7 @@ public interface UserApi {
produces = "application/json", produces = "application/json",
consumes = "application/json", consumes = "application/json",
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body); ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body);
@ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", })
@ -110,6 +111,6 @@ public interface UserApi {
produces = "application/json", produces = "application/json",
consumes = "application/json", consumes = "application/json",
method = RequestMethod.PUT) method = RequestMethod.PUT)
ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body); ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body);
} }

View File

@ -20,6 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "fake", description = "the fake API") @Api(value = "fake", description = "the fake API")
public interface FakeApi { public interface FakeApi {
@ -32,7 +33,7 @@ public interface FakeApi {
produces = { "application/json" }, produces = { "application/json" },
consumes = { "application/json" }, consumes = { "application/json" },
method = RequestMethod.PATCH) method = RequestMethod.PATCH)
default CompletableFuture<ResponseEntity<Client>> testClientModel(@ApiParam(value = "client model" ,required=true ) @RequestBody Client body) { default CompletableFuture<ResponseEntity<Client>> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
// do some magic! // do some magic!
return CompletableFuture.completedFuture(new ResponseEntity<Client>(HttpStatus.OK)); return CompletableFuture.completedFuture(new ResponseEntity<Client>(HttpStatus.OK));
} }

View File

@ -3,6 +3,7 @@ package io.swagger.api;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller @Controller
public class FakeApiController implements FakeApi { public class FakeApiController implements FakeApi {

View File

@ -19,6 +19,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "pet", description = "the pet API") @Api(value = "pet", description = "the pet API")
public interface PetApi { public interface PetApi {
@ -36,7 +37,7 @@ public interface PetApi {
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
consumes = { "application/json", "application/xml" }, consumes = { "application/json", "application/xml" },
method = RequestMethod.POST) method = RequestMethod.POST)
default CompletableFuture<ResponseEntity<Void>> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body) { default CompletableFuture<ResponseEntity<Void>> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
// do some magic! // do some magic!
return CompletableFuture.completedFuture(new ResponseEntity<Void>(HttpStatus.OK)); return CompletableFuture.completedFuture(new ResponseEntity<Void>(HttpStatus.OK));
} }
@ -130,7 +131,7 @@ public interface PetApi {
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
consumes = { "application/json", "application/xml" }, consumes = { "application/json", "application/xml" },
method = RequestMethod.PUT) method = RequestMethod.PUT)
default CompletableFuture<ResponseEntity<Void>> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body) { default CompletableFuture<ResponseEntity<Void>> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
// do some magic! // do some magic!
return CompletableFuture.completedFuture(new ResponseEntity<Void>(HttpStatus.OK)); return CompletableFuture.completedFuture(new ResponseEntity<Void>(HttpStatus.OK));
} }

View File

@ -3,6 +3,7 @@ package io.swagger.api;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller @Controller
public class PetApiController implements PetApi { public class PetApiController implements PetApi {

View File

@ -18,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "store", description = "the store API") @Api(value = "store", description = "the store API")
public interface StoreApi { public interface StoreApi {
@ -74,7 +75,7 @@ public interface StoreApi {
@RequestMapping(value = "/store/order", @RequestMapping(value = "/store/order",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
default CompletableFuture<ResponseEntity<Order>> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body) { default CompletableFuture<ResponseEntity<Order>> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) {
// do some magic! // do some magic!
return CompletableFuture.completedFuture(new ResponseEntity<Order>(HttpStatus.OK)); return CompletableFuture.completedFuture(new ResponseEntity<Order>(HttpStatus.OK));
} }

View File

@ -3,6 +3,7 @@ package io.swagger.api;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller @Controller
public class StoreApiController implements StoreApi { public class StoreApiController implements StoreApi {

View File

@ -18,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "user", description = "the user API") @Api(value = "user", description = "the user API")
public interface UserApi { public interface UserApi {
@ -29,7 +30,7 @@ public interface UserApi {
@RequestMapping(value = "/user", @RequestMapping(value = "/user",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
default CompletableFuture<ResponseEntity<Void>> createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body) { default CompletableFuture<ResponseEntity<Void>> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) {
// do some magic! // do some magic!
return CompletableFuture.completedFuture(new ResponseEntity<Void>(HttpStatus.OK)); return CompletableFuture.completedFuture(new ResponseEntity<Void>(HttpStatus.OK));
} }
@ -42,7 +43,7 @@ public interface UserApi {
@RequestMapping(value = "/user/createWithArray", @RequestMapping(value = "/user/createWithArray",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
default CompletableFuture<ResponseEntity<Void>> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body) { default CompletableFuture<ResponseEntity<Void>> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body) {
// do some magic! // do some magic!
return CompletableFuture.completedFuture(new ResponseEntity<Void>(HttpStatus.OK)); return CompletableFuture.completedFuture(new ResponseEntity<Void>(HttpStatus.OK));
} }
@ -55,7 +56,7 @@ public interface UserApi {
@RequestMapping(value = "/user/createWithList", @RequestMapping(value = "/user/createWithList",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
default CompletableFuture<ResponseEntity<Void>> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body) { default CompletableFuture<ResponseEntity<Void>> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body) {
// do some magic! // do some magic!
return CompletableFuture.completedFuture(new ResponseEntity<Void>(HttpStatus.OK)); return CompletableFuture.completedFuture(new ResponseEntity<Void>(HttpStatus.OK));
} }
@ -125,7 +126,7 @@ public interface UserApi {
@RequestMapping(value = "/user/{username}", @RequestMapping(value = "/user/{username}",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.PUT) method = RequestMethod.PUT)
default CompletableFuture<ResponseEntity<Void>> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body) { default CompletableFuture<ResponseEntity<Void>> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) {
// do some magic! // do some magic!
return CompletableFuture.completedFuture(new ResponseEntity<Void>(HttpStatus.OK)); return CompletableFuture.completedFuture(new ResponseEntity<Void>(HttpStatus.OK));
} }

View File

@ -3,6 +3,7 @@ package io.swagger.api;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller @Controller
public class UserApiController implements UserApi { public class UserApiController implements UserApi {

View File

@ -18,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "fake", description = "the fake API") @Api(value = "fake", description = "the fake API")
public interface FakeApi { public interface FakeApi {
@ -30,7 +31,7 @@ public interface FakeApi {
produces = { "application/json" }, produces = { "application/json" },
consumes = { "application/json" }, consumes = { "application/json" },
method = RequestMethod.PATCH) method = RequestMethod.PATCH)
ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @RequestBody Client body); ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body);
@ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = Void.class, authorizations = { @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = Void.class, authorizations = {

View File

@ -20,13 +20,14 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller @Controller
public class FakeApiController implements FakeApi { public class FakeApiController implements FakeApi {
public ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @RequestBody Client body) { public ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
// do some magic! // do some magic!
return new ResponseEntity<Client>(HttpStatus.OK); return new ResponseEntity<Client>(HttpStatus.OK);
} }

View File

@ -17,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "pet", description = "the pet API") @Api(value = "pet", description = "the pet API")
public interface PetApi { public interface PetApi {
@ -34,7 +35,7 @@ public interface PetApi {
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
consumes = { "application/json", "application/xml" }, consumes = { "application/json", "application/xml" },
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body); ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body);
@ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = {
@ -113,7 +114,7 @@ public interface PetApi {
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
consumes = { "application/json", "application/xml" }, consumes = { "application/json", "application/xml" },
method = RequestMethod.PUT) method = RequestMethod.PUT)
ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body); ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body);
@ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = {

View File

@ -19,13 +19,14 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller @Controller
public class PetApiController implements PetApi { public class PetApiController implements PetApi {
public ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body) { public ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }
@ -51,7 +52,7 @@ public class PetApiController implements PetApi {
return new ResponseEntity<Pet>(HttpStatus.OK); return new ResponseEntity<Pet>(HttpStatus.OK);
} }
public ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body) { public ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }

View File

@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "store", description = "the store API") @Api(value = "store", description = "the store API")
public interface StoreApi { public interface StoreApi {
@ -63,6 +64,6 @@ public interface StoreApi {
@RequestMapping(value = "/store/order", @RequestMapping(value = "/store/order",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body); ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body);
} }

View File

@ -18,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller @Controller
public class StoreApiController implements StoreApi { public class StoreApiController implements StoreApi {
@ -39,7 +40,7 @@ public class StoreApiController implements StoreApi {
return new ResponseEntity<Order>(HttpStatus.OK); return new ResponseEntity<Order>(HttpStatus.OK);
} }
public ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body) { public ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) {
// do some magic! // do some magic!
return new ResponseEntity<Order>(HttpStatus.OK); return new ResponseEntity<Order>(HttpStatus.OK);
} }

View File

@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "user", description = "the user API") @Api(value = "user", description = "the user API")
public interface UserApi { public interface UserApi {
@ -27,7 +28,7 @@ public interface UserApi {
@RequestMapping(value = "/user", @RequestMapping(value = "/user",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body); ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body);
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", })
@ -37,7 +38,7 @@ public interface UserApi {
@RequestMapping(value = "/user/createWithArray", @RequestMapping(value = "/user/createWithArray",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body); ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body);
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", })
@ -47,7 +48,7 @@ public interface UserApi {
@RequestMapping(value = "/user/createWithList", @RequestMapping(value = "/user/createWithList",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body); ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body);
@ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", })
@ -102,6 +103,6 @@ public interface UserApi {
@RequestMapping(value = "/user/{username}", @RequestMapping(value = "/user/{username}",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.PUT) method = RequestMethod.PUT)
ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body); ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body);
} }

View File

@ -18,23 +18,24 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller @Controller
public class UserApiController implements UserApi { public class UserApiController implements UserApi {
public ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body) { public ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }
public ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body) { public ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }
public ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body) { public ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }
@ -61,7 +62,7 @@ public class UserApiController implements UserApi {
} }
public ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, public ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,
@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body) { @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }

View File

@ -9,12 +9,12 @@
<java.version>1.7</java.version> <java.version>1.7</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source> <maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target> <maven.compiler.target>${java.version}</maven.compiler.target>
<springfox-version>2.5.0</springfox-version> <springfox-version>2.6.1</springfox-version>
</properties> </properties>
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version> <version>1.4.5.RELEASE</version>
</parent> </parent>
<build> <build>
<sourceDirectory>src/main/java</sourceDirectory> <sourceDirectory>src/main/java</sourceDirectory>

View File

@ -26,6 +26,7 @@ public interface FakeApi {
@ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Client.class) }) @ApiResponse(code = 200, message = "successful operation", response = Client.class) })
@RequestMapping(value = "/fake", @RequestMapping(value = "/fake",
produces = { "application/json" }, produces = { "application/json" },
consumes = { "application/json" }, consumes = { "application/json" },
@ -39,41 +40,23 @@ public interface FakeApi {
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class),
@ApiResponse(code = 404, message = "User not found", response = Void.class) }) @ApiResponse(code = 404, message = "User not found", response = Void.class) })
@RequestMapping(value = "/fake", @RequestMapping(value = "/fake",
produces = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, produces = { "application/xml; charset=utf-8", "application/json; charset=utf-8" },
consumes = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, consumes = { "application/xml; charset=utf-8", "application/json; charset=utf-8" },
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Void> testEndpointParameters(@ApiParam(value = "None", required=true ) @RequestPart(value="number", required=true) BigDecimal number, ResponseEntity<Void> testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) DateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback);
@ApiParam(value = "None", required=true ) @RequestPart(value="_double", required=true) Double _double,
@ApiParam(value = "None", required=true ) @RequestPart(value="patternWithoutDelimiter", required=true) String patternWithoutDelimiter,
@ApiParam(value = "None", required=true ) @RequestPart(value="_byte", required=true) byte[] _byte,
@ApiParam(value = "None" ) @RequestPart(value="integer", required=false) Integer integer,
@ApiParam(value = "None" ) @RequestPart(value="int32", required=false) Integer int32,
@ApiParam(value = "None" ) @RequestPart(value="int64", required=false) Long int64,
@ApiParam(value = "None" ) @RequestPart(value="_float", required=false) Float _float,
@ApiParam(value = "None" ) @RequestPart(value="string", required=false) String string,
@ApiParam(value = "None" ) @RequestPart(value="binary", required=false) byte[] binary,
@ApiParam(value = "None" ) @RequestPart(value="date", required=false) LocalDate date,
@ApiParam(value = "None" ) @RequestPart(value="dateTime", required=false) DateTime dateTime,
@ApiParam(value = "None" ) @RequestPart(value="password", required=false) String password,
@ApiParam(value = "None" ) @RequestPart(value="paramCallback", required=false) String paramCallback);
@ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = Void.class, tags={ "fake", }) @ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = Void.class, tags={ "fake", })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid request", response = Void.class), @ApiResponse(code = 400, message = "Invalid request", response = Void.class),
@ApiResponse(code = 404, message = "Not found", response = Void.class) }) @ApiResponse(code = 404, message = "Not found", response = Void.class) })
@RequestMapping(value = "/fake", @RequestMapping(value = "/fake",
produces = { "*/*" }, produces = { "*/*" },
consumes = { "*/*" }, consumes = { "*/*" },
method = RequestMethod.GET) method = RequestMethod.GET)
ResponseEntity<Void> testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)" , allowableValues="GREATER_THAN, DOLLAR") @RequestPart(value="enumFormStringArray", required=false) List<String> enumFormStringArray, ResponseEntity<Void> testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List<String> enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List<String> enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List<String> enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble);
@ApiParam(value = "Form parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestPart(value="enumFormString", required=false) String enumFormString,
@ApiParam(value = "Header parameter enum test (string array)" , allowableValues="GREATER_THAN, DOLLAR") @RequestHeader(value="enum_header_string_array", required=false) List<String> enumHeaderStringArray,
@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,
@ApiParam(value = "Query parameter enum test (string array)", allowableValues = "GREATER_THAN, DOLLAR") @RequestParam(value = "enumQueryStringArray", required = false) List<String> enumQueryStringArray,
@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enumQueryString", required = false, defaultValue="-efg") String enumQueryString,
@ApiParam(value = "Query parameter enum test (double)") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger,
@ApiParam(value = "Query parameter enum test (double)" ) @RequestPart(value="enumQueryDouble", required=false) Double enumQueryDouble);
} }

View File

@ -32,32 +32,32 @@ public class FakeApiController implements FakeApi {
return new ResponseEntity<Client>(HttpStatus.OK); return new ResponseEntity<Client>(HttpStatus.OK);
} }
public ResponseEntity<Void> testEndpointParameters(@ApiParam(value = "None", required=true ) @RequestPart(value="number", required=true) BigDecimal number, public ResponseEntity<Void> testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,
@ApiParam(value = "None", required=true ) @RequestPart(value="_double", required=true) Double _double, @ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,
@ApiParam(value = "None", required=true ) @RequestPart(value="patternWithoutDelimiter", required=true) String patternWithoutDelimiter, @ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,
@ApiParam(value = "None", required=true ) @RequestPart(value="_byte", required=true) byte[] _byte, @ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,
@ApiParam(value = "None" ) @RequestPart(value="integer", required=false) Integer integer, @ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,
@ApiParam(value = "None" ) @RequestPart(value="int32", required=false) Integer int32, @ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,
@ApiParam(value = "None" ) @RequestPart(value="int64", required=false) Long int64, @ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,
@ApiParam(value = "None" ) @RequestPart(value="_float", required=false) Float _float, @ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,
@ApiParam(value = "None" ) @RequestPart(value="string", required=false) String string, @ApiParam(value = "None") @RequestPart(value="string", required=false) String string,
@ApiParam(value = "None" ) @RequestPart(value="binary", required=false) byte[] binary, @ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,
@ApiParam(value = "None" ) @RequestPart(value="date", required=false) LocalDate date, @ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,
@ApiParam(value = "None" ) @RequestPart(value="dateTime", required=false) DateTime dateTime, @ApiParam(value = "None") @RequestPart(value="dateTime", required=false) DateTime dateTime,
@ApiParam(value = "None" ) @RequestPart(value="password", required=false) String password, @ApiParam(value = "None") @RequestPart(value="password", required=false) String password,
@ApiParam(value = "None" ) @RequestPart(value="paramCallback", required=false) String paramCallback) { @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }
public ResponseEntity<Void> testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)" , allowableValues="GREATER_THAN, DOLLAR") @RequestPart(value="enumFormStringArray", required=false) List<String> enumFormStringArray, public ResponseEntity<Void> testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List<String> enumFormStringArray,
@ApiParam(value = "Form parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestPart(value="enumFormString", required=false) String enumFormString, @ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,
@ApiParam(value = "Header parameter enum test (string array)" , allowableValues="GREATER_THAN, DOLLAR") @RequestHeader(value="enum_header_string_array", required=false) List<String> enumHeaderStringArray, @ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) List<String> enumHeaderStringArray,
@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_ABC, _EFG, _XYZ_", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString, @ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) String enumHeaderString,
@ApiParam(value = "Query parameter enum test (string array)", allowableValues = "GREATER_THAN, DOLLAR") @RequestParam(value = "enumQueryStringArray", required = false) List<String> enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List<String> enumQueryStringArray,
@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_ABC, _EFG, _XYZ_", defaultValue = "-efg") @RequestParam(value = "enumQueryString", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,
@ApiParam(value = "Query parameter enum test (double)") @RequestParam(value = "enumQueryInteger", required = false) Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,
@ApiParam(value = "Query parameter enum test (double)" ) @RequestPart(value="enumQueryDouble", required=false) Double enumQueryDouble) { @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }

View File

@ -30,6 +30,7 @@ public interface PetApi {
}, tags={ "pet", }) }, tags={ "pet", })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) @ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
@RequestMapping(value = "/pet", @RequestMapping(value = "/pet",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
consumes = { "application/json", "application/xml" }, consumes = { "application/json", "application/xml" },
@ -45,11 +46,11 @@ public interface PetApi {
}, tags={ "pet", }) }, tags={ "pet", })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) @ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) })
@RequestMapping(value = "/pet/{petId}", @RequestMapping(value = "/pet/{petId}",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.DELETE) method = RequestMethod.DELETE)
ResponseEntity<Void> deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, ResponseEntity<Void> deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey);
@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey);
@ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = {
@ -61,10 +62,11 @@ public interface PetApi {
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 200, message = "successful operation", response = Pet.class),
@ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) @ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) })
@RequestMapping(value = "/pet/findByStatus", @RequestMapping(value = "/pet/findByStatus",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.GET) method = RequestMethod.GET)
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); 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 = { @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 = {
@ -76,6 +78,7 @@ public interface PetApi {
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 200, message = "successful operation", response = Pet.class),
@ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) @ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) })
@RequestMapping(value = "/pet/findByTags", @RequestMapping(value = "/pet/findByTags",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.GET) method = RequestMethod.GET)
@ -89,6 +92,7 @@ public interface PetApi {
@ApiResponse(code = 200, message = "successful operation", response = Pet.class), @ApiResponse(code = 200, message = "successful operation", response = Pet.class),
@ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class),
@ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) @ApiResponse(code = 404, message = "Pet not found", response = Pet.class) })
@RequestMapping(value = "/pet/{petId}", @RequestMapping(value = "/pet/{petId}",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.GET) method = RequestMethod.GET)
@ -105,6 +109,7 @@ public interface PetApi {
@ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
@ApiResponse(code = 404, message = "Pet not found", response = Void.class), @ApiResponse(code = 404, message = "Pet not found", response = Void.class),
@ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) @ApiResponse(code = 405, message = "Validation exception", response = Void.class) })
@RequestMapping(value = "/pet", @RequestMapping(value = "/pet",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
consumes = { "application/json", "application/xml" }, consumes = { "application/json", "application/xml" },
@ -120,13 +125,12 @@ public interface PetApi {
}, tags={ "pet", }) }, tags={ "pet", })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) @ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
@RequestMapping(value = "/pet/{petId}", @RequestMapping(value = "/pet/{petId}",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
consumes = { "application/x-www-form-urlencoded" }, consumes = { "application/x-www-form-urlencoded" },
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Void> updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId, 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" ) @RequestPart(value="name", required=false) String name,
@ApiParam(value = "Updated status of the pet" ) @RequestPart(value="status", required=false) String status);
@ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = {
@ -137,12 +141,11 @@ public interface PetApi {
}, tags={ "pet", }) }, tags={ "pet", })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
@RequestMapping(value = "/pet/{petId}/uploadImage", @RequestMapping(value = "/pet/{petId}/uploadImage",
produces = { "application/json" }, produces = { "application/json" },
consumes = { "multipart/form-data" }, consumes = { "multipart/form-data" },
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<ModelApiResponse> uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, 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);
@ApiParam(value = "Additional data to pass to server" ) @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,
@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file);
} }

View File

@ -32,12 +32,12 @@ public class PetApiController implements PetApi {
} }
public ResponseEntity<Void> deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, public ResponseEntity<Void> deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,
@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) { @ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }
public 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) { public 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) {
// do some magic! // do some magic!
return new ResponseEntity<List<Pet>>(HttpStatus.OK); return new ResponseEntity<List<Pet>>(HttpStatus.OK);
} }
@ -58,14 +58,14 @@ 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, 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 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 status of the pet") @RequestPart(value="status", required=false) String status) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }
public ResponseEntity<ModelApiResponse> uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, 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") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,
@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) { @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) {
// do some magic! // do some magic!
return new ResponseEntity<ModelApiResponse>(HttpStatus.OK); return new ResponseEntity<ModelApiResponse>(HttpStatus.OK);

View File

@ -25,10 +25,11 @@ public interface StoreApi {
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class),
@ApiResponse(code = 404, message = "Order not found", response = Void.class) }) @ApiResponse(code = 404, message = "Order not found", response = Void.class) })
@RequestMapping(value = "/store/order/{orderId}",
@RequestMapping(value = "/store/order/{order_id}",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.DELETE) method = RequestMethod.DELETE)
ResponseEntity<Void> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId); ResponseEntity<Void> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId);
@ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = {
@ -36,6 +37,7 @@ public interface StoreApi {
}, tags={ "store", }) }, tags={ "store", })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) @ApiResponse(code = 200, message = "successful operation", response = Integer.class) })
@RequestMapping(value = "/store/inventory", @RequestMapping(value = "/store/inventory",
produces = { "application/json" }, produces = { "application/json" },
method = RequestMethod.GET) method = RequestMethod.GET)
@ -47,16 +49,18 @@ public interface StoreApi {
@ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 200, message = "successful operation", response = Order.class),
@ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), @ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class),
@ApiResponse(code = 404, message = "Order not found", response = Order.class) }) @ApiResponse(code = 404, message = "Order not found", response = Order.class) })
@RequestMapping(value = "/store/order/{orderId}",
@RequestMapping(value = "/store/order/{order_id}",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.GET) method = RequestMethod.GET)
ResponseEntity<Order> getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId); ResponseEntity<Order> getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId);
@ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", }) @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Order.class), @ApiResponse(code = 200, message = "successful operation", response = Order.class),
@ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) @ApiResponse(code = 400, message = "Invalid Order", response = Order.class) })
@RequestMapping(value = "/store/order", @RequestMapping(value = "/store/order",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)

View File

@ -25,7 +25,7 @@ public class StoreApiController implements StoreApi {
public ResponseEntity<Void> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId) { public ResponseEntity<Void> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }
@ -35,7 +35,7 @@ public class StoreApiController implements StoreApi {
return new ResponseEntity<Map<String, Integer>>(HttpStatus.OK); return new ResponseEntity<Map<String, Integer>>(HttpStatus.OK);
} }
public ResponseEntity<Order> getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId) { public ResponseEntity<Order> getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId) {
// do some magic! // do some magic!
return new ResponseEntity<Order>(HttpStatus.OK); return new ResponseEntity<Order>(HttpStatus.OK);
} }

View File

@ -24,6 +24,7 @@ public interface UserApi {
@ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @ApiResponse(code = 200, message = "successful operation", response = Void.class) })
@RequestMapping(value = "/user", @RequestMapping(value = "/user",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
@ -33,6 +34,7 @@ public interface UserApi {
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @ApiResponse(code = 200, message = "successful operation", response = Void.class) })
@RequestMapping(value = "/user/createWithArray", @RequestMapping(value = "/user/createWithArray",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
@ -42,6 +44,7 @@ public interface UserApi {
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @ApiResponse(code = 200, message = "successful operation", response = Void.class) })
@RequestMapping(value = "/user/createWithList", @RequestMapping(value = "/user/createWithList",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
@ -52,6 +55,7 @@ public interface UserApi {
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class),
@ApiResponse(code = 404, message = "User not found", response = Void.class) }) @ApiResponse(code = 404, message = "User not found", response = Void.class) })
@RequestMapping(value = "/user/{username}", @RequestMapping(value = "/user/{username}",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.DELETE) method = RequestMethod.DELETE)
@ -63,6 +67,7 @@ public interface UserApi {
@ApiResponse(code = 200, message = "successful operation", response = User.class), @ApiResponse(code = 200, message = "successful operation", response = User.class),
@ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), @ApiResponse(code = 400, message = "Invalid username supplied", response = User.class),
@ApiResponse(code = 404, message = "User not found", response = User.class) }) @ApiResponse(code = 404, message = "User not found", response = User.class) })
@RequestMapping(value = "/user/{username}", @RequestMapping(value = "/user/{username}",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.GET) method = RequestMethod.GET)
@ -73,16 +78,17 @@ public interface UserApi {
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = String.class), @ApiResponse(code = 200, message = "successful operation", response = String.class),
@ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) @ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) })
@RequestMapping(value = "/user/login", @RequestMapping(value = "/user/login",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.GET) method = RequestMethod.GET)
ResponseEntity<String> loginUser( @NotNull @ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, 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);
@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", }) @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", })
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @ApiResponse(code = 200, message = "successful operation", response = Void.class) })
@RequestMapping(value = "/user/logout", @RequestMapping(value = "/user/logout",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.GET) method = RequestMethod.GET)
@ -93,10 +99,10 @@ public interface UserApi {
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), @ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class),
@ApiResponse(code = 404, message = "User not found", response = Void.class) }) @ApiResponse(code = 404, message = "User not found", response = Void.class) })
@RequestMapping(value = "/user/{username}", @RequestMapping(value = "/user/{username}",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.PUT) method = RequestMethod.PUT)
ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body);
@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body);
} }

View File

@ -15,10 +15,10 @@ import javax.validation.constraints.*;
public class AdditionalPropertiesClass { public class AdditionalPropertiesClass {
@JsonProperty("map_property") @JsonProperty("map_property")
private Map<String, String> mapProperty = new HashMap<String, String>(); private Map<String, String> mapProperty = null;
@JsonProperty("map_of_map_property") @JsonProperty("map_of_map_property")
private Map<String, Map<String, String>> mapOfMapProperty = new HashMap<String, Map<String, String>>(); private Map<String, Map<String, String>> mapOfMapProperty = null;
public AdditionalPropertiesClass mapProperty(Map<String, String> mapProperty) { public AdditionalPropertiesClass mapProperty(Map<String, String> mapProperty) {
this.mapProperty = mapProperty; this.mapProperty = mapProperty;
@ -26,6 +26,9 @@ public class AdditionalPropertiesClass {
} }
public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) { public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) {
if (this.mapProperty == null) {
this.mapProperty = new HashMap<String, String>();
}
this.mapProperty.put(key, mapPropertyItem); this.mapProperty.put(key, mapPropertyItem);
return this; return this;
} }
@ -49,6 +52,9 @@ public class AdditionalPropertiesClass {
} }
public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map<String, String> mapOfMapPropertyItem) { public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map<String, String> mapOfMapPropertyItem) {
if (this.mapOfMapProperty == null) {
this.mapOfMapProperty = new HashMap<String, Map<String, String>>();
}
this.mapOfMapProperty.put(key, mapOfMapPropertyItem); this.mapOfMapProperty.put(key, mapOfMapPropertyItem);
return this; return this;
} }

View File

@ -15,7 +15,7 @@ import javax.validation.constraints.*;
public class ArrayOfArrayOfNumberOnly { public class ArrayOfArrayOfNumberOnly {
@JsonProperty("ArrayArrayNumber") @JsonProperty("ArrayArrayNumber")
private List<List<BigDecimal>> arrayArrayNumber = new ArrayList<List<BigDecimal>>(); private List<List<BigDecimal>> arrayArrayNumber = null;
public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) { public ArrayOfArrayOfNumberOnly arrayArrayNumber(List<List<BigDecimal>> arrayArrayNumber) {
this.arrayArrayNumber = arrayArrayNumber; this.arrayArrayNumber = arrayArrayNumber;
@ -23,6 +23,9 @@ public class ArrayOfArrayOfNumberOnly {
} }
public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayArrayNumberItem) { public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List<BigDecimal> arrayArrayNumberItem) {
if (this.arrayArrayNumber == null) {
this.arrayArrayNumber = new ArrayList<List<BigDecimal>>();
}
this.arrayArrayNumber.add(arrayArrayNumberItem); this.arrayArrayNumber.add(arrayArrayNumberItem);
return this; return this;
} }

View File

@ -15,7 +15,7 @@ import javax.validation.constraints.*;
public class ArrayOfNumberOnly { public class ArrayOfNumberOnly {
@JsonProperty("ArrayNumber") @JsonProperty("ArrayNumber")
private List<BigDecimal> arrayNumber = new ArrayList<BigDecimal>(); private List<BigDecimal> arrayNumber = null;
public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) { public ArrayOfNumberOnly arrayNumber(List<BigDecimal> arrayNumber) {
this.arrayNumber = arrayNumber; this.arrayNumber = arrayNumber;
@ -23,6 +23,9 @@ public class ArrayOfNumberOnly {
} }
public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) {
if (this.arrayNumber == null) {
this.arrayNumber = new ArrayList<BigDecimal>();
}
this.arrayNumber.add(arrayNumberItem); this.arrayNumber.add(arrayNumberItem);
return this; return this;
} }

View File

@ -15,13 +15,13 @@ import javax.validation.constraints.*;
public class ArrayTest { public class ArrayTest {
@JsonProperty("array_of_string") @JsonProperty("array_of_string")
private List<String> arrayOfString = new ArrayList<String>(); private List<String> arrayOfString = null;
@JsonProperty("array_array_of_integer") @JsonProperty("array_array_of_integer")
private List<List<Long>> arrayArrayOfInteger = new ArrayList<List<Long>>(); private List<List<Long>> arrayArrayOfInteger = null;
@JsonProperty("array_array_of_model") @JsonProperty("array_array_of_model")
private List<List<ReadOnlyFirst>> arrayArrayOfModel = new ArrayList<List<ReadOnlyFirst>>(); private List<List<ReadOnlyFirst>> arrayArrayOfModel = null;
public ArrayTest arrayOfString(List<String> arrayOfString) { public ArrayTest arrayOfString(List<String> arrayOfString) {
this.arrayOfString = arrayOfString; this.arrayOfString = arrayOfString;
@ -29,6 +29,9 @@ public class ArrayTest {
} }
public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { public ArrayTest addArrayOfStringItem(String arrayOfStringItem) {
if (this.arrayOfString == null) {
this.arrayOfString = new ArrayList<String>();
}
this.arrayOfString.add(arrayOfStringItem); this.arrayOfString.add(arrayOfStringItem);
return this; return this;
} }
@ -52,6 +55,9 @@ public class ArrayTest {
} }
public ArrayTest addArrayArrayOfIntegerItem(List<Long> arrayArrayOfIntegerItem) { public ArrayTest addArrayArrayOfIntegerItem(List<Long> arrayArrayOfIntegerItem) {
if (this.arrayArrayOfInteger == null) {
this.arrayArrayOfInteger = new ArrayList<List<Long>>();
}
this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem);
return this; return this;
} }
@ -75,6 +81,9 @@ public class ArrayTest {
} }
public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelItem) { public ArrayTest addArrayArrayOfModelItem(List<ReadOnlyFirst> arrayArrayOfModelItem) {
if (this.arrayArrayOfModel == null) {
this.arrayArrayOfModel = new ArrayList<List<ReadOnlyFirst>>();
}
this.arrayArrayOfModel.add(arrayArrayOfModelItem); this.arrayArrayOfModel.add(arrayArrayOfModelItem);
return this; return this;
} }

View File

@ -80,7 +80,7 @@ public class EnumArrays {
} }
@JsonProperty("array_enum") @JsonProperty("array_enum")
private List<ArrayEnumEnum> arrayEnum = new ArrayList<ArrayEnumEnum>(); private List<ArrayEnumEnum> arrayEnum = null;
public EnumArrays justSymbol(JustSymbolEnum justSymbol) { public EnumArrays justSymbol(JustSymbolEnum justSymbol) {
this.justSymbol = justSymbol; this.justSymbol = justSymbol;
@ -106,6 +106,9 @@ public class EnumArrays {
} }
public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) {
if (this.arrayEnum == null) {
this.arrayEnum = new ArrayList<ArrayEnumEnum>();
}
this.arrayEnum.add(arrayEnumItem); this.arrayEnum.add(arrayEnumItem);
return this; return this;
} }

View File

@ -66,9 +66,7 @@ public class FormatTest {
* @return integer * @return integer
**/ **/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
@Min(10) @Min(10) @Max(100) public Integer getInteger() {
@Max(100)
public Integer getInteger() {
return integer; return integer;
} }
@ -88,9 +86,7 @@ public class FormatTest {
* @return int32 * @return int32
**/ **/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
@Min(20) @Min(20) @Max(200) public Integer getInt32() {
@Max(200)
public Integer getInt32() {
return int32; return int32;
} }
@ -129,9 +125,7 @@ public class FormatTest {
**/ **/
@ApiModelProperty(required = true, value = "") @ApiModelProperty(required = true, value = "")
@NotNull @NotNull
@DecimalMin("32.1") @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() {
@DecimalMax("543.2")
public BigDecimal getNumber() {
return number; return number;
} }
@ -151,9 +145,7 @@ public class FormatTest {
* @return _float * @return _float
**/ **/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
@DecimalMin("54.3") @DecimalMin("54.3") @DecimalMax("987.6") public Float getFloat() {
@DecimalMax("987.6")
public Float getFloat() {
return _float; return _float;
} }
@ -173,9 +165,7 @@ public class FormatTest {
* @return _double * @return _double
**/ **/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
@DecimalMin("67.8") @DecimalMin("67.8") @DecimalMax("123.4") public Double getDouble() {
@DecimalMax("123.4")
public Double getDouble() {
return _double; return _double;
} }
@ -193,8 +183,7 @@ public class FormatTest {
* @return string * @return string
**/ **/
@ApiModelProperty(value = "") @ApiModelProperty(value = "")
@Pattern(regexp="/[a-z]/i") @Pattern(regexp="/[a-z]/i") public String getString() {
public String getString() {
return string; return string;
} }
@ -305,8 +294,7 @@ public class FormatTest {
**/ **/
@ApiModelProperty(required = true, value = "") @ApiModelProperty(required = true, value = "")
@NotNull @NotNull
@Size(min=10,max=64) @Size(min=10,max=64) public String getPassword() {
public String getPassword() {
return password; return password;
} }

View File

@ -16,7 +16,7 @@ import javax.validation.constraints.*;
public class MapTest { public class MapTest {
@JsonProperty("map_map_of_string") @JsonProperty("map_map_of_string")
private Map<String, Map<String, String>> mapMapOfString = new HashMap<String, Map<String, String>>(); private Map<String, Map<String, String>> mapMapOfString = null;
/** /**
* Gets or Sets inner * Gets or Sets inner
@ -50,7 +50,7 @@ public class MapTest {
} }
@JsonProperty("map_of_enum_string") @JsonProperty("map_of_enum_string")
private Map<String, InnerEnum> mapOfEnumString = new HashMap<String, InnerEnum>(); private Map<String, InnerEnum> mapOfEnumString = null;
public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) { public MapTest mapMapOfString(Map<String, Map<String, String>> mapMapOfString) {
this.mapMapOfString = mapMapOfString; this.mapMapOfString = mapMapOfString;
@ -58,6 +58,9 @@ public class MapTest {
} }
public MapTest putMapMapOfStringItem(String key, Map<String, String> mapMapOfStringItem) { public MapTest putMapMapOfStringItem(String key, Map<String, String> mapMapOfStringItem) {
if (this.mapMapOfString == null) {
this.mapMapOfString = new HashMap<String, Map<String, String>>();
}
this.mapMapOfString.put(key, mapMapOfStringItem); this.mapMapOfString.put(key, mapMapOfStringItem);
return this; return this;
} }
@ -81,6 +84,9 @@ public class MapTest {
} }
public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) {
if (this.mapOfEnumString == null) {
this.mapOfEnumString = new HashMap<String, InnerEnum>();
}
this.mapOfEnumString.put(key, mapOfEnumStringItem); this.mapOfEnumString.put(key, mapOfEnumStringItem);
return this; return this;
} }

View File

@ -24,7 +24,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
private DateTime dateTime = null; private DateTime dateTime = null;
@JsonProperty("map") @JsonProperty("map")
private Map<String, Animal> map = new HashMap<String, Animal>(); private Map<String, Animal> map = null;
public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) {
this.uuid = uuid; this.uuid = uuid;
@ -68,6 +68,9 @@ public class MixedPropertiesAndAdditionalPropertiesClass {
} }
public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) {
if (this.map == null) {
this.map = new HashMap<String, Animal>();
}
this.map.put(key, mapItem); this.map.put(key, mapItem);
return this; return this;
} }

View File

@ -29,7 +29,7 @@ public class Pet {
private List<String> photoUrls = new ArrayList<String>(); private List<String> photoUrls = new ArrayList<String>();
@JsonProperty("tags") @JsonProperty("tags")
private List<Tag> tags = new ArrayList<Tag>(); private List<Tag> tags = null;
/** /**
* pet status in the store * pet status in the store
@ -152,6 +152,9 @@ public class Pet {
} }
public Pet addTagsItem(Tag tagsItem) { public Pet addTagsItem(Tag tagsItem) {
if (this.tags == null) {
this.tags = new ArrayList<Tag>();
}
this.tags.add(tagsItem); this.tags.add(tagsItem);
return this; return this;
} }

View File

@ -1,5 +1,5 @@
springfox.documentation.swagger.v2.path=/api-docs springfox.documentation.swagger.v2.path=/api-docs
server.contextPath=/v2 server.contextPath=/v2
server.port=8080 server.port=80
spring.jackson.date-format=io.swagger.RFC3339DateFormat spring.jackson.date-format=io.swagger.RFC3339DateFormat
spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false

View File

@ -19,6 +19,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "fake", description = "the fake API") @Api(value = "fake", description = "the fake API")
public interface FakeApi { public interface FakeApi {
@ -31,7 +32,7 @@ public interface FakeApi {
produces = { "application/json" }, produces = { "application/json" },
consumes = { "application/json" }, consumes = { "application/json" },
method = RequestMethod.PATCH) method = RequestMethod.PATCH)
default ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @RequestBody Client body) { default ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
// do some magic! // do some magic!
return new ResponseEntity<Client>(HttpStatus.OK); return new ResponseEntity<Client>(HttpStatus.OK);
} }

View File

@ -20,6 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller @Controller
public class FakeApiController implements FakeApi { public class FakeApiController implements FakeApi {
@ -31,7 +32,7 @@ public class FakeApiController implements FakeApi {
} }
public ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @RequestBody Client body) { public ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
// do some magic! // do some magic!
return delegate.testClientModel(body); return delegate.testClientModel(body);
} }

View File

@ -18,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "pet", description = "the pet API") @Api(value = "pet", description = "the pet API")
public interface PetApi { public interface PetApi {
@ -35,7 +36,7 @@ public interface PetApi {
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
consumes = { "application/json", "application/xml" }, consumes = { "application/json", "application/xml" },
method = RequestMethod.POST) method = RequestMethod.POST)
default ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body) { default ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }
@ -129,7 +130,7 @@ public interface PetApi {
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
consumes = { "application/json", "application/xml" }, consumes = { "application/json", "application/xml" },
method = RequestMethod.PUT) method = RequestMethod.PUT)
default ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body) { default ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }

View File

@ -19,6 +19,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller @Controller
public class PetApiController implements PetApi { public class PetApiController implements PetApi {
@ -30,7 +31,7 @@ public class PetApiController implements PetApi {
} }
public ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body) { public ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
// do some magic! // do some magic!
return delegate.addPet(body); return delegate.addPet(body);
} }
@ -56,7 +57,7 @@ public class PetApiController implements PetApi {
return delegate.getPetById(petId); return delegate.getPetById(petId);
} }
public ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body) { public ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
// do some magic! // do some magic!
return delegate.updatePet(body); return delegate.updatePet(body);
} }

View File

@ -17,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "store", description = "the store API") @Api(value = "store", description = "the store API")
public interface StoreApi { public interface StoreApi {
@ -73,7 +74,7 @@ public interface StoreApi {
@RequestMapping(value = "/store/order", @RequestMapping(value = "/store/order",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
default ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body) { default ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) {
// do some magic! // do some magic!
return new ResponseEntity<Order>(HttpStatus.OK); return new ResponseEntity<Order>(HttpStatus.OK);
} }

View File

@ -18,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller @Controller
public class StoreApiController implements StoreApi { public class StoreApiController implements StoreApi {
@ -44,7 +45,7 @@ public class StoreApiController implements StoreApi {
return delegate.getOrderById(orderId); return delegate.getOrderById(orderId);
} }
public ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body) { public ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) {
// do some magic! // do some magic!
return delegate.placeOrder(body); return delegate.placeOrder(body);
} }

View File

@ -17,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "user", description = "the user API") @Api(value = "user", description = "the user API")
public interface UserApi { public interface UserApi {
@ -28,7 +29,7 @@ public interface UserApi {
@RequestMapping(value = "/user", @RequestMapping(value = "/user",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
default ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body) { default ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }
@ -41,7 +42,7 @@ public interface UserApi {
@RequestMapping(value = "/user/createWithArray", @RequestMapping(value = "/user/createWithArray",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
default ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body) { default ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }
@ -54,7 +55,7 @@ public interface UserApi {
@RequestMapping(value = "/user/createWithList", @RequestMapping(value = "/user/createWithList",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
default ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body) { default ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }
@ -124,7 +125,7 @@ public interface UserApi {
@RequestMapping(value = "/user/{username}", @RequestMapping(value = "/user/{username}",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.PUT) method = RequestMethod.PUT)
default ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body) { default ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }

View File

@ -18,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller @Controller
public class UserApiController implements UserApi { public class UserApiController implements UserApi {
@ -29,17 +30,17 @@ public class UserApiController implements UserApi {
} }
public ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body) { public ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) {
// do some magic! // do some magic!
return delegate.createUser(body); return delegate.createUser(body);
} }
public ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body) { public ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body) {
// do some magic! // do some magic!
return delegate.createUsersWithArrayInput(body); return delegate.createUsersWithArrayInput(body);
} }
public ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body) { public ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body) {
// do some magic! // do some magic!
return delegate.createUsersWithListInput(body); return delegate.createUsersWithListInput(body);
} }
@ -66,7 +67,7 @@ public class UserApiController implements UserApi {
} }
public ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, public ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,
@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body) { @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) {
// do some magic! // do some magic!
return delegate.updateUser(username, body); return delegate.updateUser(username, body);
} }

View File

@ -18,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "fake", description = "the fake API") @Api(value = "fake", description = "the fake API")
public interface FakeApi { public interface FakeApi {
@ -30,7 +31,7 @@ public interface FakeApi {
produces = { "application/json" }, produces = { "application/json" },
consumes = { "application/json" }, consumes = { "application/json" },
method = RequestMethod.PATCH) method = RequestMethod.PATCH)
ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @RequestBody Client body); ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body);
@ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = Void.class, authorizations = { @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = Void.class, authorizations = {

View File

@ -20,6 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller @Controller
public class FakeApiController implements FakeApi { public class FakeApiController implements FakeApi {
@ -31,7 +32,7 @@ public class FakeApiController implements FakeApi {
} }
public ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @RequestBody Client body) { public ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
// do some magic! // do some magic!
return delegate.testClientModel(body); return delegate.testClientModel(body);
} }

View File

@ -17,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "pet", description = "the pet API") @Api(value = "pet", description = "the pet API")
public interface PetApi { public interface PetApi {
@ -34,7 +35,7 @@ public interface PetApi {
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
consumes = { "application/json", "application/xml" }, consumes = { "application/json", "application/xml" },
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body); ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body);
@ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = {
@ -113,7 +114,7 @@ public interface PetApi {
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
consumes = { "application/json", "application/xml" }, consumes = { "application/json", "application/xml" },
method = RequestMethod.PUT) method = RequestMethod.PUT)
ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body); ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body);
@ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = {

View File

@ -19,6 +19,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller @Controller
public class PetApiController implements PetApi { public class PetApiController implements PetApi {
@ -30,7 +31,7 @@ public class PetApiController implements PetApi {
} }
public ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body) { public ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
// do some magic! // do some magic!
return delegate.addPet(body); return delegate.addPet(body);
} }
@ -56,7 +57,7 @@ public class PetApiController implements PetApi {
return delegate.getPetById(petId); return delegate.getPetById(petId);
} }
public ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body) { public ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
// do some magic! // do some magic!
return delegate.updatePet(body); return delegate.updatePet(body);
} }

View File

@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "store", description = "the store API") @Api(value = "store", description = "the store API")
public interface StoreApi { public interface StoreApi {
@ -63,6 +64,6 @@ public interface StoreApi {
@RequestMapping(value = "/store/order", @RequestMapping(value = "/store/order",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body); ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body);
} }

View File

@ -18,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller @Controller
public class StoreApiController implements StoreApi { public class StoreApiController implements StoreApi {
@ -44,7 +45,7 @@ public class StoreApiController implements StoreApi {
return delegate.getOrderById(orderId); return delegate.getOrderById(orderId);
} }
public ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body) { public ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) {
// do some magic! // do some magic!
return delegate.placeOrder(body); return delegate.placeOrder(body);
} }

View File

@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "user", description = "the user API") @Api(value = "user", description = "the user API")
public interface UserApi { public interface UserApi {
@ -27,7 +28,7 @@ public interface UserApi {
@RequestMapping(value = "/user", @RequestMapping(value = "/user",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body); ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body);
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", })
@ -37,7 +38,7 @@ public interface UserApi {
@RequestMapping(value = "/user/createWithArray", @RequestMapping(value = "/user/createWithArray",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body); ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body);
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", })
@ -47,7 +48,7 @@ public interface UserApi {
@RequestMapping(value = "/user/createWithList", @RequestMapping(value = "/user/createWithList",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body); ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body);
@ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", })
@ -102,6 +103,6 @@ public interface UserApi {
@RequestMapping(value = "/user/{username}", @RequestMapping(value = "/user/{username}",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.PUT) method = RequestMethod.PUT)
ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body); ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body);
} }

View File

@ -18,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller @Controller
public class UserApiController implements UserApi { public class UserApiController implements UserApi {
@ -29,17 +30,17 @@ public class UserApiController implements UserApi {
} }
public ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body) { public ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) {
// do some magic! // do some magic!
return delegate.createUser(body); return delegate.createUser(body);
} }
public ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body) { public ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body) {
// do some magic! // do some magic!
return delegate.createUsersWithArrayInput(body); return delegate.createUsersWithArrayInput(body);
} }
public ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body) { public ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body) {
// do some magic! // do some magic!
return delegate.createUsersWithListInput(body); return delegate.createUsersWithListInput(body);
} }
@ -66,7 +67,7 @@ public class UserApiController implements UserApi {
} }
public ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, public ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,
@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body) { @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) {
// do some magic! // do some magic!
return delegate.updateUser(username, body); return delegate.updateUser(username, body);
} }

View File

@ -18,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "fake", description = "the fake API") @Api(value = "fake", description = "the fake API")
public interface FakeApi { public interface FakeApi {
@ -30,7 +31,7 @@ public interface FakeApi {
produces = { "application/json" }, produces = { "application/json" },
consumes = { "application/json" }, consumes = { "application/json" },
method = RequestMethod.PATCH) method = RequestMethod.PATCH)
ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @RequestBody Client body); ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body);
@ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = Void.class, authorizations = { @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = Void.class, authorizations = {

View File

@ -20,13 +20,14 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller @Controller
public class FakeApiController implements FakeApi { public class FakeApiController implements FakeApi {
public ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @RequestBody Client body) { public ResponseEntity<Client> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) {
// do some magic! // do some magic!
return new ResponseEntity<Client>(HttpStatus.OK); return new ResponseEntity<Client>(HttpStatus.OK);
} }

View File

@ -17,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "pet", description = "the pet API") @Api(value = "pet", description = "the pet API")
public interface PetApi { public interface PetApi {
@ -34,7 +35,7 @@ public interface PetApi {
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
consumes = { "application/json", "application/xml" }, consumes = { "application/json", "application/xml" },
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body); ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body);
@ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = {
@ -113,7 +114,7 @@ public interface PetApi {
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
consumes = { "application/json", "application/xml" }, consumes = { "application/json", "application/xml" },
method = RequestMethod.PUT) method = RequestMethod.PUT)
ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body); ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body);
@ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = {

View File

@ -19,13 +19,14 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller @Controller
public class PetApiController implements PetApi { public class PetApiController implements PetApi {
public ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body) { public ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }
@ -51,7 +52,7 @@ public class PetApiController implements PetApi {
return new ResponseEntity<Pet>(HttpStatus.OK); return new ResponseEntity<Pet>(HttpStatus.OK);
} }
public ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body) { public ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }

View File

@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "store", description = "the store API") @Api(value = "store", description = "the store API")
public interface StoreApi { public interface StoreApi {
@ -63,6 +64,6 @@ public interface StoreApi {
@RequestMapping(value = "/store/order", @RequestMapping(value = "/store/order",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body); ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body);
} }

View File

@ -18,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller @Controller
public class StoreApiController implements StoreApi { public class StoreApiController implements StoreApi {
@ -39,7 +40,7 @@ public class StoreApiController implements StoreApi {
return new ResponseEntity<Order>(HttpStatus.OK); return new ResponseEntity<Order>(HttpStatus.OK);
} }
public ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body) { public ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) {
// do some magic! // do some magic!
return new ResponseEntity<Order>(HttpStatus.OK); return new ResponseEntity<Order>(HttpStatus.OK);
} }

View File

@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Api(value = "user", description = "the user API") @Api(value = "user", description = "the user API")
public interface UserApi { public interface UserApi {
@ -27,7 +28,7 @@ public interface UserApi {
@RequestMapping(value = "/user", @RequestMapping(value = "/user",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body); ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body);
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", })
@ -37,7 +38,7 @@ public interface UserApi {
@RequestMapping(value = "/user/createWithArray", @RequestMapping(value = "/user/createWithArray",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body); ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body);
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", })
@ -47,7 +48,7 @@ public interface UserApi {
@RequestMapping(value = "/user/createWithList", @RequestMapping(value = "/user/createWithList",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.POST) method = RequestMethod.POST)
ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body); ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body);
@ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", })
@ -102,6 +103,6 @@ public interface UserApi {
@RequestMapping(value = "/user/{username}", @RequestMapping(value = "/user/{username}",
produces = { "application/xml", "application/json" }, produces = { "application/xml", "application/json" },
method = RequestMethod.PUT) method = RequestMethod.PUT)
ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body); ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body);
} }

View File

@ -18,23 +18,24 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import javax.validation.Valid;
@Controller @Controller
public class UserApiController implements UserApi { public class UserApiController implements UserApi {
public ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body) { public ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }
public ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body) { public ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }
public ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body) { public ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List<User> body) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }
@ -61,7 +62,7 @@ public class UserApiController implements UserApi {
} }
public ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, public ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,
@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body) { @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) {
// do some magic! // do some magic!
return new ResponseEntity<Void>(HttpStatus.OK); return new ResponseEntity<Void>(HttpStatus.OK);
} }