mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-19 00:27:07 +00:00
update spring petstore sample
This commit is contained in:
@@ -18,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Api(value = "fake", description = "the fake API")
|
||||
public interface FakeApi {
|
||||
@@ -30,7 +31,7 @@ public interface FakeApi {
|
||||
produces = { "application/json" },
|
||||
consumes = { "application/json" },
|
||||
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 = {
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Controller
|
||||
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!
|
||||
return delegate.testClientModel(body);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Api(value = "pet", description = "the pet API")
|
||||
public interface PetApi {
|
||||
@@ -34,7 +35,7 @@ public interface PetApi {
|
||||
produces = { "application/xml", "application/json" },
|
||||
consumes = { "application/json", "application/xml" },
|
||||
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 = {
|
||||
@@ -113,7 +114,7 @@ public interface PetApi {
|
||||
produces = { "application/xml", "application/json" },
|
||||
consumes = { "application/json", "application/xml" },
|
||||
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 = {
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Controller
|
||||
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!
|
||||
return delegate.addPet(body);
|
||||
}
|
||||
@@ -56,7 +57,7 @@ public class PetApiController implements PetApi {
|
||||
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!
|
||||
return delegate.updatePet(body);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Api(value = "store", description = "the store API")
|
||||
public interface StoreApi {
|
||||
@@ -63,6 +64,6 @@ public interface StoreApi {
|
||||
@RequestMapping(value = "/store/order",
|
||||
produces = { "application/xml", "application/json" },
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Controller
|
||||
public class StoreApiController implements StoreApi {
|
||||
@@ -44,7 +45,7 @@ public class StoreApiController implements StoreApi {
|
||||
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!
|
||||
return delegate.placeOrder(body);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Api(value = "user", description = "the user API")
|
||||
public interface UserApi {
|
||||
@@ -27,7 +28,7 @@ public interface UserApi {
|
||||
@RequestMapping(value = "/user",
|
||||
produces = { "application/xml", "application/json" },
|
||||
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", })
|
||||
@@ -37,7 +38,7 @@ public interface UserApi {
|
||||
@RequestMapping(value = "/user/createWithArray",
|
||||
produces = { "application/xml", "application/json" },
|
||||
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", })
|
||||
@@ -47,7 +48,7 @@ public interface UserApi {
|
||||
@RequestMapping(value = "/user/createWithList",
|
||||
produces = { "application/xml", "application/json" },
|
||||
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", })
|
||||
@@ -102,6 +103,6 @@ public interface UserApi {
|
||||
@RequestMapping(value = "/user/{username}",
|
||||
produces = { "application/xml", "application/json" },
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Controller
|
||||
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!
|
||||
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!
|
||||
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!
|
||||
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,
|
||||
@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body) {
|
||||
@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) {
|
||||
// do some magic!
|
||||
return delegate.updateUser(username, body);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user