forked from loafle/openapi-generator-original
rename springboot sh, chmod a+x, add ModelApiResponse
This commit is contained in:
parent
8146c874db
commit
39cbee5ca2
0
bin/springboot-petstore-server2.sh → bin/springboot-petstore-server.sh
Normal file → Executable file
0
bin/springboot-petstore-server2.sh → bin/springboot-petstore-server.sh
Normal file → Executable file
@ -1,6 +1,6 @@
|
|||||||
package io.swagger.api;
|
package io.swagger.api;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00")
|
||||||
public class ApiException extends Exception{
|
public class ApiException extends Exception{
|
||||||
private int code;
|
private int code;
|
||||||
public ApiException (int code, String msg) {
|
public ApiException (int code, String msg) {
|
||||||
|
@ -5,7 +5,7 @@ import java.io.IOException;
|
|||||||
import javax.servlet.*;
|
import javax.servlet.*;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00")
|
||||||
public class ApiOriginFilter implements javax.servlet.Filter {
|
public class ApiOriginFilter implements javax.servlet.Filter {
|
||||||
@Override
|
@Override
|
||||||
public void doFilter(ServletRequest request, ServletResponse response,
|
public void doFilter(ServletRequest request, ServletResponse response,
|
||||||
|
@ -3,7 +3,7 @@ package io.swagger.api;
|
|||||||
import javax.xml.bind.annotation.XmlTransient;
|
import javax.xml.bind.annotation.XmlTransient;
|
||||||
|
|
||||||
@javax.xml.bind.annotation.XmlRootElement
|
@javax.xml.bind.annotation.XmlRootElement
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00")
|
||||||
public class ApiResponseMessage {
|
public class ApiResponseMessage {
|
||||||
public static final int ERROR = 1;
|
public static final int ERROR = 1;
|
||||||
public static final int WARNING = 2;
|
public static final int WARNING = 2;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.swagger.api;
|
package io.swagger.api;
|
||||||
|
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00")
|
||||||
public class NotFoundException extends ApiException {
|
public class NotFoundException extends ApiException {
|
||||||
private int code;
|
private int code;
|
||||||
public NotFoundException (int code, String msg) {
|
public NotFoundException (int code, String msg) {
|
||||||
|
@ -4,6 +4,7 @@ import io.swagger.model.*;
|
|||||||
|
|
||||||
import io.swagger.model.Pet;
|
import io.swagger.model.Pet;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import io.swagger.model.ModelApiResponse;
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ import static org.springframework.http.MediaType.*;
|
|||||||
@Controller
|
@Controller
|
||||||
@RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE})
|
@RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE})
|
||||||
@Api(value = "/pet", description = "the pet API")
|
@Api(value = "/pet", description = "the pet API")
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00")
|
||||||
public class PetApi {
|
public class PetApi {
|
||||||
|
|
||||||
@ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = {
|
@ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = {
|
||||||
@ -38,12 +39,12 @@ public class PetApi {
|
|||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
|
@ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
|
||||||
@RequestMapping(value = "",
|
@RequestMapping(value = "",
|
||||||
produces = { "application/json", "application/xml" },
|
produces = { "application/xml", "application/json" },
|
||||||
consumes = { "application/json", "application/xml" },
|
consumes = { "application/json", "application/xml" },
|
||||||
method = RequestMethod.POST)
|
method = RequestMethod.POST)
|
||||||
public ResponseEntity<Void> addPet(
|
public ResponseEntity<Void> addPet(
|
||||||
|
|
||||||
@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body
|
@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body
|
||||||
)
|
)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
@ -60,7 +61,7 @@ public class PetApi {
|
|||||||
@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 = "/{petId}",
|
@RequestMapping(value = "/{petId}",
|
||||||
produces = { "application/json", "application/xml" },
|
produces = { "application/xml", "application/json" },
|
||||||
|
|
||||||
method = RequestMethod.DELETE)
|
method = RequestMethod.DELETE)
|
||||||
public ResponseEntity<Void> deletePet(
|
public ResponseEntity<Void> deletePet(
|
||||||
@ -77,7 +78,7 @@ public class PetApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma seperated 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 = {
|
||||||
@Authorization(value = "petstore_auth", scopes = {
|
@Authorization(value = "petstore_auth", scopes = {
|
||||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||||
@ -87,10 +88,10 @@ public class PetApi {
|
|||||||
@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 = "/findByStatus",
|
@RequestMapping(value = "/findByStatus",
|
||||||
produces = { "application/json", "application/xml" },
|
produces = { "application/xml", "application/json" },
|
||||||
|
|
||||||
method = RequestMethod.GET)
|
method = RequestMethod.GET)
|
||||||
public ResponseEntity<List<Pet>> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", defaultValue = "available") @RequestParam(value = "status", required = false, defaultValue="available") List<String> status
|
public ResponseEntity<List<Pet>> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true) @RequestParam(value = "status", required = true) List<String> status
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
@ -100,7 +101,7 @@ public class PetApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma seperated 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 = {
|
||||||
@Authorization(value = "petstore_auth", scopes = {
|
@Authorization(value = "petstore_auth", scopes = {
|
||||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||||
@ -110,10 +111,10 @@ public class PetApi {
|
|||||||
@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 = "/findByTags",
|
@RequestMapping(value = "/findByTags",
|
||||||
produces = { "application/json", "application/xml" },
|
produces = { "application/xml", "application/json" },
|
||||||
|
|
||||||
method = RequestMethod.GET)
|
method = RequestMethod.GET)
|
||||||
public ResponseEntity<List<Pet>> findPetsByTags(@ApiParam(value = "Tags to filter by") @RequestParam(value = "tags", required = false) List<String> tags
|
public ResponseEntity<List<Pet>> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List<String> tags
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
@ -123,11 +124,7 @@ public class PetApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "Find pet by ID", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = Pet.class, authorizations = {
|
@ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = {
|
||||||
@Authorization(value = "petstore_auth", scopes = {
|
|
||||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
|
||||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
|
||||||
}),
|
|
||||||
@Authorization(value = "api_key")
|
@Authorization(value = "api_key")
|
||||||
})
|
})
|
||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ -135,11 +132,11 @@ public class PetApi {
|
|||||||
@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 = "/{petId}",
|
@RequestMapping(value = "/{petId}",
|
||||||
produces = { "application/json", "application/xml" },
|
produces = { "application/xml", "application/json" },
|
||||||
|
|
||||||
method = RequestMethod.GET)
|
method = RequestMethod.GET)
|
||||||
public ResponseEntity<Pet> getPetById(
|
public ResponseEntity<Pet> getPetById(
|
||||||
@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("petId") Long petId
|
@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId
|
||||||
|
|
||||||
)
|
)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
@ -159,12 +156,12 @@ public class PetApi {
|
|||||||
@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 = "",
|
@RequestMapping(value = "",
|
||||||
produces = { "application/json", "application/xml" },
|
produces = { "application/xml", "application/json" },
|
||||||
consumes = { "application/json", "application/xml" },
|
consumes = { "application/json", "application/xml" },
|
||||||
method = RequestMethod.PUT)
|
method = RequestMethod.PUT)
|
||||||
public ResponseEntity<Void> updatePet(
|
public ResponseEntity<Void> updatePet(
|
||||||
|
|
||||||
@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body
|
@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body
|
||||||
)
|
)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
@ -181,11 +178,11 @@ public class PetApi {
|
|||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
|
@ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
|
||||||
@RequestMapping(value = "/{petId}",
|
@RequestMapping(value = "/{petId}",
|
||||||
produces = { "application/json", "application/xml" },
|
produces = { "application/xml", "application/json" },
|
||||||
consumes = { "application/x-www-form-urlencoded" },
|
consumes = { "application/x-www-form-urlencoded" },
|
||||||
method = RequestMethod.POST)
|
method = RequestMethod.POST)
|
||||||
public ResponseEntity<Void> updatePetWithForm(
|
public ResponseEntity<Void> updatePetWithForm(
|
||||||
@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") String petId
|
@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId
|
||||||
|
|
||||||
,
|
,
|
||||||
|
|
||||||
@ -204,19 +201,19 @@ public class PetApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "uploads an image", notes = "", response = Void.class, authorizations = {
|
@ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = {
|
||||||
@Authorization(value = "petstore_auth", scopes = {
|
@Authorization(value = "petstore_auth", scopes = {
|
||||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Void.class) })
|
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||||
@RequestMapping(value = "/{petId}/uploadImage",
|
@RequestMapping(value = "/{petId}/uploadImage",
|
||||||
produces = { "application/json", "application/xml" },
|
produces = { "application/json" },
|
||||||
consumes = { "multipart/form-data" },
|
consumes = { "multipart/form-data" },
|
||||||
method = RequestMethod.POST)
|
method = RequestMethod.POST)
|
||||||
public ResponseEntity<Void> uploadFile(
|
public ResponseEntity<ModelApiResponse> uploadFile(
|
||||||
@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId
|
@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId
|
||||||
|
|
||||||
,
|
,
|
||||||
@ -231,7 +228,7 @@ public class PetApi {
|
|||||||
)
|
)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
return new ResponseEntity<Void>(HttpStatus.OK);
|
return new ResponseEntity<ModelApiResponse>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ import static org.springframework.http.MediaType.*;
|
|||||||
@Controller
|
@Controller
|
||||||
@RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE})
|
@RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE})
|
||||||
@Api(value = "/store", description = "the store API")
|
@Api(value = "/store", description = "the store API")
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00")
|
||||||
public class StoreApi {
|
public class StoreApi {
|
||||||
|
|
||||||
@ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class)
|
@ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class)
|
||||||
@ -34,7 +34,7 @@ public class StoreApi {
|
|||||||
@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 = "/order/{orderId}",
|
@RequestMapping(value = "/order/{orderId}",
|
||||||
produces = { "application/json", "application/xml" },
|
produces = { "application/xml", "application/json" },
|
||||||
|
|
||||||
method = RequestMethod.DELETE)
|
method = RequestMethod.DELETE)
|
||||||
public ResponseEntity<Void> deleteOrder(
|
public ResponseEntity<Void> deleteOrder(
|
||||||
@ -53,7 +53,7 @@ public class StoreApi {
|
|||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Integer.class) })
|
@ApiResponse(code = 200, message = "successful operation", response = Integer.class) })
|
||||||
@RequestMapping(value = "/inventory",
|
@RequestMapping(value = "/inventory",
|
||||||
produces = { "application/json", "application/xml" },
|
produces = { "application/json" },
|
||||||
|
|
||||||
method = RequestMethod.GET)
|
method = RequestMethod.GET)
|
||||||
public ResponseEntity<Map<String, Integer>> getInventory()
|
public ResponseEntity<Map<String, Integer>> getInventory()
|
||||||
@ -69,11 +69,11 @@ public class StoreApi {
|
|||||||
@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 = "/order/{orderId}",
|
@RequestMapping(value = "/order/{orderId}",
|
||||||
produces = { "application/json", "application/xml" },
|
produces = { "application/xml", "application/json" },
|
||||||
|
|
||||||
method = RequestMethod.GET)
|
method = RequestMethod.GET)
|
||||||
public ResponseEntity<Order> getOrderById(
|
public ResponseEntity<Order> getOrderById(
|
||||||
@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") String orderId
|
@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId
|
||||||
|
|
||||||
)
|
)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
@ -87,12 +87,12 @@ public class StoreApi {
|
|||||||
@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 = "/order",
|
@RequestMapping(value = "/order",
|
||||||
produces = { "application/json", "application/xml" },
|
produces = { "application/xml", "application/json" },
|
||||||
|
|
||||||
method = RequestMethod.POST)
|
method = RequestMethod.POST)
|
||||||
public ResponseEntity<Order> placeOrder(
|
public ResponseEntity<Order> placeOrder(
|
||||||
|
|
||||||
@ApiParam(value = "order placed for purchasing the pet" ) @RequestBody Order body
|
@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body
|
||||||
)
|
)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
|
@ -26,19 +26,19 @@ import static org.springframework.http.MediaType.*;
|
|||||||
@Controller
|
@Controller
|
||||||
@RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE})
|
@RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE})
|
||||||
@Api(value = "/user", description = "the user API")
|
@Api(value = "/user", description = "the user API")
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00")
|
||||||
public class UserApi {
|
public class UserApi {
|
||||||
|
|
||||||
@ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class)
|
@ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class)
|
||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Void.class) })
|
@ApiResponse(code = 200, message = "successful operation", response = Void.class) })
|
||||||
@RequestMapping(value = "",
|
@RequestMapping(value = "",
|
||||||
produces = { "application/json", "application/xml" },
|
produces = { "application/xml", "application/json" },
|
||||||
|
|
||||||
method = RequestMethod.POST)
|
method = RequestMethod.POST)
|
||||||
public ResponseEntity<Void> createUser(
|
public ResponseEntity<Void> createUser(
|
||||||
|
|
||||||
@ApiParam(value = "Created user object" ) @RequestBody User body
|
@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body
|
||||||
)
|
)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
@ -50,12 +50,12 @@ public class UserApi {
|
|||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Void.class) })
|
@ApiResponse(code = 200, message = "successful operation", response = Void.class) })
|
||||||
@RequestMapping(value = "/createWithArray",
|
@RequestMapping(value = "/createWithArray",
|
||||||
produces = { "application/json", "application/xml" },
|
produces = { "application/xml", "application/json" },
|
||||||
|
|
||||||
method = RequestMethod.POST)
|
method = RequestMethod.POST)
|
||||||
public ResponseEntity<Void> createUsersWithArrayInput(
|
public ResponseEntity<Void> createUsersWithArrayInput(
|
||||||
|
|
||||||
@ApiParam(value = "List of user object" ) @RequestBody List<User> body
|
@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body
|
||||||
)
|
)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
@ -67,12 +67,12 @@ public class UserApi {
|
|||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Void.class) })
|
@ApiResponse(code = 200, message = "successful operation", response = Void.class) })
|
||||||
@RequestMapping(value = "/createWithList",
|
@RequestMapping(value = "/createWithList",
|
||||||
produces = { "application/json", "application/xml" },
|
produces = { "application/xml", "application/json" },
|
||||||
|
|
||||||
method = RequestMethod.POST)
|
method = RequestMethod.POST)
|
||||||
public ResponseEntity<Void> createUsersWithListInput(
|
public ResponseEntity<Void> createUsersWithListInput(
|
||||||
|
|
||||||
@ApiParam(value = "List of user object" ) @RequestBody List<User> body
|
@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body
|
||||||
)
|
)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
@ -85,7 +85,7 @@ public class UserApi {
|
|||||||
@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 = "/{username}",
|
@RequestMapping(value = "/{username}",
|
||||||
produces = { "application/json", "application/xml" },
|
produces = { "application/xml", "application/json" },
|
||||||
|
|
||||||
method = RequestMethod.DELETE)
|
method = RequestMethod.DELETE)
|
||||||
public ResponseEntity<Void> deleteUser(
|
public ResponseEntity<Void> deleteUser(
|
||||||
@ -104,7 +104,7 @@ public class UserApi {
|
|||||||
@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 = "/{username}",
|
@RequestMapping(value = "/{username}",
|
||||||
produces = { "application/json", "application/xml" },
|
produces = { "application/xml", "application/json" },
|
||||||
|
|
||||||
method = RequestMethod.GET)
|
method = RequestMethod.GET)
|
||||||
public ResponseEntity<User> getUserByName(
|
public ResponseEntity<User> getUserByName(
|
||||||
@ -122,14 +122,14 @@ public class UserApi {
|
|||||||
@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 = "/login",
|
@RequestMapping(value = "/login",
|
||||||
produces = { "application/json", "application/xml" },
|
produces = { "application/xml", "application/json" },
|
||||||
|
|
||||||
method = RequestMethod.GET)
|
method = RequestMethod.GET)
|
||||||
public ResponseEntity<String> loginUser(@ApiParam(value = "The user name for login") @RequestParam(value = "username", required = false) String username
|
public ResponseEntity<String> loginUser(@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username
|
||||||
|
|
||||||
|
|
||||||
,
|
,
|
||||||
@ApiParam(value = "The password for login in clear text") @RequestParam(value = "password", required = false) String password
|
@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
@ -143,7 +143,7 @@ public class UserApi {
|
|||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 200, message = "successful operation", response = Void.class) })
|
@ApiResponse(code = 200, message = "successful operation", response = Void.class) })
|
||||||
@RequestMapping(value = "/logout",
|
@RequestMapping(value = "/logout",
|
||||||
produces = { "application/json", "application/xml" },
|
produces = { "application/xml", "application/json" },
|
||||||
|
|
||||||
method = RequestMethod.GET)
|
method = RequestMethod.GET)
|
||||||
public ResponseEntity<Void> logoutUser()
|
public ResponseEntity<Void> logoutUser()
|
||||||
@ -158,7 +158,7 @@ public class UserApi {
|
|||||||
@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 = "/{username}",
|
@RequestMapping(value = "/{username}",
|
||||||
produces = { "application/json", "application/xml" },
|
produces = { "application/xml", "application/json" },
|
||||||
|
|
||||||
method = RequestMethod.PUT)
|
method = RequestMethod.PUT)
|
||||||
public ResponseEntity<Void> updateUser(
|
public ResponseEntity<Void> updateUser(
|
||||||
@ -167,7 +167,7 @@ public class UserApi {
|
|||||||
,
|
,
|
||||||
|
|
||||||
|
|
||||||
@ApiParam(value = "Updated user object" ) @RequestBody User body
|
@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body
|
||||||
)
|
)
|
||||||
throws NotFoundException {
|
throws NotFoundException {
|
||||||
// do some magic!
|
// do some magic!
|
||||||
|
@ -13,18 +13,18 @@ import springfox.documentation.spring.web.plugins.Docket;
|
|||||||
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00")
|
||||||
public class SwaggerDocumentationConfig {
|
public class SwaggerDocumentationConfig {
|
||||||
|
|
||||||
ApiInfo apiInfo() {
|
ApiInfo apiInfo() {
|
||||||
return new ApiInfoBuilder()
|
return new ApiInfoBuilder()
|
||||||
.title("Swagger Petstore")
|
.title("Swagger Petstore")
|
||||||
.description("This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters")
|
.description("This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.")
|
||||||
.license("Apache 2.0")
|
.license("Apache 2.0")
|
||||||
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
|
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
|
||||||
.termsOfServiceUrl("")
|
.termsOfServiceUrl("")
|
||||||
.version("1.0.0")
|
.version("1.0.0")
|
||||||
.contact(new Contact("","", "apiteam@wordnik.com"))
|
.contact(new Contact("","", "apiteam@swagger.io"))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import java.util.Objects;
|
|||||||
|
|
||||||
|
|
||||||
@ApiModel(description = "")
|
@ApiModel(description = "")
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00")
|
||||||
public class Category {
|
public class Category {
|
||||||
|
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
|
@ -0,0 +1,85 @@
|
|||||||
|
package io.swagger.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModel(description = "")
|
||||||
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00")
|
||||||
|
public class ModelApiResponse {
|
||||||
|
|
||||||
|
private Integer code = null;
|
||||||
|
private String type = null;
|
||||||
|
private String message = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
@JsonProperty("code")
|
||||||
|
public Integer getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
public void setCode(Integer code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
@JsonProperty("type")
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
**/
|
||||||
|
@ApiModelProperty(value = "")
|
||||||
|
@JsonProperty("message")
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ModelApiResponse _apiResponse = (ModelApiResponse) o;
|
||||||
|
return Objects.equals(code, _apiResponse.code) &&
|
||||||
|
Objects.equals(type, _apiResponse.type) &&
|
||||||
|
Objects.equals(message, _apiResponse.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(code, type, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class ModelApiResponse {\n");
|
||||||
|
|
||||||
|
sb.append(" code: ").append(code).append("\n");
|
||||||
|
sb.append(" type: ").append(type).append("\n");
|
||||||
|
sb.append(" message: ").append(message).append("\n");
|
||||||
|
sb.append("}\n");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -13,7 +13,7 @@ import java.util.Objects;
|
|||||||
|
|
||||||
|
|
||||||
@ApiModel(description = "")
|
@ApiModel(description = "")
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00")
|
||||||
public class Order {
|
public class Order {
|
||||||
|
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
@ -25,7 +25,7 @@ public class Order {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private StatusEnum status = null;
|
private StatusEnum status = null;
|
||||||
private Boolean complete = null;
|
private Boolean complete = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
**/
|
**/
|
||||||
|
@ -16,7 +16,7 @@ import java.util.Objects;
|
|||||||
|
|
||||||
|
|
||||||
@ApiModel(description = "")
|
@ApiModel(description = "")
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00")
|
||||||
public class Pet {
|
public class Pet {
|
||||||
|
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
|
@ -11,7 +11,7 @@ import java.util.Objects;
|
|||||||
|
|
||||||
|
|
||||||
@ApiModel(description = "")
|
@ApiModel(description = "")
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00")
|
||||||
public class Tag {
|
public class Tag {
|
||||||
|
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
|
@ -11,7 +11,7 @@ import java.util.Objects;
|
|||||||
|
|
||||||
|
|
||||||
@ApiModel(description = "")
|
@ApiModel(description = "")
|
||||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-04T16:34:30.253+02:00")
|
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringBootServerCodegen", date = "2016-05-05T15:10:34.669+08:00")
|
||||||
public class User {
|
public class User {
|
||||||
|
|
||||||
private Long id = null;
|
private Long id = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user