diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/pom.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/pom.mustache index 1bd168af747..eebdd6f7578 100644 --- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/pom.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/pom.mustache @@ -129,7 +129,7 @@ - 1.5.2-M2-SNAPSHOT + 1.5.2-M2 9.2.9.v20150224 1.13 1.6.3 diff --git a/samples/client/petstore/android-java/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/android-java/src/main/java/io/swagger/client/api/PetApi.java index 88fdfdb6980..ebf600d787e 100644 --- a/samples/client/petstore/android-java/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/android-java/src/main/java/io/swagger/client/api/PetApi.java @@ -63,7 +63,7 @@ public class PetApi { String[] contentTypes = { - "application/json","application/xml", + "application/json","application/xml" }; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; @@ -117,7 +117,7 @@ public class PetApi { String[] contentTypes = { - "application/json","application/xml", + "application/json","application/xml" }; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; @@ -349,7 +349,7 @@ public class PetApi { String[] contentTypes = { - "application/x-www-form-urlencoded", + "application/x-www-form-urlencoded" }; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; @@ -481,7 +481,7 @@ public class PetApi { String[] contentTypes = { - "multipart/form-data", + "multipart/form-data" }; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; diff --git a/samples/client/petstore/java/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/java/src/main/java/io/swagger/client/api/PetApi.java index b5d6bb70d79..10326d8a2d6 100644 --- a/samples/client/petstore/java/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/java/src/main/java/io/swagger/client/api/PetApi.java @@ -57,7 +57,7 @@ public class PetApi { String[] contentTypes = { - "application/json","application/xml", + "application/json","application/xml" }; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; @@ -107,7 +107,7 @@ public class PetApi { String[] contentTypes = { - "application/json","application/xml", + "application/json","application/xml" }; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; @@ -325,7 +325,7 @@ public class PetApi { String[] contentTypes = { - "application/x-www-form-urlencoded", + "application/x-www-form-urlencoded" }; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; @@ -449,7 +449,7 @@ public class PetApi { String[] contentTypes = { - "multipart/form-data", + "multipart/form-data" }; String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; diff --git a/samples/client/petstore/objc/client/SWGPetApi.m b/samples/client/petstore/objc/client/SWGPetApi.m index 62bc34acbee..55ea82f99b0 100644 --- a/samples/client/petstore/objc/client/SWGPetApi.m +++ b/samples/client/petstore/objc/client/SWGPetApi.m @@ -75,7 +75,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; - NSArray* requestContentTypes = @[@"application/json", @"application/xml", ]; + NSArray* requestContentTypes = @[@"application/json", @"application/xml"]; NSString* requestContentType = [requestContentTypes count] > 0 ? requestContentTypes[0] : @"application/json"; NSArray* responseContentTypes = @[@"application/json", @"application/xml"]; @@ -166,7 +166,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; - NSArray* requestContentTypes = @[@"application/json", @"application/xml", ]; + NSArray* requestContentTypes = @[@"application/json", @"application/xml"]; NSString* requestContentType = [requestContentTypes count] > 0 ? requestContentTypes[0] : @"application/json"; NSArray* responseContentTypes = @[@"application/json", @"application/xml"]; @@ -519,7 +519,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"petId", @"}"]] withString: [SWGApiClient escape:petId]]; - NSArray* requestContentTypes = @[@"application/x-www-form-urlencoded", ]; + NSArray* requestContentTypes = @[@"application/x-www-form-urlencoded"]; NSString* requestContentType = [requestContentTypes count] > 0 ? requestContentTypes[0] : @"application/json"; NSArray* responseContentTypes = @[@"application/json", @"application/xml"]; @@ -681,7 +681,7 @@ static NSString * basePath = @"http://petstore.swagger.io/v2"; [requestUrl replaceCharactersInRange: [requestUrl rangeOfString:[NSString stringWithFormat:@"%@%@%@", @"{", @"petId", @"}"]] withString: [SWGApiClient escape:petId]]; - NSArray* requestContentTypes = @[@"multipart/form-data", ]; + NSArray* requestContentTypes = @[@"multipart/form-data"]; NSString* requestContentType = [requestContentTypes count] > 0 ? requestContentTypes[0] : @"application/json"; NSArray* responseContentTypes = @[@"application/json", @"application/xml"]; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/APIClient.php b/samples/client/petstore/php/SwaggerClient-php/lib/APIClient.php index d6d14c72527..d3fe07aa911 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/APIClient.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/APIClient.php @@ -142,20 +142,21 @@ class APIClient { $response_info = curl_getinfo($curl); // Handle the response - if ($response === false) { // error, likely in the client side - throw new APIClientException("API Error ($url): ".curl_error($curl), 0, $response_info, $response); + if ($response_info['http_code'] == 0) { + throw new APIClientException("TIMEOUT: api call to " . $url . + " took more than 5s to return", 0, $response_info, $response); } else if ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299 ) { $data = json_decode($response); if (json_last_error() > 0) { // if response is a string $data = $response; } - } else if ($response_info['http_code'] == 401) { // server returns 401 + } else if ($response_info['http_code'] == 401) { throw new APIClientException("Unauthorized API request to " . $url . ": " . serialize($response), 0, $response_info, $response); - } else if ($response_info['http_code'] == 404) { // server returns 404 + } else if ($response_info['http_code'] == 404) { $data = null; } else { - throw new APIClientException("Can't connect to the API: " . $url . + throw new APIClientException("Can't connect to the api: " . $url . " response code: " . $response_info['http_code'], 0, $response_info, $response); } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/PetApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/PetApi.php index 07f6181a730..a61757e2160 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/PetApi.php @@ -52,7 +52,7 @@ class PetApi { if ($_header_accept !== '') { $headerParams['Accept'] = $_header_accept; } - $_header_content_type = array('application/json','application/xml',); + $_header_content_type = array('application/json','application/xml'); $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; @@ -104,7 +104,7 @@ class PetApi { if ($_header_accept !== '') { $headerParams['Accept'] = $_header_accept; } - $_header_content_type = array('application/json','application/xml',); + $_header_content_type = array('application/json','application/xml'); $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; @@ -340,7 +340,7 @@ class PetApi { if ($_header_accept !== '') { $headerParams['Accept'] = $_header_accept; } - $_header_content_type = array('application/x-www-form-urlencoded',); + $_header_content_type = array('application/x-www-form-urlencoded'); $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; @@ -466,7 +466,7 @@ class PetApi { if ($_header_accept !== '') { $headerParams['Accept'] = $_header_accept; } - $_header_content_type = array('multipart/form-data',); + $_header_content_type = array('multipart/form-data'); $headerParams['Content-Type'] = count($_header_content_type) > 0 ? $_header_content_type[0] : 'application/json'; diff --git a/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore/pet_api.py b/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore/pet_api.py index d842c2f0a0f..b9d38108718 100644 --- a/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore/pet_api.py +++ b/samples/client/petstore/python/SwaggerPetstore-python/SwaggerPetstore/pet_api.py @@ -66,7 +66,7 @@ class PetApi(object): accepts = ['application/json', 'application/xml'] headerParams['Accept'] = ', '.join(accepts) - content_types = ['application/json', 'application/xml', ] + content_types = ['application/json', 'application/xml'] headerParams['Content-Type'] = content_types[0] if len(content_types) > 0 else 'application/json' @@ -124,7 +124,7 @@ class PetApi(object): accepts = ['application/json', 'application/xml'] headerParams['Accept'] = ', '.join(accepts) - content_types = ['application/json', 'application/xml', ] + content_types = ['application/json', 'application/xml'] headerParams['Content-Type'] = content_types[0] if len(content_types) > 0 else 'application/json' @@ -379,7 +379,7 @@ class PetApi(object): accepts = ['application/json', 'application/xml'] headerParams['Accept'] = ', '.join(accepts) - content_types = ['application/x-www-form-urlencoded', ] + content_types = ['application/x-www-form-urlencoded'] headerParams['Content-Type'] = content_types[0] if len(content_types) > 0 else 'application/json' @@ -513,7 +513,7 @@ class PetApi(object): accepts = ['application/json', 'application/xml'] headerParams['Accept'] = ', '.join(accepts) - content_types = ['multipart/form-data', ] + content_types = ['multipart/form-data'] headerParams['Content-Type'] = content_types[0] if len(content_types) > 0 else 'application/json' diff --git a/samples/client/petstore/qt5cpp/client/SWGPet.h b/samples/client/petstore/qt5cpp/client/SWGPet.h index 3f9320f1507..e9cb4d08233 100644 --- a/samples/client/petstore/qt5cpp/client/SWGPet.h +++ b/samples/client/petstore/qt5cpp/client/SWGPet.h @@ -10,10 +10,10 @@ #include -#include -#include "SWGCategory.h" -#include #include "SWGTag.h" +#include +#include "SWGCategory.h" +#include #include "SWGObject.h" diff --git a/samples/client/petstore/ruby/lib/swagger_client/api/pet_api.rb b/samples/client/petstore/ruby/lib/swagger_client/api/pet_api.rb index 6f2740b22e9..d89cb6ae566 100644 --- a/samples/client/petstore/ruby/lib/swagger_client/api/pet_api.rb +++ b/samples/client/petstore/ruby/lib/swagger_client/api/pet_api.rb @@ -27,7 +27,7 @@ module SwaggerClient _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' - _header_content_type = ['application/json', 'application/xml', ] + _header_content_type = ['application/json', 'application/xml'] header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type) # form parameters @@ -62,7 +62,7 @@ module SwaggerClient _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' - _header_content_type = ['application/json', 'application/xml', ] + _header_content_type = ['application/json', 'application/xml'] header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type) # form parameters @@ -215,7 +215,7 @@ module SwaggerClient _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' - _header_content_type = ['application/x-www-form-urlencoded', ] + _header_content_type = ['application/x-www-form-urlencoded'] header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type) # form parameters @@ -297,7 +297,7 @@ module SwaggerClient _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' - _header_content_type = ['multipart/form-data', ] + _header_content_type = ['multipart/form-data'] header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type) # form parameters diff --git a/samples/html/index.html b/samples/html/index.html index 1025186dc4b..4a9212ea440 100644 --- a/samples/html/index.html +++ b/samples/html/index.html @@ -79,11 +79,37 @@

Example data

Content-Type: application/json
-
[ {\n  "tags" : [ {\n    "id" : 123456789,\n    "name" : "aeiou"\n  } ],\n  "id" : 123456789,\n  "category" : {\n    "id" : 123456789,\n    "name" : "aeiou"\n  },\n  "status" : "aeiou",\n  "name" : "doggie",\n  "photoUrls" : [ "aeiou" ]\n} ]
+
[ {
+  "tags" : [ {
+    "id" : 123456789,
+    "name" : "aeiou"
+  } ],
+  "id" : 123456789,
+  "category" : {
+    "id" : 123456789,
+    "name" : "aeiou"
+  },
+  "status" : "aeiou",
+  "name" : "doggie",
+  "photoUrls" : [ "aeiou" ]
+} ]

Example data

Content-Type: application/xml
-
\n  123456\n  \n    123456\n    string\n  \n  doggie\n  string\n  \n    123456\n    string\n  \n  string\n
+
<Pet>
+  <id>123456</id>
+  <Category>
+    <id>123456</id>
+    <name>string</name>
+  </Category>
+  <name>doggie</name>
+  <photoUrls>string</photoUrls>
+  <Tag>
+    <id>123456</id>
+    <name>string</name>
+  </Tag>
+  <status>string</status>
+</Pet>

@@ -108,11 +134,37 @@

Example data

Content-Type: application/json
-
[ {\n  "tags" : [ {\n    "id" : 123456789,\n    "name" : "aeiou"\n  } ],\n  "id" : 123456789,\n  "category" : {\n    "id" : 123456789,\n    "name" : "aeiou"\n  },\n  "status" : "aeiou",\n  "name" : "doggie",\n  "photoUrls" : [ "aeiou" ]\n} ]
+
[ {
+  "tags" : [ {
+    "id" : 123456789,
+    "name" : "aeiou"
+  } ],
+  "id" : 123456789,
+  "category" : {
+    "id" : 123456789,
+    "name" : "aeiou"
+  },
+  "status" : "aeiou",
+  "name" : "doggie",
+  "photoUrls" : [ "aeiou" ]
+} ]

Example data

Content-Type: application/xml
-
\n  123456\n  \n    123456\n    string\n  \n  doggie\n  string\n  \n    123456\n    string\n  \n  string\n
+
<Pet>
+  <id>123456</id>
+  <Category>
+    <id>123456</id>
+    <name>string</name>
+  </Category>
+  <name>doggie</name>
+  <photoUrls>string</photoUrls>
+  <Tag>
+    <id>123456</id>
+    <name>string</name>
+  </Tag>
+  <status>string</status>
+</Pet>

@@ -137,11 +189,37 @@

Example data

Content-Type: application/json
-
{\n  "tags" : [ {\n    "id" : 123456789,\n    "name" : "aeiou"\n  } ],\n  "id" : 123456789,\n  "category" : {\n    "id" : 123456789,\n    "name" : "aeiou"\n  },\n  "status" : "aeiou",\n  "name" : "doggie",\n  "photoUrls" : [ "aeiou" ]\n}
+
{
+  "tags" : [ {
+    "id" : 123456789,
+    "name" : "aeiou"
+  } ],
+  "id" : 123456789,
+  "category" : {
+    "id" : 123456789,
+    "name" : "aeiou"
+  },
+  "status" : "aeiou",
+  "name" : "doggie",
+  "photoUrls" : [ "aeiou" ]
+}

Example data

Content-Type: application/xml
-
\n  123456\n  \n    123456\n    string\n  \n  doggie\n  string\n  \n    123456\n    string\n  \n  string\n
+
<Pet>
+  <id>123456</id>
+  <Category>
+    <id>123456</id>
+    <name>string</name>
+  </Category>
+  <name>doggie</name>
+  <photoUrls>string</photoUrls>
+  <Tag>
+    <id>123456</id>
+    <name>string</name>
+  </Tag>
+  <status>string</status>
+</Pet>

@@ -241,11 +319,13 @@

Example data

Content-Type: application/json
-
{\n  "key" : 123\n}
+
{
+  "key" : 123
+}

Example data

Content-Type: application/xml
-
not implemented com.wordnik.swagger.models.properties.MapProperty@5076b51c
+
not implemented com.wordnik.swagger.models.properties.MapProperty@3e

@@ -270,11 +350,25 @@

Example data

Content-Type: application/json
-
{\n  "id" : 123456789,\n  "petId" : 123456789,\n  "complete" : true,\n  "status" : "aeiou",\n  "quantity" : 123,\n  "shipDate" : "2015-05-12T09:58:06.953+0000"\n}
+
{
+  "id" : 123456789,
+  "petId" : 123456789,
+  "complete" : true,
+  "status" : "aeiou",
+  "quantity" : 123,
+  "shipDate" : "2015-05-21T05:19:00.242+0000"
+}

Example data

Content-Type: application/xml
-
\n  123456\n  123456\n  0\n  2015-05-12T05:58:06.956Z\n  string\n  true\n
+
<Order>
+  <id>123456</id>
+  <petId>123456</petId>
+  <quantity>0</quantity>
+  <shipDate>2015-05-20T22:19:00.244Z</shipDate>
+  <status>string</status>
+  <complete>true</complete>
+</Order>

@@ -299,11 +393,25 @@

Example data

Content-Type: application/json
-
{\n  "id" : 123456789,\n  "petId" : 123456789,\n  "complete" : true,\n  "status" : "aeiou",\n  "quantity" : 123,\n  "shipDate" : "2015-05-12T09:58:06.957+0000"\n}
+
{
+  "id" : 123456789,
+  "petId" : 123456789,
+  "complete" : true,
+  "status" : "aeiou",
+  "quantity" : 123,
+  "shipDate" : "2015-05-21T05:19:00.245+0000"
+}

Example data

Content-Type: application/xml
-
\n  123456\n  123456\n  0\n  2015-05-12T05:58:06.957Z\n  string\n  true\n
+
<Order>
+  <id>123456</id>
+  <petId>123456</petId>
+  <quantity>0</quantity>
+  <shipDate>2015-05-20T22:19:00.246Z</shipDate>
+  <status>string</status>
+  <complete>true</complete>
+</Order>

@@ -415,7 +523,7 @@

Example data

Content-Type: application/json
-
"aeiou"
+
"aeiou"

Example data

Content-Type: application/xml
@@ -462,11 +570,16 @@

Example data

Content-Type: application/json
-
{\n  "id" : 123456789,\n  "lastName" : "aeiou",\n  "phone" : "aeiou",\n  "username" : "aeiou",\n  "email" : "aeiou",\n  "userStatus" : 123,\n  "firstName" : "aeiou",\n  "password" : "aeiou"\n}
- -

Example data

-
Content-Type: application/xml
-
\n  123456\n  string\n  string\n  string\n  string\n  string\n  string\n  0\n
+
{
+  "id" : 1,
+  "username" : "johnp",
+  "firstName" : "John",
+  "lastName" : "Public",
+  "email" : "johnp@swagger.io",
+  "password" : "-secret-",
+  "phone" : "0123456789",
+  "userStatus" : 0
+}

diff --git a/samples/server/petstore/jaxrs/pom.xml b/samples/server/petstore/jaxrs/pom.xml index c928b341b38..b57a4fd416d 100644 --- a/samples/server/petstore/jaxrs/pom.xml +++ b/samples/server/petstore/jaxrs/pom.xml @@ -129,7 +129,7 @@ - 1.5.2-M2-SNAPSHOT + 1.5.2-M2 9.2.9.v20150224 1.13 1.6.3 diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/PetApi.java index 8b3b9d40b06..a303cf84bc3 100644 --- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/PetApi.java @@ -21,12 +21,14 @@ import javax.ws.rs.core.Response; import javax.ws.rs.*; @Path("/pet") + + @com.wordnik.swagger.annotations.Api(value = "/pet", description = "the pet API") public class PetApi { @PUT - @Consumes({ "application/json", "application/xml", }) + @Consumes({ "application/json", "application/xml" }) @Produces({ "application/json", "application/xml" }) @com.wordnik.swagger.annotations.ApiOperation(value = "Update an existing pet", notes = "", response = Void.class) @com.wordnik.swagger.annotations.ApiResponses(value = { @@ -45,7 +47,7 @@ public class PetApi { @POST - @Consumes({ "application/json", "application/xml", }) + @Consumes({ "application/json", "application/xml" }) @Produces({ "application/json", "application/xml" }) @com.wordnik.swagger.annotations.ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class) @com.wordnik.swagger.annotations.ApiResponses(value = { @@ -113,7 +115,7 @@ public class PetApi { @POST @Path("/{petId}") - @Consumes({ "application/x-www-form-urlencoded", }) + @Consumes({ "application/x-www-form-urlencoded" }) @Produces({ "application/json", "application/xml" }) @com.wordnik.swagger.annotations.ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class) @com.wordnik.swagger.annotations.ApiResponses(value = { @@ -146,7 +148,7 @@ public class PetApi { @POST @Path("/{petId}/uploadImage") - @Consumes({ "multipart/form-data", }) + @Consumes({ "multipart/form-data" }) @Produces({ "application/json", "application/xml" }) @com.wordnik.swagger.annotations.ApiOperation(value = "uploads an image", notes = "", response = Void.class) @com.wordnik.swagger.annotations.ApiResponses(value = { diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/StoreApi.java index d2bde7cf35b..660f6317422 100644 --- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/StoreApi.java @@ -21,6 +21,8 @@ import javax.ws.rs.core.Response; import javax.ws.rs.*; @Path("/store") + + @com.wordnik.swagger.annotations.Api(value = "/store", description = "the store API") public class StoreApi { diff --git a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/UserApi.java index 3f6da2c5d92..d907b8b579b 100644 --- a/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/jaxrs/src/main/java/io/swagger/api/UserApi.java @@ -21,6 +21,8 @@ import javax.ws.rs.core.Response; import javax.ws.rs.*; @Path("/user") + + @com.wordnik.swagger.annotations.Api(value = "/user", description = "the user API") public class UserApi { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java index ca48e7b10ff..1484dcc4dea 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java @@ -40,9 +40,10 @@ public class PetApi { @ApiResponse(code = 400, message = "Invalid ID supplied") }) @RequestMapping(value = "", produces = { "application/json", "application/xml" }, - consumes = { "application/json", "application/xml", }, + consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) - public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body) + public ResponseEntity updatePet( +@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body) throws NotFoundException { // do some magic! return new ResponseEntity(HttpStatus.OK); @@ -55,9 +56,10 @@ public class PetApi { @ApiResponse(code = 405, message = "Invalid input") }) @RequestMapping(value = "", produces = { "application/json", "application/xml" }, - consumes = { "application/json", "application/xml", }, + consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) - public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body) + public ResponseEntity addPet( +@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body) throws NotFoundException { // do some magic! return new ResponseEntity(HttpStatus.OK); @@ -73,7 +75,8 @@ public class PetApi { produces = { "application/json", "application/xml" }, method = RequestMethod.GET) - public ResponseEntity findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter") @RequestParam(value = "status", required = false) List status) + public ResponseEntity findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter") @RequestParam(value = "status", required = false) List status +) throws NotFoundException { // do some magic! return new ResponseEntity(HttpStatus.OK); @@ -89,7 +92,8 @@ public class PetApi { produces = { "application/json", "application/xml" }, method = RequestMethod.GET) - public ResponseEntity findPetsByTags(@ApiParam(value = "Tags to filter by") @RequestParam(value = "tags", required = false) List tags) + public ResponseEntity findPetsByTags(@ApiParam(value = "Tags to filter by") @RequestParam(value = "tags", required = false) List tags +) throws NotFoundException { // do some magic! return new ResponseEntity(HttpStatus.OK); @@ -106,7 +110,8 @@ public class PetApi { produces = { "application/json", "application/xml" }, method = RequestMethod.GET) - public ResponseEntity getPetById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("petId") Long petId) + public ResponseEntity getPetById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("petId") Long petId +) throws NotFoundException { // do some magic! return new ResponseEntity(HttpStatus.OK); @@ -119,12 +124,15 @@ public class PetApi { @ApiResponse(code = 405, message = "Invalid input") }) @RequestMapping(value = "/{petId}", produces = { "application/json", "application/xml" }, - consumes = { "application/x-www-form-urlencoded", }, + consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") String petId, + public ResponseEntity 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 status of the pet" )@RequestPart("status") String status) throws NotFoundException { // do some magic! @@ -140,8 +148,10 @@ public class PetApi { produces = { "application/json", "application/xml" }, method = RequestMethod.DELETE) - public ResponseEntity deletePet(@ApiParam(value = "" )@RequestHeader("apiKey") String apiKey, - @ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId) + public ResponseEntity deletePet(@ApiParam(value = "" ) @RequestHeader(value="apiKey", required=false) String apiKey +, + @ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId +) throws NotFoundException { // do some magic! return new ResponseEntity(HttpStatus.OK); @@ -154,12 +164,15 @@ public class PetApi { @ApiResponse(code = 0, message = "successful operation") }) @RequestMapping(value = "/{petId}/uploadImage", produces = { "application/json", "application/xml" }, - consumes = { "multipart/form-data", }, + consumes = { "multipart/form-data" }, method = RequestMethod.POST) - public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, + public ResponseEntity 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 = "file detail") @RequestPart("file") MultipartFile fileDetail) + +@ApiParam(value = "file detail") @RequestPart("file") MultipartFile fileDetail) throws NotFoundException { // do some magic! return new ResponseEntity(HttpStatus.OK); diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java index 4f3eb963e16..5951036403d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java @@ -56,7 +56,8 @@ public class StoreApi { produces = { "application/json", "application/xml" }, method = RequestMethod.POST) - public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ) Order body) + public ResponseEntity placeOrder( +@ApiParam(value = "order placed for purchasing the pet" ) Order body) throws NotFoundException { // do some magic! return new ResponseEntity(HttpStatus.OK); @@ -73,7 +74,8 @@ public class StoreApi { produces = { "application/json", "application/xml" }, method = RequestMethod.GET) - public ResponseEntity getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") String orderId) + public ResponseEntity getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") String orderId +) throws NotFoundException { // do some magic! return new ResponseEntity(HttpStatus.OK); @@ -89,7 +91,8 @@ public class StoreApi { produces = { "application/json", "application/xml" }, method = RequestMethod.DELETE) - public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId) + public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId +) throws NotFoundException { // do some magic! return new ResponseEntity(HttpStatus.OK); diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java index 25671c6168d..a978aad2d5e 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java @@ -40,7 +40,8 @@ public class UserApi { produces = { "application/json", "application/xml" }, method = RequestMethod.POST) - public ResponseEntity createUser(@ApiParam(value = "Created user object" ) User body) + public ResponseEntity createUser( +@ApiParam(value = "Created user object" ) User body) throws NotFoundException { // do some magic! return new ResponseEntity(HttpStatus.OK); @@ -55,7 +56,8 @@ public class UserApi { produces = { "application/json", "application/xml" }, method = RequestMethod.POST) - public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ) List body) + public ResponseEntity createUsersWithArrayInput( +@ApiParam(value = "List of user object" ) List body) throws NotFoundException { // do some magic! return new ResponseEntity(HttpStatus.OK); @@ -70,7 +72,8 @@ public class UserApi { produces = { "application/json", "application/xml" }, method = RequestMethod.POST) - public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ) List body) + public ResponseEntity createUsersWithListInput( +@ApiParam(value = "List of user object" ) List body) throws NotFoundException { // do some magic! return new ResponseEntity(HttpStatus.OK); @@ -86,8 +89,10 @@ public class UserApi { produces = { "application/json", "application/xml" }, method = RequestMethod.GET) - public ResponseEntity 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) + public ResponseEntity 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! return new ResponseEntity(HttpStatus.OK); @@ -119,7 +124,8 @@ public class UserApi { produces = { "application/json", "application/xml" }, method = RequestMethod.GET) - public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) + public ResponseEntity 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! return new ResponseEntity(HttpStatus.OK); @@ -135,8 +141,10 @@ public class UserApi { produces = { "application/json", "application/xml" }, method = RequestMethod.PUT) - public ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, - @ApiParam(value = "Updated user object" ) User body) + public ResponseEntity 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! return new ResponseEntity(HttpStatus.OK); @@ -152,7 +160,8 @@ public class UserApi { produces = { "application/json", "application/xml" }, method = RequestMethod.DELETE) - public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username) + public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username +) throws NotFoundException { // do some magic! return new ResponseEntity(HttpStatus.OK);