This commit is contained in:
Tony Tam 2015-05-20 22:20:51 -07:00
parent 6fe6a6daa7
commit 11dd7784f8
17 changed files with 227 additions and 82 deletions

View File

@ -129,7 +129,7 @@
</repository>
</repositories>
<properties>
<swagger-core-version>1.5.2-M2-SNAPSHOT</swagger-core-version>
<swagger-core-version>1.5.2-M2</swagger-core-version>
<jetty-version>9.2.9.v20150224</jetty-version>
<jersey-version>1.13</jersey-version>
<slf4j-version>1.6.3</slf4j-version>

View File

@ -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";

View File

@ -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";

View File

@ -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"];

View File

@ -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);
}

View File

@ -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';

View File

@ -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'

View File

@ -10,10 +10,10 @@
#include <QJsonObject>
#include <QString>
#include "SWGCategory.h"
#include <QList>
#include "SWGTag.h"
#include <QList>
#include "SWGCategory.h"
#include <QString>
#include "SWGObject.h"

View File

@ -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

View File

@ -79,11 +79,37 @@
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>[ {\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} ]</code></pre>
<pre class="example"><code>[ {
&quot;tags&quot; : [ {
&quot;id&quot; : 123456789,
&quot;name&quot; : &quot;aeiou&quot;
} ],
&quot;id&quot; : 123456789,
&quot;category&quot; : {
&quot;id&quot; : 123456789,
&quot;name&quot; : &quot;aeiou&quot;
},
&quot;status&quot; : &quot;aeiou&quot;,
&quot;name&quot; : &quot;doggie&quot;,
&quot;photoUrls&quot; : [ &quot;aeiou&quot; ]
} ]</code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code><Pet>\n <id>123456</id>\n <Category>\n <id>123456</id>\n <name>string</name>\n </Category>\n <name>doggie</name>\n <photoUrls>string</photoUrls>\n <Tag>\n <id>123456</id>\n <name>string</name>\n </Tag>\n <status>string</status>\n</Pet></code></pre>
<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>
</div> <!-- method -->
<hr>
@ -108,11 +134,37 @@
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>[ {\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} ]</code></pre>
<pre class="example"><code>[ {
&quot;tags&quot; : [ {
&quot;id&quot; : 123456789,
&quot;name&quot; : &quot;aeiou&quot;
} ],
&quot;id&quot; : 123456789,
&quot;category&quot; : {
&quot;id&quot; : 123456789,
&quot;name&quot; : &quot;aeiou&quot;
},
&quot;status&quot; : &quot;aeiou&quot;,
&quot;name&quot; : &quot;doggie&quot;,
&quot;photoUrls&quot; : [ &quot;aeiou&quot; ]
} ]</code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code><Pet>\n <id>123456</id>\n <Category>\n <id>123456</id>\n <name>string</name>\n </Category>\n <name>doggie</name>\n <photoUrls>string</photoUrls>\n <Tag>\n <id>123456</id>\n <name>string</name>\n </Tag>\n <status>string</status>\n</Pet></code></pre>
<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>
</div> <!-- method -->
<hr>
@ -137,11 +189,37 @@
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>{\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}</code></pre>
<pre class="example"><code>{
&quot;tags&quot; : [ {
&quot;id&quot; : 123456789,
&quot;name&quot; : &quot;aeiou&quot;
} ],
&quot;id&quot; : 123456789,
&quot;category&quot; : {
&quot;id&quot; : 123456789,
&quot;name&quot; : &quot;aeiou&quot;
},
&quot;status&quot; : &quot;aeiou&quot;,
&quot;name&quot; : &quot;doggie&quot;,
&quot;photoUrls&quot; : [ &quot;aeiou&quot; ]
}</code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code><Pet>\n <id>123456</id>\n <Category>\n <id>123456</id>\n <name>string</name>\n </Category>\n <name>doggie</name>\n <photoUrls>string</photoUrls>\n <Tag>\n <id>123456</id>\n <name>string</name>\n </Tag>\n <status>string</status>\n</Pet></code></pre>
<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>
</div> <!-- method -->
<hr>
@ -241,11 +319,13 @@
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>{\n "key" : 123\n}</code></pre>
<pre class="example"><code>{
&quot;key&quot; : 123
}</code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code>not implemented com.wordnik.swagger.models.properties.MapProperty@5076b51c</code></pre>
<pre class="example"><code>not implemented com.wordnik.swagger.models.properties.MapProperty@3e</code></pre>
</div> <!-- method -->
<hr>
@ -270,11 +350,25 @@
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>{\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}</code></pre>
<pre class="example"><code>{
&quot;id&quot; : 123456789,
&quot;petId&quot; : 123456789,
&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;
}</code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code><Order>\n <id>123456</id>\n <petId>123456</petId>\n <quantity>0</quantity>\n <shipDate>2015-05-12T05:58:06.956Z</shipDate>\n <status>string</status>\n <complete>true</complete>\n</Order></code></pre>
<pre class="example"><code>&lt;Order&gt;
&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;status&gt;string&lt;/status&gt;
&lt;complete&gt;true&lt;/complete&gt;
&lt;/Order&gt;</code></pre>
</div> <!-- method -->
<hr>
@ -299,11 +393,25 @@
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>{\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}</code></pre>
<pre class="example"><code>{
&quot;id&quot; : 123456789,
&quot;petId&quot; : 123456789,
&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;
}</code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code><Order>\n <id>123456</id>\n <petId>123456</petId>\n <quantity>0</quantity>\n <shipDate>2015-05-12T05:58:06.957Z</shipDate>\n <status>string</status>\n <complete>true</complete>\n</Order></code></pre>
<pre class="example"><code>&lt;Order&gt;
&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;status&gt;string&lt;/status&gt;
&lt;complete&gt;true&lt;/complete&gt;
&lt;/Order&gt;</code></pre>
</div> <!-- method -->
<hr>
@ -415,7 +523,7 @@
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>"aeiou"</code></pre>
<pre class="example"><code>&quot;aeiou&quot;</code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
@ -462,11 +570,16 @@
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>{\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}</code></pre>
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code><User>\n <id>123456</id>\n <username>string</username>\n <firstName>string</firstName>\n <lastName>string</lastName>\n <email>string</email>\n <password>string</password>\n <phone>string</phone>\n <userStatus>0</userStatus>\n</User></code></pre>
<pre class="example"><code>{
&quot;id&quot; : 1,
&quot;username&quot; : &quot;johnp&quot;,
&quot;firstName&quot; : &quot;John&quot;,
&quot;lastName&quot; : &quot;Public&quot;,
&quot;email&quot; : &quot;johnp@swagger.io&quot;,
&quot;password&quot; : &quot;-secret-&quot;,
&quot;phone&quot; : &quot;0123456789&quot;,
&quot;userStatus&quot; : 0
}</code></pre>
</div> <!-- method -->
<hr>

