This commit is contained in:
Tony Tam 2015-05-20 22:51:30 -07:00
parent 3a2f258517
commit 99a11636da
6 changed files with 46 additions and 45 deletions

View File

@ -123,7 +123,7 @@ class PetApi(val defBasePath: String = "http://petstore.swagger.io/v2",
* @param status Status values that need to be considered for filter
* @return List[Pet]
*/
def findPetsByStatus (status: List[String]) : Option[List[Pet]] = {
def findPetsByStatus (status: List[String] = available) : Option[List[Pet]] = {
// create path and map variables
val path = "/pet/findByStatus".replaceAll("\\{format\\}","json")

View File

@ -69,7 +69,7 @@
<div class="field-items">
<div class="param">status (optional)</div>
<div class="param-desc"><span class="param-type">Query Parameter</span> &mdash; Status values that need to be considered for filter </div>
<div class="param-desc"><span class="param-type">Query Parameter</span> &mdash; Status values that need to be considered for filter default: available</div>
</div> <!-- field-items -->
<h3 class="field-label">Return type</h3>
@ -98,16 +98,8 @@
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code>&lt;Pet&gt;
&lt;id&gt;123456&lt;/id&gt;
&lt;Category&gt;
&lt;id&gt;123456&lt;/id&gt;
&lt;name&gt;string&lt;/name&gt;
&lt;/Category&gt;
&lt;name&gt;doggie&lt;/name&gt;
&lt;photoUrls&gt;string&lt;/photoUrls&gt;
&lt;Tag&gt;
&lt;id&gt;123456&lt;/id&gt;
&lt;name&gt;string&lt;/name&gt;
&lt;/Tag&gt;
&lt;status&gt;string&lt;/status&gt;
&lt;/Pet&gt;</code></pre>
@ -153,16 +145,8 @@
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code>&lt;Pet&gt;
&lt;id&gt;123456&lt;/id&gt;
&lt;Category&gt;
&lt;id&gt;123456&lt;/id&gt;
&lt;name&gt;string&lt;/name&gt;
&lt;/Category&gt;
&lt;name&gt;doggie&lt;/name&gt;
&lt;photoUrls&gt;string&lt;/photoUrls&gt;
&lt;Tag&gt;
&lt;id&gt;123456&lt;/id&gt;
&lt;name&gt;string&lt;/name&gt;
&lt;/Tag&gt;
&lt;status&gt;string&lt;/status&gt;
&lt;/Pet&gt;</code></pre>
@ -208,16 +192,8 @@
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code>&lt;Pet&gt;
&lt;id&gt;123456&lt;/id&gt;
&lt;Category&gt;
&lt;id&gt;123456&lt;/id&gt;
&lt;name&gt;string&lt;/name&gt;
&lt;/Category&gt;
&lt;name&gt;doggie&lt;/name&gt;
&lt;photoUrls&gt;string&lt;/photoUrls&gt;
&lt;Tag&gt;
&lt;id&gt;123456&lt;/id&gt;
&lt;name&gt;string&lt;/name&gt;
&lt;/Tag&gt;
&lt;status&gt;string&lt;/status&gt;
&lt;/Pet&gt;</code></pre>
@ -356,7 +332,7 @@
&quot;complete&quot; : true,
&quot;status&quot; : &quot;aeiou&quot;,
&quot;quantity&quot; : 123,
&quot;shipDate&quot; : &quot;2015-05-21T05:19:00.242+0000&quot;
&quot;shipDate&quot; : &quot;2015-05-21T05:49:06.118+0000&quot;
}</code></pre>
<h3 class="field-label">Example data</h3>
@ -365,7 +341,7 @@
&lt;id&gt;123456&lt;/id&gt;
&lt;petId&gt;123456&lt;/petId&gt;
&lt;quantity&gt;0&lt;/quantity&gt;
&lt;shipDate&gt;2015-05-20T22:19:00.244Z&lt;/shipDate&gt;
&lt;shipDate&gt;2015-05-20T22:49:06.120Z&lt;/shipDate&gt;
&lt;status&gt;string&lt;/status&gt;
&lt;complete&gt;true&lt;/complete&gt;
&lt;/Order&gt;</code></pre>
@ -399,7 +375,7 @@
&quot;complete&quot; : true,
&quot;status&quot; : &quot;aeiou&quot;,
&quot;quantity&quot; : 123,
&quot;shipDate&quot; : &quot;2015-05-21T05:19:00.245+0000&quot;
&quot;shipDate&quot; : &quot;2015-05-21T05:49:06.121+0000&quot;
}</code></pre>
<h3 class="field-label">Example data</h3>
@ -408,7 +384,7 @@
&lt;id&gt;123456&lt;/id&gt;
&lt;petId&gt;123456&lt;/petId&gt;
&lt;quantity&gt;0&lt;/quantity&gt;
&lt;shipDate&gt;2015-05-20T22:19:00.246Z&lt;/shipDate&gt;
&lt;shipDate&gt;2015-05-20T22:49:06.122Z&lt;/shipDate&gt;
&lt;status&gt;string&lt;/status&gt;
&lt;complete&gt;true&lt;/complete&gt;
&lt;/Order&gt;</code></pre>

View File

@ -70,7 +70,7 @@ public class PetApi {
@com.wordnik.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value") })
public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter") @QueryParam("status") List<String> status)
public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", defaultValue="available") @QueryParam("status") List<String> status)
throws NotFoundException {
// do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();

View File

@ -43,6 +43,7 @@ public class PetApi {
consumes = { "application/json", "application/xml" },
method = RequestMethod.PUT)
public ResponseEntity<Void> updatePet(
@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body)
throws NotFoundException {
// do some magic!
@ -59,6 +60,7 @@ public class PetApi {
consumes = { "application/json", "application/xml" },
method = RequestMethod.POST)
public ResponseEntity<Void> addPet(
@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body)
throws NotFoundException {
// do some magic!
@ -75,7 +77,8 @@ public class PetApi {
produces = { "application/json", "application/xml" },
method = RequestMethod.GET)
public ResponseEntity<Pet> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter") @RequestParam(value = "status", required = false) List<String> status
public ResponseEntity<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
)
throws NotFoundException {
// do some magic!
@ -93,6 +96,7 @@ public class PetApi {
method = RequestMethod.GET)
public ResponseEntity<Pet> findPetsByTags(@ApiParam(value = "Tags to filter by") @RequestParam(value = "tags", required = false) List<String> tags
)
throws NotFoundException {
// do some magic!
@ -110,7 +114,8 @@ public class PetApi {
produces = { "application/json", "application/xml" },
method = RequestMethod.GET)
public ResponseEntity<Pet> getPetById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("petId") Long petId
public ResponseEntity<Pet> getPetById(
@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("petId") Long petId
)
throws NotFoundException {
// do some magic!
@ -126,14 +131,17 @@ public class PetApi {
produces = { "application/json", "application/xml" },
consumes = { "application/x-www-form-urlencoded" },
method = RequestMethod.POST)
public ResponseEntity<Void> updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") String petId
public ResponseEntity<Void> updatePetWithForm(
@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") String petId
,
@ApiParam(value = "Updated name of the pet" )@RequestPart("name") String name,
@ApiParam(value = "Updated name of the pet" ) @RequestPart(value="name", required=false) String name,
@ApiParam(value = "Updated status of the pet" )@RequestPart("status") String status)
@ApiParam(value = "Updated status of the pet" ) @RequestPart(value="status", required=false) String status)
throws NotFoundException {
// do some magic!
return new ResponseEntity<Void>(HttpStatus.OK);
@ -148,9 +156,11 @@ public class PetApi {
produces = { "application/json", "application/xml" },
method = RequestMethod.DELETE)
public ResponseEntity<Void> deletePet(@ApiParam(value = "" ) @RequestHeader(value="apiKey", required=false) String apiKey
public ResponseEntity<Void> deletePet(
@ApiParam(value = "" ) @RequestHeader(value="apiKey", required=false) String apiKey
,
@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId
@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId
)
throws NotFoundException {
// do some magic!
@ -166,12 +176,15 @@ public class PetApi {
produces = { "application/json", "application/xml" },
consumes = { "multipart/form-data" },
method = RequestMethod.POST)
public ResponseEntity<Void> uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId
public ResponseEntity<Void> uploadFile(
@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId
,
@ApiParam(value = "Additional data to pass to server" )@RequestPart("additionalMetadata") String additionalMetadata,
@ApiParam(value = "Additional data to pass to server" ) @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,
@ApiParam(value = "file detail") @RequestPart("file") MultipartFile fileDetail)
throws NotFoundException {
// do some magic!

View File

@ -57,6 +57,7 @@ public class StoreApi {
method = RequestMethod.POST)
public ResponseEntity<Order> placeOrder(
@ApiParam(value = "order placed for purchasing the pet" ) Order body)
throws NotFoundException {
// do some magic!
@ -74,7 +75,8 @@ public class StoreApi {
produces = { "application/json", "application/xml" },
method = RequestMethod.GET)
public ResponseEntity<Order> getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") String orderId
public ResponseEntity<Order> getOrderById(
@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") String orderId
)
throws NotFoundException {
// do some magic!
@ -91,7 +93,8 @@ public class StoreApi {
produces = { "application/json", "application/xml" },
method = RequestMethod.DELETE)
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("orderId") String orderId
)
throws NotFoundException {
// do some magic!

View File

@ -41,6 +41,7 @@ public class UserApi {
method = RequestMethod.POST)
public ResponseEntity<Void> createUser(
@ApiParam(value = "Created user object" ) User body)
throws NotFoundException {
// do some magic!
@ -57,6 +58,7 @@ public class UserApi {
method = RequestMethod.POST)
public ResponseEntity<Void> createUsersWithArrayInput(
@ApiParam(value = "List of user object" ) List<User> body)
throws NotFoundException {
// do some magic!
@ -73,6 +75,7 @@ public class UserApi {
method = RequestMethod.POST)
public ResponseEntity<Void> createUsersWithListInput(
@ApiParam(value = "List of user object" ) List<User> body)
throws NotFoundException {
// do some magic!
@ -90,8 +93,10 @@ public class UserApi {
method = RequestMethod.GET)
public ResponseEntity<String> loginUser(@ApiParam(value = "The user name for login") @RequestParam(value = "username", required = false) String username
,
@ApiParam(value = "The password for login in clear text") @RequestParam(value = "password", required = false) String password
)
throws NotFoundException {
// do some magic!
@ -124,7 +129,8 @@ public class UserApi {
produces = { "application/json", "application/xml" },
method = RequestMethod.GET)
public ResponseEntity<User> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username
public ResponseEntity<User> getUserByName(
@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username
)
throws NotFoundException {
// do some magic!
@ -141,9 +147,11 @@ public class UserApi {
produces = { "application/json", "application/xml" },
method = RequestMethod.PUT)
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" ) User body)
throws NotFoundException {
// do some magic!
@ -160,7 +168,8 @@ public class UserApi {
produces = { "application/json", "application/xml" },
method = RequestMethod.DELETE)
public ResponseEntity<Void> deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username
public ResponseEntity<Void> deleteUser(
@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username
)
throws NotFoundException {
// do some magic!