View File

@ -129,7 +129,7 @@
</repository>
</repositories>
<properties>
<swagger-core-version>1.5.2-M2-SNAPSHOT</swagger-core-version>
<swagger-core-version>1.5.2-M2</swagger-core-version>
<jetty-version>9.2.9.v20150224</jetty-version>
<jersey-version>1.13</jersey-version>
<slf4j-version>1.6.3</slf4j-version>

View File

@ -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 = {

View File

@ -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 {

View File

@ -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 {

View File

@ -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<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body)
public ResponseEntity<Void> updatePet(
@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body)
throws NotFoundException {
// do some magic!
return new ResponseEntity<Void>(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<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body)
public ResponseEntity<Void> addPet(
@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body)
throws NotFoundException {
// do some magic!
return new ResponseEntity<Void>(HttpStatus.OK);
@ -73,7 +75,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") @RequestParam(value = "status", required = false) List<String> status
)
throws NotFoundException {
// do some magic!
return new ResponseEntity<Pet>(HttpStatus.OK);
@ -89,7 +92,8 @@ public class PetApi {
produces = { "application/json", "application/xml" },
method = RequestMethod.GET)
public ResponseEntity<Pet> findPetsByTags(@ApiParam(value = "Tags to filter by") @RequestParam(value = "tags", required = false) List<String> tags)
public ResponseEntity<Pet> findPetsByTags(@ApiParam(value = "Tags to filter by") @RequestParam(value = "tags", required = false) List<String> tags
)
throws NotFoundException {
// do some magic!
return new ResponseEntity<Pet>(HttpStatus.OK);
@ -106,7 +110,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!
return new ResponseEntity<Pet>(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<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 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<Void> deletePet(@ApiParam(value = "" )@RequestHeader("apiKey") String apiKey,
@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId)
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
)
throws NotFoundException {
// do some magic!
return new ResponseEntity<Void>(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<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 = "file detail") @RequestPart("file") MultipartFile fileDetail)
@ApiParam(value = "file detail") @RequestPart("file") MultipartFile fileDetail)
throws NotFoundException {
// do some magic!
return new ResponseEntity<Void>(HttpStatus.OK);

View File

@ -56,7 +56,8 @@ public class StoreApi {
produces = { "application/json", "application/xml" },
method = RequestMethod.POST)
public ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ) Order body)
public ResponseEntity<Order> placeOrder(
@ApiParam(value = "order placed for purchasing the pet" ) Order body)
throws NotFoundException {
// do some magic!
return new ResponseEntity<Order>(HttpStatus.OK);
@ -73,7 +74,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!
return new ResponseEntity<Order>(HttpStatus.OK);
@ -89,7 +91,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!
return new ResponseEntity<Void>(HttpStatus.OK);

View File

@ -40,7 +40,8 @@ public class UserApi {
produces = { "application/json", "application/xml" },
method = RequestMethod.POST)
public ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ) User body)
public ResponseEntity<Void> createUser(
@ApiParam(value = "Created user object" ) User body)
throws NotFoundException {
// do some magic!
return new ResponseEntity<Void>(HttpStatus.OK);
@ -55,7 +56,8 @@ public class UserApi {
produces = { "application/json", "application/xml" },
method = RequestMethod.POST)
public ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ) List<User> body)
public ResponseEntity<Void> createUsersWithArrayInput(
@ApiParam(value = "List of user object" ) List<User> body)
throws NotFoundException {
// do some magic!
return new ResponseEntity<Void>(HttpStatus.OK);
@ -70,7 +72,8 @@ public class UserApi {
produces = { "application/json", "application/xml" },
method = RequestMethod.POST)
public ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ) List<User> body)
public ResponseEntity<Void> createUsersWithListInput(
@ApiParam(value = "List of user object" ) List<User> body)
throws NotFoundException {
// do some magic!
return new ResponseEntity<Void>(HttpStatus.OK);
@ -86,8 +89,10 @@ public class UserApi {
produces = { "application/json", "application/xml" },
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)
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!
return new ResponseEntity<String>(HttpStatus.OK);
@ -119,7 +124,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!
return new ResponseEntity<User>(HttpStatus.OK);
@ -135,8 +141,10 @@ 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,
@ApiParam(value = "Updated user object" ) User body)
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!
return new ResponseEntity<Void>(HttpStatus.OK);
@ -152,7 +160,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!
return new ResponseEntity<Void>(HttpStatus.OK);