- {{#vars}}
{{name}} {{#isNotRequired}}(optional){{/isNotRequired}}
{{datatype}} {{description}}
+ {{#vars}}
{{name}} {{^required}}(optional){{/required}}
{{datatype}} {{description}}
{{#isEnum}}
{{#_enum}}
{{this}}
{{/_enum}}
diff --git a/modules/swagger-codegen/src/main/resources/objc/README.mustache b/modules/swagger-codegen/src/main/resources/objc/README.mustache
index 2e6ffe2f060..c0bc1178b0b 100644
--- a/modules/swagger-codegen/src/main/resources/objc/README.mustache
+++ b/modules/swagger-codegen/src/main/resources/objc/README.mustache
@@ -135,7 +135,7 @@ Class | Method | HTTP request | Description
{{/isBasic}}
{{#isOAuth}}- **Type**: OAuth
- **Flow**: {{{flow}}}
-- **Authorizatoin URL**: {{{authorizationUrl}}}
+- **Authorization URL**: {{{authorizationUrl}}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - **{{{scope}}}**: {{{description}}}
{{/scopes}}
diff --git a/modules/swagger-codegen/src/main/resources/objc/api-header.mustache b/modules/swagger-codegen/src/main/resources/objc/api-header.mustache
index fdf6726dac8..7c5a9d335cf 100644
--- a/modules/swagger-codegen/src/main/resources/objc/api-header.mustache
+++ b/modules/swagger-codegen/src/main/resources/objc/api-header.mustache
@@ -27,7 +27,7 @@
/// {{{summary}}}
/// {{#notes}}{{{notes}}}{{/notes}}
///
-/// {{#allParams}}@param {{paramName}} {{description}}
+/// {{#allParams}}@param {{paramName}} {{description}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
/// {{/allParams}}
///
/// @return {{{returnType}}}
diff --git a/modules/swagger-codegen/src/main/resources/objc/api_doc.mustache b/modules/swagger-codegen/src/main/resources/objc/api_doc.mustache
index 109128c1ca1..3400300c8dc 100644
--- a/modules/swagger-codegen/src/main/resources/objc/api_doc.mustache
+++ b/modules/swagger-codegen/src/main/resources/objc/api_doc.mustache
@@ -82,7 +82,7 @@ Name | Type | Description | Notes
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}}
-### HTTP reuqest headers
+### HTTP request headers
- **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
- **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
diff --git a/modules/swagger-codegen/src/main/resources/perl/README.mustache b/modules/swagger-codegen/src/main/resources/perl/README.mustache
index 630a0a5979b..b312193f1cc 100644
--- a/modules/swagger-codegen/src/main/resources/perl/README.mustache
+++ b/modules/swagger-codegen/src/main/resources/perl/README.mustache
@@ -303,7 +303,7 @@ Class | Method | HTTP request | Description
{{/isBasic}}
{{#isOAuth}}- **Type**: OAuth
- **Flow**: {{{flow}}}
-- **Authorizatoin URL**: {{{authorizationUrl}}}
+- **Authorization URL**: {{{authorizationUrl}}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - **{{{scope}}}**: {{{description}}}
{{/scopes}}
diff --git a/modules/swagger-codegen/src/main/resources/perl/api.mustache b/modules/swagger-codegen/src/main/resources/perl/api.mustache
index 7e0770f332f..d96a2302a8a 100644
--- a/modules/swagger-codegen/src/main/resources/perl/api.mustache
+++ b/modules/swagger-codegen/src/main/resources/perl/api.mustache
@@ -81,13 +81,15 @@ sub new {
sub {{operationId}} {
my ($self, %args) = @_;
- {{#allParams}}{{#required}}
+ {{#allParams}}
+ {{#required}}
# verify the required parameter '{{paramName}}' is set
unless (exists $args{'{{paramName}}'}) {
croak("Missing the required parameter '{{paramName}}' when calling {{operationId}}");
}
- {{/required}}{{/allParams}}
+ {{/required}}
+ {{/allParams}}
# parse inputs
my $_resource_path = '{{path}}';
$_resource_path =~ s/{format}/json/; # default format to json
@@ -104,54 +106,70 @@ sub {{operationId}} {
}
$header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type({{#consumes}}'{{mediaType}}'{{#hasMore}}, {{/hasMore}}{{/consumes}});
- {{#queryParams}}# query params
+ {{#queryParams}}
+ # query params
if ( exists $args{'{{paramName}}'}) {
$query_params->{'{{baseName}}'} = $self->{api_client}->to_query_value($args{'{{paramName}}'});
- }{{/queryParams}}
- {{#headerParams}}# header params
+ }
+
+ {{/queryParams}}
+ {{#headerParams}}
+ # header params
if ( exists $args{'{{paramName}}'}) {
$header_params->{'{{baseName}}'} = $self->{api_client}->to_header_value($args{'{{paramName}}'});
- }{{/headerParams}}
- {{#pathParams}}# path params
+ }
+
+ {{/headerParams}}
+ {{#pathParams}}
+ # path params
if ( exists $args{'{{paramName}}'}) {
my $_base_variable = "{" . "{{baseName}}" . "}";
my $_base_value = $self->{api_client}->to_path_value($args{'{{paramName}}'});
$_resource_path =~ s/$_base_variable/$_base_value/g;
- }{{/pathParams}}
- {{#formParams}}# form params
+ }
+
+ {{/pathParams}}
+ {{#formParams}}
+ # form params
if ( exists $args{'{{paramName}}'} ) {
{{#isFile}}$form_params->{'{{baseName}}'} = [] unless defined $form_params->{'{{baseName}}'};
push @{$form_params->{'{{baseName}}'}}, $args{'{{paramName}}'};
{{/isFile}}
{{^isFile}}$form_params->{'{{baseName}}'} = $self->{api_client}->to_form_value($args{'{{paramName}}'});
{{/isFile}}
- }{{/formParams}}
+ }
+
+ {{/formParams}}
my $_body_data;
- {{#bodyParams}}# body params
+ {{#bodyParams}}
+ # body params
if ( exists $args{'{{paramName}}'}) {
$_body_data = $args{'{{paramName}}'};
- }{{/bodyParams}}
+ }
+ {{/bodyParams}}
# authentication setting, if any
my $auth_settings = [qw({{#authMethods}}{{name}} {{/authMethods}})];
# make the API Call
- {{#returnType}}my $response = $self->{api_client}->call_api($_resource_path, $_method,
+ {{#returnType}}
+ my $response = $self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
if (!$response) {
return;
}
my $_response_object = $self->{api_client}->deserialize('{{returnType}}', $response);
- return $_response_object;{{/returnType}}
- {{^returnType}}$self->{api_client}->call_api($_resource_path, $_method,
+ return $_response_object;
+ {{/returnType}}
+ {{^returnType}}
+ $self->{api_client}->call_api($_resource_path, $_method,
$query_params, $form_params,
$header_params, $_body_data, $auth_settings);
return;
{{/returnType}}
}
{{/operation}}
-{{newline}}
{{/operations}}
1;
diff --git a/modules/swagger-codegen/src/main/resources/perl/api_doc.mustache b/modules/swagger-codegen/src/main/resources/perl/api_doc.mustache
index eb270b7e216..c68934ece2a 100644
--- a/modules/swagger-codegen/src/main/resources/perl/api_doc.mustache
+++ b/modules/swagger-codegen/src/main/resources/perl/api_doc.mustache
@@ -65,7 +65,7 @@ Name | Type | Description | Notes
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}}
-### HTTP reuqest headers
+### HTTP request headers
- **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
- **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
diff --git a/modules/swagger-codegen/src/main/resources/perl/object.mustache b/modules/swagger-codegen/src/main/resources/perl/object.mustache
index 79c59cebaf3..126c6409c7f 100644
--- a/modules/swagger-codegen/src/main/resources/perl/object.mustache
+++ b/modules/swagger-codegen/src/main/resources/perl/object.mustache
@@ -30,14 +30,15 @@ __PACKAGE__->class_documentation({description => '{{description}}',
} );
__PACKAGE__->method_documentation({
- {{#vars}}'{{name}}' => {
+{{#vars}}
+ '{{name}}' => {
datatype => '{{datatype}}',
base_name => '{{baseName}}',
description => '{{description}}',
format => '{{format}}',
read_only => '{{readOnly}}',
},
- {{/vars}}
+{{/vars}}
});
__PACKAGE__->swagger_types( {
diff --git a/modules/swagger-codegen/src/main/resources/php/README.mustache b/modules/swagger-codegen/src/main/resources/php/README.mustache
index 8275c4c9d7c..e64b0bf22c6 100644
--- a/modules/swagger-codegen/src/main/resources/php/README.mustache
+++ b/modules/swagger-codegen/src/main/resources/php/README.mustache
@@ -116,7 +116,7 @@ Class | Method | HTTP request | Description
{{/isBasic}}
{{#isOAuth}}- **Type**: OAuth
- **Flow**: {{{flow}}}
-- **Authorizatoin URL**: {{{authorizationUrl}}}
+- **Authorization URL**: {{{authorizationUrl}}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - **{{{scope}}}**: {{{description}}}
{{/scopes}}
diff --git a/modules/swagger-codegen/src/main/resources/php/api_doc.mustache b/modules/swagger-codegen/src/main/resources/php/api_doc.mustache
index bb55e80604c..ba3529e969c 100644
--- a/modules/swagger-codegen/src/main/resources/php/api_doc.mustache
+++ b/modules/swagger-codegen/src/main/resources/php/api_doc.mustache
@@ -61,7 +61,7 @@ Name | Type | Description | Notes
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}}
-### HTTP reuqest headers
+### HTTP request headers
- **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
- **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
diff --git a/modules/swagger-codegen/src/main/resources/php/model.mustache b/modules/swagger-codegen/src/main/resources/php/model.mustache
index f19787f50b0..6f292e854af 100644
--- a/modules/swagger-codegen/src/main/resources/php/model.mustache
+++ b/modules/swagger-codegen/src/main/resources/php/model.mustache
@@ -48,6 +48,12 @@ use \ArrayAccess;
*/
class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayAccess
{
+ /**
+ * The original name of the model.
+ * @var string
+ */
+ static $swaggerModelName = '{{name}}';
+
/**
* Array of property to type mappings. Used for (de)serialization
* @var string[]
@@ -115,6 +121,11 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
public function __construct(array $data = null)
{
{{#parent}}parent::__construct($data);{{/parent}}
+ {{#discriminator}}// Initialize discriminator property with the model name.
+ $discrimintor = array_search('{{discriminator}}', self::$attributeMap);
+ $this->{$discrimintor} = static::$swaggerModelName;
+ {{/discriminator}}
+
if ($data != null) {
{{#vars}}$this->{{name}} = $data["{{name}}"];{{#hasMore}}
{{/hasMore}}{{/vars}}
diff --git a/modules/swagger-codegen/src/main/resources/python/README.mustache b/modules/swagger-codegen/src/main/resources/python/README.mustache
index a1ba2f0d298..8fe1045f661 100644
--- a/modules/swagger-codegen/src/main/resources/python/README.mustache
+++ b/modules/swagger-codegen/src/main/resources/python/README.mustache
@@ -108,7 +108,7 @@ Class | Method | HTTP request | Description
{{/isBasic}}
{{#isOAuth}}- **Type**: OAuth
- **Flow**: {{{flow}}}
-- **Authorizatoin URL**: {{{authorizationUrl}}}
+- **Authorization URL**: {{{authorizationUrl}}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - **{{{scope}}}**: {{{description}}}
{{/scopes}}
diff --git a/modules/swagger-codegen/src/main/resources/python/api_doc.mustache b/modules/swagger-codegen/src/main/resources/python/api_doc.mustache
index b4f921fa870..99a05f8c43d 100644
--- a/modules/swagger-codegen/src/main/resources/python/api_doc.mustache
+++ b/modules/swagger-codegen/src/main/resources/python/api_doc.mustache
@@ -63,7 +63,7 @@ Name | Type | Description | Notes
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}}
-### HTTP reuqest headers
+### HTTP request headers
- **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
- **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
diff --git a/modules/swagger-codegen/src/main/resources/ruby/README.mustache b/modules/swagger-codegen/src/main/resources/ruby/README.mustache
index 164285e1533..7f54eef9e69 100644
--- a/modules/swagger-codegen/src/main/resources/ruby/README.mustache
+++ b/modules/swagger-codegen/src/main/resources/ruby/README.mustache
@@ -119,7 +119,7 @@ Class | Method | HTTP request | Description
{{/isBasic}}
{{#isOAuth}}- **Type**: OAuth
- **Flow**: {{flow}}
-- **Authorizatoin URL**: {{authorizationUrl}}
+- **Authorization URL**: {{authorizationUrl}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - {{scope}}: {{description}}
{{/scopes}}
diff --git a/modules/swagger-codegen/src/main/resources/ruby/api_doc.mustache b/modules/swagger-codegen/src/main/resources/ruby/api_doc.mustache
index 6d36e7dfe89..169920a4bc3 100644
--- a/modules/swagger-codegen/src/main/resources/ruby/api_doc.mustache
+++ b/modules/swagger-codegen/src/main/resources/ruby/api_doc.mustache
@@ -68,7 +68,7 @@ Name | Type | Description | Notes
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{name}}](../README.md#{{name}}){{^-last}}, {{/-last}}{{/authMethods}}
-### HTTP reuqest headers
+### HTTP request headers
- **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
- **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
diff --git a/modules/swagger-codegen/src/main/resources/ruby/model.mustache b/modules/swagger-codegen/src/main/resources/ruby/model.mustache
index 373a0634be2..5b7b617481f 100644
--- a/modules/swagger-codegen/src/main/resources/ruby/model.mustache
+++ b/modules/swagger-codegen/src/main/resources/ruby/model.mustache
@@ -23,7 +23,8 @@ module {{moduleName}}{{#models}}{{#model}}{{#description}}
# Attribute type mapping.
def self.swagger_types
{
- {{#vars}}:'{{{name}}}' => :'{{{datatype}}}'{{#hasMore}},{{/hasMore}}
+ {{#vars}}
+ :'{{{name}}}' => :'{{{datatype}}}'{{#hasMore}},{{/hasMore}}
{{/vars}}
}
end
diff --git a/modules/swagger-codegen/src/main/resources/scala/api.mustache b/modules/swagger-codegen/src/main/resources/scala/api.mustache
index 41b58374dea..6345cd876c8 100644
--- a/modules/swagger-codegen/src/main/resources/scala/api.mustache
+++ b/modules/swagger-codegen/src/main/resources/scala/api.mustache
@@ -44,14 +44,14 @@ class {{classname}}(val defBasePath: String = "{{basePath}}",
val headerParams = new HashMap[String, String]
val formParams = new HashMap[String, String]
- {{#requiredParamCount}}
- // verify required params are set
- (List({{/requiredParamCount}}{{#requiredParams}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#requiredParamCount}}).filter(_ != null)).size match {
- case {{requiredParamCount}} => // all required values set
- case _ => throw new Exception("missing required params")
- }
- {{/requiredParamCount}}
+ {{#allParams}}
+ {{#required}}
+ {{^isPrimitiveType}}
+ if ({{paramName}} == null) throw new Exception("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}")
+ {{/isPrimitiveType}}
+ {{/required}}
+ {{/allParams}}
{{#queryParams}}if(String.valueOf({{paramName}}) != "null") queryParams += "{{baseName}}" -> {{paramName}}.toString
{{/queryParams}}
@@ -71,7 +71,8 @@ class {{classname}}(val defBasePath: String = "{{basePath}}",
postBody = mp
}
else {
- {{#formParams}}{{#notFile}}formParams += "{{baseName}}" -> {{paramName}}.toString(){{/notFile}}
+ {{#formParams}}
+ {{#notFile}}formParams += "{{baseName}}" -> {{paramName}}.toString(){{/notFile}}
{{/formParams}}
}
@@ -87,6 +88,7 @@ class {{classname}}(val defBasePath: String = "{{basePath}}",
case ex: ApiException => throw ex
}
}
+
{{/operation}}
}
{{/operations}}
diff --git a/modules/swagger-codegen/src/main/resources/scalatra/model.mustache b/modules/swagger-codegen/src/main/resources/scalatra/model.mustache
index 8c5d1954662..e9dac65dd79 100644
--- a/modules/swagger-codegen/src/main/resources/scalatra/model.mustache
+++ b/modules/swagger-codegen/src/main/resources/scalatra/model.mustache
@@ -7,9 +7,8 @@ package {{package}}
{{#model}}
case class {{classname}} (
- {{#vars}}{{name}}: {{#isNotRequired}}Option[{{/isNotRequired}}{{datatype}}{{#isNotRequired}}] {{#description}} // {{description}}{{/description}}
- {{/isNotRequired}}{{#hasMore}},
- {{/hasMore}}{{/vars}}
+ {{#vars}}{{name}}: {{^required}}Option[{{/required}}{{datatype}}{{^required}}]{{/required}}{{#hasMore}},{{/hasMore}}{{#description}} // {{description}}{{/description}}
+ {{/vars}}
)
{{/model}}
-{{/models}}
\ No newline at end of file
+{{/models}}
diff --git a/modules/swagger-codegen/src/main/resources/swift/AlamofireImplementations.mustache b/modules/swagger-codegen/src/main/resources/swift/AlamofireImplementations.mustache
index 6b4d36f9410..2faa0a6f24d 100644
--- a/modules/swagger-codegen/src/main/resources/swift/AlamofireImplementations.mustache
+++ b/modules/swagger-codegen/src/main/resources/swift/AlamofireImplementations.mustache
@@ -75,7 +75,7 @@ class AlamofireRequestBuilder
: RequestBuilder {
request.authenticate(usingCredential: credential)
}
- request.responseJSON(options: .AllowFragments) { response in
+ request.validate().responseJSON(options: .AllowFragments) { response in
managerStore.removeValueForKey(managerId)
if response.result.isFailure {
diff --git a/modules/swagger-codegen/src/main/resources/swift/Models.mustache b/modules/swagger-codegen/src/main/resources/swift/Models.mustache
index 31cb4a2e219..795fdd3d5e7 100644
--- a/modules/swagger-codegen/src/main/resources/swift/Models.mustache
+++ b/modules/swagger-codegen/src/main/resources/swift/Models.mustache
@@ -130,11 +130,11 @@ class Decoders {
fatalError("formatter failed to parse \(source)")
} {{#models}}{{#model}}
- // Decoder for [{{{classname}}}]
+ // Decoder for [{{{classname}}}]
Decoders.addDecoder(clazz: [{{{classname}}}].self) { (source: AnyObject) -> [{{{classname}}}] in
return Decoders.decode(clazz: [{{{classname}}}].self, source: source)
}
- // Decoder for {{{classname}}}
+ // Decoder for {{{classname}}}
Decoders.addDecoder(clazz: {{{classname}}}.self) { (source: AnyObject) -> {{{classname}}} in
let sourceDictionary = source as! [NSObject:AnyObject]
let instance = {{classname}}(){{#vars}}{{#isEnum}}
diff --git a/modules/swagger-codegen/src/main/resources/swift/api.mustache b/modules/swagger-codegen/src/main/resources/swift/api.mustache
index ada4ec90d36..195fb88aeed 100644
--- a/modules/swagger-codegen/src/main/resources/swift/api.mustache
+++ b/modules/swagger-codegen/src/main/resources/swift/api.mustache
@@ -23,7 +23,7 @@ public class {{classname}}: APIBase {
- parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}}
- parameter completion: completion handler to receive the data and the error objects
*/
- public class func {{operationId}}({{#allParams}}{{^secondaryParam}}{{paramName}} {{/secondaryParam}}{{paramName}}: {{{dataType}}}{{^required}}?{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}completion: (({{#returnType}}data: {{{returnType}}}?, {{/returnType}}error: ErrorType?) -> Void)) {
+ public class func {{operationId}}({{#allParams}}{{^secondaryParam}}{{paramName}} {{/secondaryParam}}{{paramName}}: {{{dataType}}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}completion: (({{#returnType}}data: {{{returnType}}}?, {{/returnType}}error: ErrorType?) -> Void)) {
{{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}).execute { (response, error) -> Void in
completion({{#returnType}}data: response?.body, {{/returnType}}error: error);
}
@@ -37,7 +37,7 @@ public class {{classname}}: APIBase {
- parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}}
- returns: Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>
*/
- public class func {{operationId}}({{#allParams}}{{^secondaryParam}}{{paramName}} {{/secondaryParam}}{{paramName}}: {{{dataType}}}{{^required}}?{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {
+ public class func {{operationId}}({{#allParams}}{{^secondaryParam}}{{paramName}} {{/secondaryParam}}{{paramName}}: {{{dataType}}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {
let deferred = Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>.pendingPromise()
{{operationId}}({{#allParams}}{{paramName}}: {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { {{#returnType}}data, {{/returnType}}error in
if let error = error {
@@ -69,7 +69,7 @@ public class {{classname}}: APIBase {
- returns: RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{description}}
*/
- public class func {{operationId}}WithRequestBuilder({{#allParams}}{{^secondaryParam}}{{paramName}} {{/secondaryParam}}{{paramName}}: {{{dataType}}}{{^required}}?{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {
+ public class func {{operationId}}WithRequestBuilder({{#allParams}}{{^secondaryParam}}{{paramName}} {{/secondaryParam}}{{paramName}}: {{{dataType}}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {
{{^pathParams}}let{{/pathParams}}{{#pathParams}}{{^secondaryParam}}var{{/secondaryParam}}{{/pathParams}} path = "{{path}}"{{#pathParams}}
path = path.stringByReplacingOccurrencesOfString("{{=<% %>=}}{<%paramName%>}<%={{ }}=%>", withString: "\({{paramName}})", options: .LiteralSearch, range: nil){{/pathParams}}
let URLString = {{projectName}}API.basePath + path
diff --git a/modules/swagger-codegen/src/main/resources/swift/model.mustache b/modules/swagger-codegen/src/main/resources/swift/model.mustache
index 7e2f99a9de8..3c0a47c2987 100644
--- a/modules/swagger-codegen/src/main/resources/swift/model.mustache
+++ b/modules/swagger-codegen/src/main/resources/swift/model.mustache
@@ -11,15 +11,23 @@ import Foundation
/** {{description}} */{{/description}}
public class {{classname}}: JSONEncodable {
-{{#vars}}{{#isEnum}}
+{{#vars}}
+{{#isEnum}}
public enum {{datatypeWithEnum}}: String { {{#allowableValues}}{{#values}}
case {{enum}} = "{{raw}}"{{/values}}{{/allowableValues}}
}
- {{/isEnum}}{{/vars}}
- {{#vars}}{{#isEnum}}{{#description}}/** {{description}} */
- {{/description}}public var {{name}}: {{{datatypeWithEnum}}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{#required}}!{{/required}}{{/unwrapRequired}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{/isEnum}}{{^isEnum}}{{#description}}/** {{description}} */
- {{/description}}public var {{name}}: {{{datatype}}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{#required}}!{{/required}}{{/unwrapRequired}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{/isEnum}}
- {{/vars}}
+{{/isEnum}}
+{{/vars}}
+{{#vars}}
+{{#isEnum}}
+ {{#description}}/** {{description}} */
+ {{/description}}public var {{name}}: {{{datatypeWithEnum}}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{#required}}!{{/required}}{{/unwrapRequired}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}
+{{/isEnum}}
+{{^isEnum}}
+ {{#description}}/** {{description}} */
+ {{/description}}public var {{name}}: {{{datatype}}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{#required}}!{{/required}}{{/unwrapRequired}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}
+{{/isEnum}}
+{{/vars}}
public init() {}
diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/CodegenTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/CodegenTest.java
index 4b422bb3c63..bd0fcc168cd 100644
--- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/CodegenTest.java
+++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/CodegenTest.java
@@ -102,16 +102,18 @@ public class CodegenTest {
public void enumQueryParameterTest() {
final Swagger model = parseAndPrepareSwagger("src/test/resources/2_0/petstore.json");
final DefaultCodegen codegen = new DefaultCodegen();
- final String path = "/store/findByStatus";
+ final String path = "/pet/findByStatus";
final Operation p = model.getPaths().get(path).getGet();
final CodegenOperation op = codegen.fromOperation(path, "get", p, model.getDefinitions());
Assert.assertEquals(op.queryParams.size(), 1);
final CodegenParameter statusParam = op.queryParams.get(0);
- Assert.assertEquals(statusParam.datatypeWithEnum, "StatusEnum");
- Assert.assertTrue(statusParam.isEnum);
- Assert.assertEquals(statusParam._enum.size(), 3);
+ Assert.assertEquals(statusParam.datatypeWithEnum, "List");
+ Assert.assertEquals(statusParam.baseType, "String");
+ // currently there's no way to tell if the inner type of a list is a enum
+ //Assert.assertTrue(statusParam.isEnum);
+ //Assert.assertEquals(statusParam._enum.size(), 3);
}
diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/go/GoClientOptionsTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/go/GoClientOptionsTest.java
new file mode 100644
index 00000000000..528666c58e5
--- /dev/null
+++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/go/GoClientOptionsTest.java
@@ -0,0 +1,35 @@
+package io.swagger.codegen.Go;
+
+import io.swagger.codegen.AbstractOptionsTest;
+import io.swagger.codegen.CodegenConfig;
+import io.swagger.codegen.languages.GoClientCodegen;
+import io.swagger.codegen.options.GoClientOptionsProvider;
+
+import mockit.Expectations;
+import mockit.Tested;
+
+public class GoClientOptionsTest extends AbstractOptionsTest {
+
+ @Tested
+ private GoClientCodegen clientCodegen;
+
+ public GoClientOptionsTest() {
+ super(new GoClientOptionsProvider());
+ }
+
+ @Override
+ protected CodegenConfig getCodegenConfig() {
+ return clientCodegen;
+ }
+
+ @SuppressWarnings("unused")
+ @Override
+ protected void setExpectations() {
+ new Expectations(clientCodegen) {{
+ clientCodegen.setPackageVersion(GoClientOptionsProvider.PACKAGE_VERSION_VALUE);
+ times = 1;
+ clientCodegen.setPackageName(GoClientOptionsProvider.PACKAGE_NAME_VALUE);
+ times = 1;
+ }};
+ }
+}
diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/go/GoModelTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/go/GoModelTest.java
new file mode 100644
index 00000000000..83fa8d6437e
--- /dev/null
+++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/go/GoModelTest.java
@@ -0,0 +1,268 @@
+package io.swagger.codegen.Go;
+
+import io.swagger.codegen.CodegenModel;
+import io.swagger.codegen.CodegenProperty;
+import io.swagger.codegen.DefaultCodegen;
+import io.swagger.codegen.languages.GoClientCodegen;
+import io.swagger.models.ArrayModel;
+import io.swagger.models.Model;
+import io.swagger.models.ModelImpl;
+import io.swagger.models.properties.ArrayProperty;
+import io.swagger.models.properties.DateTimeProperty;
+import io.swagger.models.properties.LongProperty;
+import io.swagger.models.properties.MapProperty;
+import io.swagger.models.properties.RefProperty;
+import io.swagger.models.properties.StringProperty;
+
+import com.google.common.collect.Sets;
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+@SuppressWarnings("static-method")
+public class GoModelTest {
+
+ @Test(description = "convert a simple Go model")
+ public void simpleModelTest() {
+ final Model model = new ModelImpl()
+ .description("a sample model")
+ .property("id", new LongProperty())
+ .property("name", new StringProperty())
+ .property("createdAt", new DateTimeProperty())
+ .required("id")
+ .required("name");
+ final DefaultCodegen codegen = new GoClientCodegen();
+ final CodegenModel cm = codegen.fromModel("sample", model);
+
+ Assert.assertEquals(cm.name, "sample");
+ Assert.assertEquals(cm.classname, "Sample");
+ Assert.assertEquals(cm.description, "a sample model");
+ Assert.assertEquals(cm.vars.size(), 3);
+ Assert.assertEquals(cm.imports.size(), 1);
+
+ final CodegenProperty property1 = cm.vars.get(0);
+ Assert.assertEquals(property1.baseName, "id");
+ Assert.assertEquals(property1.datatype, "int64");
+ Assert.assertEquals(property1.name, "Id");
+ Assert.assertEquals(property1.defaultValue, "null");
+ Assert.assertEquals(property1.baseType, "int64");
+ Assert.assertTrue(property1.hasMore);
+ Assert.assertTrue(property1.required);
+ Assert.assertTrue(property1.isPrimitiveType);
+ Assert.assertTrue(property1.isNotContainer);
+
+ final CodegenProperty property2 = cm.vars.get(1);
+ Assert.assertEquals(property2.baseName, "name");
+ Assert.assertEquals(property2.datatype, "string");
+ Assert.assertEquals(property2.name, "Name");
+ Assert.assertEquals(property2.defaultValue, "null");
+ Assert.assertEquals(property2.baseType, "string");
+ Assert.assertTrue(property2.hasMore);
+ Assert.assertTrue(property2.required);
+ Assert.assertTrue(property2.isPrimitiveType);
+ Assert.assertTrue(property2.isNotContainer);
+
+ final CodegenProperty property3 = cm.vars.get(2);
+ Assert.assertEquals(property3.baseName, "createdAt");
+ Assert.assertEquals(property3.complexType, "time.Time");
+ Assert.assertEquals(property3.datatype, "time.Time");
+ Assert.assertEquals(property3.name, "CreatedAt");
+ Assert.assertEquals(property3.defaultValue, "null");
+ Assert.assertEquals(property3.baseType, "time.Time");
+ Assert.assertNull(property3.hasMore);
+ Assert.assertNull(property3.required);
+ Assert.assertTrue(property3.isNotContainer);
+ }
+
+ @Test(description = "convert a model with list property")
+ public void listPropertyTest() {
+ final Model model = new ModelImpl()
+ .description("a sample model")
+ .property("id", new LongProperty())
+ .property("urls", new ArrayProperty()
+ .items(new StringProperty()))
+ .required("id");
+ final DefaultCodegen codegen = new GoClientCodegen();
+ final CodegenModel cm = codegen.fromModel("sample", model);
+
+ Assert.assertEquals(cm.name, "sample");
+ Assert.assertEquals(cm.classname, "Sample");
+ Assert.assertEquals(cm.description, "a sample model");
+ Assert.assertEquals(cm.vars.size(), 2);
+
+ final CodegenProperty property1 = cm.vars.get(0);
+ Assert.assertEquals(property1.baseName, "id");
+ Assert.assertEquals(property1.datatype, "int64");
+ Assert.assertEquals(property1.name, "Id");
+ Assert.assertEquals(property1.defaultValue, "null");
+ Assert.assertEquals(property1.baseType, "int64");
+ Assert.assertTrue(property1.hasMore);
+ Assert.assertTrue(property1.required);
+ Assert.assertTrue(property1.isPrimitiveType);
+ Assert.assertTrue(property1.isNotContainer);
+
+ final CodegenProperty property2 = cm.vars.get(1);
+ Assert.assertEquals(property2.baseName, "urls");
+ Assert.assertEquals(property2.datatype, "[]string");
+ Assert.assertEquals(property2.name, "Urls");
+ Assert.assertEquals(property2.baseType, "array");
+ Assert.assertNull(property2.hasMore);
+ Assert.assertEquals(property2.containerType, "array");
+ Assert.assertNull(property2.required);
+ Assert.assertTrue(property2.isPrimitiveType);
+ Assert.assertTrue(property2.isContainer);
+ }
+
+ @Test(description = "convert a model with a map property")
+ public void mapPropertyTest() {
+ final Model model = new ModelImpl()
+ .description("a sample model")
+ .property("translations", new MapProperty()
+ .additionalProperties(new StringProperty()))
+ .required("id");
+ final DefaultCodegen codegen = new GoClientCodegen();
+ final CodegenModel cm = codegen.fromModel("sample", model);
+
+ Assert.assertEquals(cm.name, "sample");
+ Assert.assertEquals(cm.classname, "Sample");
+ Assert.assertEquals(cm.description, "a sample model");
+ Assert.assertEquals(cm.vars.size(), 1);
+
+ final CodegenProperty property1 = cm.vars.get(0);
+ Assert.assertEquals(property1.baseName, "translations");
+ Assert.assertEquals(property1.datatype, "map[string]string");
+ Assert.assertEquals(property1.name, "Translations");
+ Assert.assertEquals(property1.baseType, "map");
+ Assert.assertEquals(property1.containerType, "map");
+ Assert.assertNull(property1.required);
+ Assert.assertTrue(property1.isContainer);
+ Assert.assertTrue(property1.isPrimitiveType);
+ }
+
+ @Test(description = "convert a model with complex property")
+ public void complexPropertyTest() {
+ final Model model = new ModelImpl()
+ .description("a sample model")
+ .property("children", new RefProperty("#/definitions/Children"));
+ final DefaultCodegen codegen = new GoClientCodegen();
+ final CodegenModel cm = codegen.fromModel("sample", model);
+
+ Assert.assertEquals(cm.name, "sample");
+ Assert.assertEquals(cm.classname, "Sample");
+ Assert.assertEquals(cm.description, "a sample model");
+ Assert.assertEquals(cm.vars.size(), 1);
+
+ final CodegenProperty property1 = cm.vars.get(0);
+ Assert.assertEquals(property1.baseName, "children");
+ Assert.assertEquals(property1.datatype, "Children");
+ Assert.assertEquals(property1.name, "Children");
+ Assert.assertEquals(property1.baseType, "Children");
+ Assert.assertNull(property1.required);
+ Assert.assertTrue(property1.isNotContainer);
+ }
+
+ @Test(description = "convert a model with complex list property")
+ public void complexListProperty() {
+ final Model model = new ModelImpl()
+ .description("a sample model")
+ .property("children", new ArrayProperty()
+ .items(new RefProperty("#/definitions/Children")));
+ final DefaultCodegen codegen = new GoClientCodegen();
+ final CodegenModel cm = codegen.fromModel("sample", model);
+
+ Assert.assertEquals(cm.name, "sample");
+ Assert.assertEquals(cm.classname, "Sample");
+ Assert.assertEquals(cm.description, "a sample model");
+ Assert.assertEquals(cm.vars.size(), 1);
+
+ final CodegenProperty property1 = cm.vars.get(0);
+ Assert.assertEquals(property1.baseName, "children");
+ Assert.assertEquals(property1.datatype, "[]Children");
+ Assert.assertEquals(property1.name, "Children");
+ Assert.assertEquals(property1.baseType, "array");
+ Assert.assertEquals(property1.containerType, "array");
+ Assert.assertNull(property1.required);
+ Assert.assertTrue(property1.isContainer);
+ }
+
+ @Test(description = "convert a model with complex map property")
+ public void complexMapProperty() {
+ final Model model = new ModelImpl()
+ .description("a sample model")
+ .property("children", new MapProperty()
+ .additionalProperties(new RefProperty("#/definitions/Children")));
+ final DefaultCodegen codegen = new GoClientCodegen();
+ final CodegenModel cm = codegen.fromModel("sample", model);
+
+ Assert.assertEquals(cm.name, "sample");
+ Assert.assertEquals(cm.classname, "Sample");
+ Assert.assertEquals(cm.description, "a sample model");
+ Assert.assertEquals(cm.vars.size(), 1);
+ Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1);
+
+ final CodegenProperty property1 = cm.vars.get(0);
+ Assert.assertEquals(property1.baseName, "children");
+ Assert.assertEquals(property1.complexType, "Children");
+ Assert.assertEquals(property1.datatype, "map[string]Children");
+ Assert.assertEquals(property1.name, "Children");
+ Assert.assertEquals(property1.baseType, "map");
+ Assert.assertEquals(property1.containerType, "map");
+ Assert.assertNull(property1.required);
+ Assert.assertTrue(property1.isContainer);
+ Assert.assertNull(property1.isNotContainer);
+ }
+
+ @Test(description = "convert an array model")
+ public void arrayModelTest() {
+ final Model model = new ArrayModel()
+ .description("an array model")
+ .items(new RefProperty("#/definitions/Children"));
+ final DefaultCodegen codegen = new GoClientCodegen();
+ final CodegenModel cm = codegen.fromModel("sample", model);
+
+ Assert.assertEquals(cm.name, "sample");
+ Assert.assertEquals(cm.classname, "Sample");
+ Assert.assertEquals(cm.description, "an array model");
+ Assert.assertEquals(cm.vars.size(), 0);
+ Assert.assertEquals(cm.imports.size(), 1);
+ }
+
+ @Test(description = "convert an map model")
+ public void mapModelTest() {
+ final Model model = new ModelImpl()
+ .description("a map model")
+ .additionalProperties(new RefProperty("#/definitions/Children"));
+ final DefaultCodegen codegen = new GoClientCodegen();
+ final CodegenModel cm = codegen.fromModel("sample", model);
+
+ Assert.assertEquals(cm.name, "sample");
+ Assert.assertEquals(cm.classname, "Sample");
+ Assert.assertEquals(cm.description, "a map model");
+ Assert.assertEquals(cm.vars.size(), 0);
+ Assert.assertEquals(cm.imports.size(), 1);
+ Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1);
+ }
+
+ @DataProvider(name = "modelNames")
+ public static Object[][] primeNumbers() {
+ return new Object[][] {
+ {"sample", "Sample"},
+ {"sample_name", "SampleName"},
+ {"sample__name", "SampleName"},
+ {"/sample", "Sample"},
+ {"\\sample", "Sample"},
+ {"sample.name", "SampleName"},
+ {"_sample", "Sample"},
+ };
+ }
+
+ @Test(dataProvider = "modelNames", description = "avoid inner class")
+ public void modelNameTest(String name, String expectedName) {
+ final Model model = new ModelImpl();
+ final DefaultCodegen codegen = new GoClientCodegen();
+ final CodegenModel cm = codegen.fromModel(name, model);
+
+ Assert.assertEquals(cm.name, name);
+ Assert.assertEquals(cm.classname, expectedName);
+ }
+}
diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/GoClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/GoClientOptionsProvider.java
new file mode 100644
index 00000000000..304d8acf457
--- /dev/null
+++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/GoClientOptionsProvider.java
@@ -0,0 +1,33 @@
+package io.swagger.codegen.options;
+
+import io.swagger.codegen.CodegenConstants;
+import io.swagger.codegen.languages.GoClientCodegen;
+
+import com.google.common.collect.ImmutableMap;
+
+import java.util.Map;
+
+public class GoClientOptionsProvider implements OptionsProvider {
+
+ public static final String PACKAGE_VERSION_VALUE = "1.0.0";
+ public static final String PACKAGE_NAME_VALUE = "Go";
+
+ @Override
+ public String getLanguage() {
+ return "go";
+ }
+
+ @Override
+ public Map createOptions() {
+ ImmutableMap.Builder builder = new ImmutableMap.Builder();
+ return builder
+ .put(CodegenConstants.PACKAGE_VERSION, PACKAGE_VERSION_VALUE)
+ .put(CodegenConstants.PACKAGE_NAME, PACKAGE_NAME_VALUE)
+ .build();
+ }
+
+ @Override
+ public boolean isServer() {
+ return false;
+ }
+}
diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
new file mode 100644
index 00000000000..bf84cf9c38c
--- /dev/null
+++ b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
@@ -0,0 +1,792 @@
+swagger: '2.0'
+info:
+ description: 'This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose.'
+ version: 1.0.0
+ title: Swagger Petstore
+ termsOfService: 'http://swagger.io/terms/'
+ contact:
+ email: apiteam@swagger.io
+ license:
+ name: Apache 2.0
+ url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
+host: petstore.swagger.io
+basePath: /v2
+tags:
+ - name: pet
+ description: Everything about your Pets
+ externalDocs:
+ description: Find out more
+ url: 'http://swagger.io'
+ - name: store
+ description: Access to Petstore orders
+ - name: user
+ description: Operations about user
+ externalDocs:
+ description: Find out more about our store
+ url: 'http://swagger.io'
+schemes:
+ - http
+paths:
+ /pet:
+ post:
+ tags:
+ - pet
+ summary: Add a new pet to the store
+ description: ''
+ operationId: addPet
+ consumes:
+ - application/json
+ - application/xml
+ produces:
+ - application/xml
+ - application/json
+ parameters:
+ - in: body
+ name: body
+ description: Pet object that needs to be added to the store
+ required: true
+ schema:
+ $ref: '#/definitions/Pet'
+ responses:
+ '405':
+ description: Invalid input
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ put:
+ tags:
+ - pet
+ summary: Update an existing pet
+ description: ''
+ operationId: updatePet
+ consumes:
+ - application/json
+ - application/xml
+ produces:
+ - application/xml
+ - application/json
+ parameters:
+ - in: body
+ name: body
+ description: Pet object that needs to be added to the store
+ required: true
+ schema:
+ $ref: '#/definitions/Pet'
+ responses:
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ '405':
+ description: Validation exception
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ /pet/findByStatus:
+ get:
+ tags:
+ - pet
+ summary: Finds Pets by status
+ description: Multiple status values can be provided with comma separated strings
+ operationId: findPetsByStatus
+ produces:
+ - application/xml
+ - application/json
+ parameters:
+ - name: status
+ in: query
+ description: Status values that need to be considered for filter
+ required: true
+ type: array
+ items:
+ type: string
+ enum:
+ - available
+ - pending
+ - sold
+ default: available
+ collectionFormat: csv
+ responses:
+ '200':
+ description: successful operation
+ schema:
+ type: array
+ items:
+ $ref: '#/definitions/Pet'
+ '400':
+ description: Invalid status value
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ /pet/findByTags:
+ get:
+ tags:
+ - pet
+ summary: Finds Pets by tags
+ description: 'Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.'
+ operationId: findPetsByTags
+ produces:
+ - application/xml
+ - application/json
+ parameters:
+ - name: tags
+ in: query
+ description: Tags to filter by
+ required: true
+ type: array
+ items:
+ type: string
+ collectionFormat: csv
+ responses:
+ '200':
+ description: successful operation
+ schema:
+ type: array
+ items:
+ $ref: '#/definitions/Pet'
+ '400':
+ description: Invalid tag value
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ '/pet/{petId}':
+ get:
+ tags:
+ - pet
+ summary: Find pet by ID
+ description: Returns a single pet
+ operationId: getPetById
+ produces:
+ - application/xml
+ - application/json
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to return
+ required: true
+ type: integer
+ format: int64
+ responses:
+ '200':
+ description: successful operation
+ schema:
+ $ref: '#/definitions/Pet'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Pet not found
+ security:
+ - api_key: []
+ post:
+ tags:
+ - pet
+ summary: Updates a pet in the store with form data
+ description: ''
+ operationId: updatePetWithForm
+ consumes:
+ - application/x-www-form-urlencoded
+ produces:
+ - application/xml
+ - application/json
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet that needs to be updated
+ required: true
+ type: integer
+ format: int64
+ - name: name
+ in: formData
+ description: Updated name of the pet
+ required: false
+ type: string
+ - name: status
+ in: formData
+ description: Updated status of the pet
+ required: false
+ type: string
+ responses:
+ '405':
+ description: Invalid input
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ delete:
+ tags:
+ - pet
+ summary: Deletes a pet
+ description: ''
+ operationId: deletePet
+ produces:
+ - application/xml
+ - application/json
+ parameters:
+ - name: api_key
+ in: header
+ required: false
+ type: string
+ - name: petId
+ in: path
+ description: Pet id to delete
+ required: true
+ type: integer
+ format: int64
+ responses:
+ '400':
+ description: Invalid pet value
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ '/pet/{petId}/uploadImage':
+ post:
+ tags:
+ - pet
+ summary: uploads an image
+ description: ''
+ operationId: uploadFile
+ consumes:
+ - multipart/form-data
+ produces:
+ - application/json
+ parameters:
+ - name: petId
+ in: path
+ description: ID of pet to update
+ required: true
+ type: integer
+ format: int64
+ - name: additionalMetadata
+ in: formData
+ description: Additional data to pass to server
+ required: false
+ type: string
+ - name: file
+ in: formData
+ description: file to upload
+ required: false
+ type: file
+ responses:
+ '200':
+ description: successful operation
+ schema:
+ $ref: '#/definitions/ApiResponse'
+ security:
+ - petstore_auth:
+ - 'write:pets'
+ - 'read:pets'
+ /store/inventory:
+ get:
+ tags:
+ - store
+ summary: Returns pet inventories by status
+ description: Returns a map of status codes to quantities
+ operationId: getInventory
+ produces:
+ - application/json
+ parameters: []
+ responses:
+ '200':
+ description: successful operation
+ schema:
+ type: object
+ additionalProperties:
+ type: integer
+ format: int32
+ security:
+ - api_key: []
+ /store/order:
+ post:
+ tags:
+ - store
+ summary: Place an order for a pet
+ description: ''
+ operationId: placeOrder
+ produces:
+ - application/xml
+ - application/json
+ parameters:
+ - in: body
+ name: body
+ description: order placed for purchasing the pet
+ required: true
+ schema:
+ $ref: '#/definitions/Order'
+ responses:
+ '200':
+ description: successful operation
+ schema:
+ $ref: '#/definitions/Order'
+ '400':
+ description: Invalid Order
+ '/store/order/{orderId}':
+ get:
+ tags:
+ - store
+ summary: Find purchase order by ID
+ description: 'For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions'
+ operationId: getOrderById
+ produces:
+ - application/xml
+ - application/json
+ parameters:
+ - name: orderId
+ in: path
+ description: ID of pet that needs to be fetched
+ required: true
+ type: integer
+ maximum: 5
+ minimum: 1
+ format: int64
+ responses:
+ '200':
+ description: successful operation
+ schema:
+ $ref: '#/definitions/Order'
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Order not found
+ delete:
+ tags:
+ - store
+ summary: Delete purchase order by ID
+ description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+ operationId: deleteOrder
+ produces:
+ - application/xml
+ - application/json
+ parameters:
+ - name: orderId
+ in: path
+ description: ID of the order that needs to be deleted
+ required: true
+ type: string
+ minimum: 1
+ responses:
+ '400':
+ description: Invalid ID supplied
+ '404':
+ description: Order not found
+ /user:
+ post:
+ tags:
+ - user
+ summary: Create user
+ description: This can only be done by the logged in user.
+ operationId: createUser
+ produces:
+ - application/xml
+ - application/json
+ parameters:
+ - in: body
+ name: body
+ description: Created user object
+ required: true
+ schema:
+ $ref: '#/definitions/User'
+ responses:
+ default:
+ description: successful operation
+ /user/createWithArray:
+ post:
+ tags:
+ - user
+ summary: Creates list of users with given input array
+ description: ''
+ operationId: createUsersWithArrayInput
+ produces:
+ - application/xml
+ - application/json
+ parameters:
+ - in: body
+ name: body
+ description: List of user object
+ required: true
+ schema:
+ type: array
+ items:
+ $ref: '#/definitions/User'
+ responses:
+ default:
+ description: successful operation
+ /user/createWithList:
+ post:
+ tags:
+ - user
+ summary: Creates list of users with given input array
+ description: ''
+ operationId: createUsersWithListInput
+ produces:
+ - application/xml
+ - application/json
+ parameters:
+ - in: body
+ name: body
+ description: List of user object
+ required: true
+ schema:
+ type: array
+ items:
+ $ref: '#/definitions/User'
+ responses:
+ default:
+ description: successful operation
+ /user/login:
+ get:
+ tags:
+ - user
+ summary: Logs user into the system
+ description: ''
+ operationId: loginUser
+ produces:
+ - application/xml
+ - application/json
+ parameters:
+ - name: username
+ in: query
+ description: The user name for login
+ required: true
+ type: string
+ - name: password
+ in: query
+ description: The password for login in clear text
+ required: true
+ type: string
+ responses:
+ '200':
+ description: successful operation
+ schema:
+ type: string
+ headers:
+ X-Rate-Limit:
+ type: integer
+ format: int32
+ description: calls per hour allowed by the user
+ X-Expires-After:
+ type: string
+ format: date-time
+ description: date in UTC when toekn expires
+ '400':
+ description: Invalid username/password supplied
+ /user/logout:
+ get:
+ tags:
+ - user
+ summary: Logs out current logged in user session
+ description: ''
+ operationId: logoutUser
+ produces:
+ - application/xml
+ - application/json
+ parameters: []
+ responses:
+ default:
+ description: successful operation
+ '/user/{username}':
+ get:
+ tags:
+ - user
+ summary: Get user by user name
+ description: ''
+ operationId: getUserByName
+ produces:
+ - application/xml
+ - application/json
+ parameters:
+ - name: username
+ in: path
+ description: 'The name that needs to be fetched. Use user1 for testing. '
+ required: true
+ type: string
+ responses:
+ '200':
+ description: successful operation
+ schema:
+ $ref: '#/definitions/User'
+ '400':
+ description: Invalid username supplied
+ '404':
+ description: User not found
+ put:
+ tags:
+ - user
+ summary: Updated user
+ description: This can only be done by the logged in user.
+ operationId: updateUser
+ produces:
+ - application/xml
+ - application/json
+ parameters:
+ - name: username
+ in: path
+ description: name that need to be deleted
+ required: true
+ type: string
+ - in: body
+ name: body
+ description: Updated user object
+ required: true
+ schema:
+ $ref: '#/definitions/User'
+ responses:
+ '400':
+ description: Invalid user supplied
+ '404':
+ description: User not found
+ delete:
+ tags:
+ - user
+ summary: Delete user
+ description: This can only be done by the logged in user.
+ operationId: deleteUser
+ produces:
+ - application/xml
+ - application/json
+ parameters:
+ - name: username
+ in: path
+ description: The name that needs to be deleted
+ required: true
+ type: string
+ responses:
+ '400':
+ description: Invalid username supplied
+ '404':
+ description: User not found
+securityDefinitions:
+ petstore_auth:
+ type: oauth2
+ authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog'
+ flow: implicit
+ scopes:
+ 'write:pets': modify pets in your account
+ 'read:pets': read your pets
+ api_key:
+ type: apiKey
+ name: api_key
+ in: header
+definitions:
+ Order:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ petId:
+ type: integer
+ format: int64
+ quantity:
+ type: integer
+ format: int32
+ shipDate:
+ type: string
+ format: date-time
+ status:
+ type: string
+ description: Order Status
+ enum:
+ - placed
+ - approved
+ - delivered
+ complete:
+ type: boolean
+ default: false
+ xml:
+ name: Order
+ Category:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ xml:
+ name: Category
+ User:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ username:
+ type: string
+ firstName:
+ type: string
+ lastName:
+ type: string
+ email:
+ type: string
+ password:
+ type: string
+ phone:
+ type: string
+ userStatus:
+ type: integer
+ format: int32
+ description: User Status
+ xml:
+ name: User
+ Tag:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ xml:
+ name: Tag
+ Pet:
+ type: object
+ required:
+ - name
+ - photoUrls
+ properties:
+ id:
+ type: integer
+ format: int64
+ category:
+ $ref: '#/definitions/Category'
+ name:
+ type: string
+ example: doggie
+ photoUrls:
+ type: array
+ xml:
+ name: photoUrl
+ wrapped: true
+ items:
+ type: string
+ tags:
+ type: array
+ xml:
+ name: tag
+ wrapped: true
+ items:
+ $ref: '#/definitions/Tag'
+ status:
+ type: string
+ description: pet status in the store
+ enum:
+ - available
+ - pending
+ - sold
+ xml:
+ name: Pet
+ ApiResponse:
+ type: object
+ properties:
+ code:
+ type: integer
+ format: int32
+ type:
+ type: string
+ message:
+ type: string
+ '$special[model.name]':
+ properties:
+ '$special[property.name]':
+ type: integer
+ format: int64
+ xml:
+ name: '$special[model.name]'
+ Return:
+ description: Model for testing reserved words
+ properties:
+ return:
+ type: integer
+ format: int32
+ xml:
+ name: Return
+ Name:
+ description: Model for testing model name same as property name
+ required:
+ - name
+ properties:
+ name:
+ type: integer
+ format: int32
+ snake_case:
+ readOnly: true
+ type: integer
+ format: int32
+ xml:
+ name: Name
+ 200_response:
+ description: Model for testing model name starting with number
+ properties:
+ name:
+ type: integer
+ format: int32
+ xml:
+ name: Name
+ Dog:
+ allOf:
+ - $ref: '#/definitions/Animal'
+ - type: object
+ properties:
+ breed:
+ type: string
+ Cat:
+ allOf:
+ - $ref: '#/definitions/Animal'
+ - type: object
+ properties:
+ declawed:
+ type: boolean
+ Animal:
+ type: object
+ discriminator: className
+ required:
+ - className
+ properties:
+ className:
+ type: string
+ format_test:
+ type: object
+ required:
+ - number
+ properties:
+ integer:
+ type: integer
+ int32:
+ type: integer
+ format: int32
+ int64:
+ type: integer
+ format: int64
+ number:
+ type: number
+ float:
+ type: number
+ format: float
+ double:
+ type: number
+ format: double
+ string:
+ type: string
+ byte:
+ type: string
+ format: byte
+ binary:
+ type: string
+ format: binary
+ date:
+ type: string
+ format: date
+ dateTime:
+ type: string
+ format: date-time
+ password:
+ type: string
+ format: password
+externalDocs:
+ description: Find out more about Swagger
+ url: 'http://swagger.io'
diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore.json b/modules/swagger-codegen/src/test/resources/2_0/petstore.json
index 64b56377393..838b3c8b2da 100644
--- a/modules/swagger-codegen/src/test/resources/2_0/petstore.json
+++ b/modules/swagger-codegen/src/test/resources/2_0/petstore.json
@@ -4,9 +4,9 @@
"description": "This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters",
"version": "1.0.0",
"title": "Swagger Petstore",
- "termsOfService": "http://swagger.io/terms/",
+ "termsOfService": "http://helloreverb.com/terms/",
"contact": {
- "email": "apiteam@swagger.io"
+ "email": "apiteam@wordnik.com"
},
"license": {
"name": "Apache 2.0",
@@ -19,49 +19,6 @@
"http"
],
"paths": {
- "/pet?testing_byte_array=true": {
- "post": {
- "tags": [
- "pet"
- ],
- "summary": "Fake endpoint to test byte array in body parameter for adding a new pet to the store",
- "description": "",
- "operationId": "addPetUsingByteArray",
- "consumes": [
- "application/json",
- "application/xml"
- ],
- "produces": [
- "application/json",
- "application/xml"
- ],
- "parameters": [
- {
- "in": "body",
- "name": "body",
- "description": "Pet object in the form of byte array",
- "required": false,
- "schema": {
- "type": "string",
- "format": "binary"
- }
- }
- ],
- "responses": {
- "405": {
- "description": "Invalid input"
- }
- },
- "security": [
- {
- "petstore_auth": [
- "write:pets",
- "read:pets"
- ]
- }
- ]
- }
- },
"/pet": {
"post": {
"tags": [
@@ -156,7 +113,7 @@
"pet"
],
"summary": "Finds Pets by status",
- "description": "Multiple status values can be provided with comma separated strings",
+ "description": "Multiple status values can be provided with comma seperated strings",
"operationId": "findPetsByStatus",
"produces": [
"application/json",
@@ -166,23 +123,14 @@
{
"name": "status",
"in": "query",
- "description": "Status values that need to be considered for query",
+ "description": "Status values that need to be considered for filter",
"required": false,
"type": "array",
"items": {
"type": "string",
- "enum": [
- "available",
- "pending",
- "sold"
- ]
+ "enum": ["available", "pending", "sold"]
},
"collectionFormat": "multi",
- "enum": [
- "available",
- "pending",
- "sold"
- ],
"default": "available"
}
],
@@ -194,6 +142,15 @@
"items": {
"$ref": "#/definitions/Pet"
}
+ },
+ "examples": {
+ "application/json": {
+ "name": "Puma",
+ "type": "Dog",
+ "color": "Black",
+ "gender": "Female",
+ "breed": "Mixed"
+ }
}
},
"400": {
@@ -259,150 +216,6 @@
]
}
},
- "/pet/{petId}?testing_byte_array=true": {
- "get": {
- "tags": [
- "pet"
- ],
- "summary": "Fake endpoint to test byte array return by 'Find pet by ID'",
- "description": "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions",
- "operationId": "",
- "produces": [
- "application/json",
- "application/xml"
- ],
- "parameters": [
- {
- "name": "petId",
- "in": "path",
- "description": "ID of pet that needs to be fetched",
- "required": true,
- "type": "integer",
- "format": "int64"
- }
- ],
- "responses": {
- "404": {
- "description": "Pet not found"
- },
- "200": {
- "description": "successful operation",
- "schema": {
- "type": "string",
- "format": "binary"
- }
- },
- "400": {
- "description": "Invalid ID supplied"
- }
- },
- "security": [
- {
- "api_key": []
- },
- {
- "petstore_auth": [
- "write:pets",
- "read:pets"
- ]
- }
- ]
- }
- },
- "/pet/{petId}?response=inline_arbitrary_object": {
- "get": {
- "tags": [
- "pet"
- ],
- "summary": "Fake endpoint to test inline arbitrary object return by 'Find pet by ID'",
- "description": "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions",
- "operationId": "getPetByIdInObject",
- "produces": [
- "application/json",
- "application/xml"
- ],
- "parameters": [
- {
- "name": "petId",
- "in": "path",
- "description": "ID of pet that needs to be fetched",
- "required": true,
- "type": "integer",
- "format": "int64"
- }
- ],
- "responses": {
- "404": {
- "description": "Pet not found"
- },
- "200": {
- "description": "successful operation",
- "schema": {
- "type": "object",
- "required": [
- "id"
- ],
- "properties": {
- "id": {
- "type": "integer",
- "format": "int64"
- },
- "category": {
- "type": "object"
- },
- "name": {
- "type": "string",
- "example": "doggie"
- },
- "photoUrls": {
- "type": "array",
- "xml": {
- "name": "photoUrl",
- "wrapped": true
- },
- "items": {
- "type": "string"
- }
- },
- "tags": {
- "type": "array",
- "xml": {
- "name": "tag",
- "wrapped": true
- },
- "items": {
- "$ref": "#/definitions/Tag"
- }
- },
- "status": {
- "type": "string",
- "description": "pet status in the store",
- "enum": [
- "available",
- "pending",
- "sold"
- ]
- }
- }
- }
- },
- "400": {
- "description": "Invalid ID supplied"
- }
- },
- "security": [
- {
- "api_key": []
- },
- {
- "petstore_auth": [
- "write:pets",
- "read:pets"
- ]
- }
- ]
- }
- },
"/pet/{petId}": {
"get": {
"tags": [
@@ -630,33 +443,6 @@
]
}
},
- "/store/inventory?response=arbitrary_object": {
- "get": {
- "tags": [
- "store"
- ],
- "summary": "Fake endpoint to test arbitrary object return by 'Get inventory'",
- "description": "Returns an arbitrary object which is actually a map of status codes to quantities",
- "operationId": "getInventoryInObject",
- "produces": [
- "application/json",
- "application/xml"
- ],
- "responses": {
- "200": {
- "description": "successful operation",
- "schema": {
- "type": "object"
- }
- }
- },
- "security": [
- {
- "api_key": []
- }
- ]
- }
- },
"/store/order": {
"post": {
"tags": [
@@ -690,62 +476,7 @@
"400": {
"description": "Invalid Order"
}
- },
- "security": [
- {
- "test_api_client_id": [],
- "test_api_client_secret": []
- }
- ]
- }
- },
- "/store/findByStatus": {
- "get": {
- "tags": [
- "store"
- ],
- "summary": "Finds orders by status",
- "description": "A single status value can be provided as a string",
- "operationId": "findOrdersByStatus",
- "produces": [
- "application/json",
- "application/xml"
- ],
- "parameters": [
- {
- "name": "status",
- "in": "query",
- "description": "Status value that needs to be considered for query",
- "required": false,
- "type": "string",
- "enum": [
- "placed",
- "approved",
- "delivered"
- ],
- "default": "placed"
- }
- ],
- "responses": {
- "200": {
- "description": "successful operation",
- "schema": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/Order"
- }
- }
- },
- "400": {
- "description": "Invalid status value"
- }
- },
- "security": [
- {
- "test_api_client_id": [],
- "test_api_client_secret": []
- }
- ]
+ }
}
},
"/store/order/{orderId}": {
@@ -782,15 +513,7 @@
"400": {
"description": "Invalid ID supplied"
}
- },
- "security": [
- {
- "test_api_key_header": []
- },
- {
- "test_api_key_query": []
- }
- ]
+ }
},
"delete": {
"tags": [
@@ -1007,18 +730,6 @@
"description": "successful operation",
"schema": {
"$ref": "#/definitions/User"
- },
- "examples": {
- "application/json": {
- "id": 1,
- "username": "johnp",
- "firstName": "John",
- "lastName": "Public",
- "email": "johnp@swagger.io",
- "password": "-secret-",
- "phone": "0123456789",
- "userStatus": 0
- }
}
},
"400": {
@@ -1091,12 +802,7 @@
"400": {
"description": "Invalid username supplied"
}
- },
- "security": [
- {
- "test_http_basic": []
- }
- ]
+ }
}
}
},
@@ -1114,29 +820,6 @@
"write:pets": "modify pets in your account",
"read:pets": "read your pets"
}
- },
- "test_api_client_id": {
- "type": "apiKey",
- "name": "x-test_api_client_id",
- "in": "header"
- },
- "test_api_client_secret": {
- "type": "apiKey",
- "name": "x-test_api_client_secret",
- "in": "header"
- },
- "test_api_key_header": {
- "type": "apiKey",
- "name": "test_api_key_header",
- "in": "header"
- },
- "test_api_key_query": {
- "type": "apiKey",
- "name": "test_api_key_query",
- "in": "query"
- },
- "test_http_basic": {
- "type": "basic"
}
},
"definitions": {
@@ -1257,8 +940,7 @@
"properties": {
"id": {
"type": "integer",
- "format": "int64",
- "readOnly": true
+ "format": "int64"
},
"petId": {
"type": "integer",
@@ -1288,150 +970,6 @@
"xml": {
"name": "Order"
}
- },
- "$special[model.name]": {
- "properties": {
- "$special[property.name]": {
- "type": "integer",
- "format": "int64"
- }
- },
- "xml": {
- "name": "$special[model.name]"
- }
- },
- "Return": {
- "description": "Model for testing reserved words",
- "properties": {
- "return": {
- "type": "integer",
- "format": "int32"
- }
- },
- "xml": {
- "name": "Return"
- }
- },
- "Name": {
- "description": "Model for testing model name same as property name",
- "required": [
- "name"
- ],
- "properties": {
- "name": {
- "type": "integer",
- "format": "int32"
- },
- "snake_case": {
- "readOnly": true,
- "type": "integer",
- "format": "int32"
- }
- },
- "xml": {
- "name": "Name"
- }
- },
- "200_response": {
- "description": "Model for testing model name starting with number",
- "properties": {
- "name": {
- "type": "integer",
- "format": "int32"
- }
- },
- "xml": {
- "name": "Name"
- }
- },
- "Dog" : {
- "allOf" : [ {
- "$ref" : "#/definitions/Animal"
- }, {
- "type" : "object",
- "properties" : {
- "breed" : {
- "type" : "string"
- }
- }
- } ]
- },
- "Cat" : {
- "allOf" : [ {
- "$ref" : "#/definitions/Animal"
- }, {
- "type" : "object",
- "properties" : {
- "declawed" : {
- "type" : "boolean"
- }
- }
- } ]
- },
- "Animal" : {
- "type" : "object",
- "discriminator": "className",
- "required": [
- "className"
- ],
- "properties" : {
- "className" : {
- "type" : "string"
- }
- }
- },
- "format_test" : {
- "type" : "object",
- "required": [
- "number"
- ],
- "properties" : {
- "integer" : {
- "type": "integer"
- },
- "int32" : {
- "type": "integer",
- "format": "int32"
- },
- "int64" : {
- "type": "integer",
- "format": "int64"
- },
- "number" : {
- "type": "number"
- },
- "float" : {
- "type": "number",
- "format": "float"
- },
- "double" : {
- "type": "number",
- "format": "double"
- },
- "string" : {
- "type": "string"
- },
- "byte" : {
- "type": "string",
- "format": "byte"
- },
- "binary" : {
- "type": "string",
- "format": "binary"
- },
- "date" : {
- "type": "string",
- "format": "date"
- },
- "dateTime" : {
- "type": "string",
- "format": "date-time"
- },
- "dateTime" : {
- "type": "string",
- "format": "password"
- }
- }
}
}
}
diff --git a/samples/client/petstore/akka-scala/pom.xml b/samples/client/petstore/akka-scala/pom.xml
index fa88207507e..b625621f58c 100644
--- a/samples/client/petstore/akka-scala/pom.xml
+++ b/samples/client/petstore/akka-scala/pom.xml
@@ -217,7 +217,7 @@
2.3.9
1.2
2.2
- 1.5.7
+ 1.5.8
1.0.0
4.8.1
diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/EnumsSerializers.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/EnumsSerializers.scala
index c8c0d2454e4..6703ffa4837 100644
--- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/EnumsSerializers.scala
+++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/EnumsSerializers.scala
@@ -1,3 +1,8 @@
+/**
+ * NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen
+ * For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
+ */
package io.swagger.client.api
import io.swagger.client.model._
@@ -7,8 +12,8 @@ import scala.reflect.ClassTag
object EnumsSerializers {
def all = Seq[Serializer[_]]() :+
- new EnumNameSerializer(PetEnums.Status) :+
- new EnumNameSerializer(OrderEnums.Status)
+ new EnumNameSerializer(OrderEnums.Status) :+
+ new EnumNameSerializer(PetEnums.Status)
@@ -40,4 +45,4 @@ object EnumsSerializers {
}
}
-}
\ No newline at end of file
+}
diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/PetApi.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/PetApi.scala
index 7decd51b03c..b59e7f912b4 100644
--- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/PetApi.scala
+++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/PetApi.scala
@@ -1,6 +1,12 @@
+/**
+ * NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen
+ * For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
+ */
package io.swagger.client.api
import io.swagger.client.model.Pet
+import io.swagger.client.model.ApiResponse
import java.io.File
import io.swagger.client.core._
import io.swagger.client.core.CollectionFormats._
@@ -8,22 +14,6 @@ import io.swagger.client.core.ApiKeyLocations._
object PetApi {
- /**
- *
- * Expected answers:
- * code 400 : (Invalid ID supplied)
- * code 404 : (Pet not found)
- * code 405 : (Validation exception)
- *
- * @param body Pet object that needs to be added to the store
- */
- def updatePet(body: Option[Pet] = None): ApiRequest[Unit] =
- ApiRequest[Unit](ApiMethods.PUT, "http://petstore.swagger.io/v2", "/pet", "application/json")
- .withBody(body)
- .withErrorResponse[Unit](400)
- .withErrorResponse[Unit](404)
- .withErrorResponse[Unit](405)
-
/**
*
* Expected answers:
@@ -31,79 +21,11 @@ object PetApi {
*
* @param body Pet object that needs to be added to the store
*/
- def addPet(body: Option[Pet] = None): ApiRequest[Unit] =
+ def addPet(body: Pet): ApiRequest[Unit] =
ApiRequest[Unit](ApiMethods.POST, "http://petstore.swagger.io/v2", "/pet", "application/json")
.withBody(body)
.withErrorResponse[Unit](405)
-
- /**
- * Multiple status values can be provided with comma seperated strings
- *
- * Expected answers:
- * code 200 : Seq[Pet] (successful operation)
- * code 400 : (Invalid status value)
- *
- * @param status Status values that need to be considered for filter
- */
- def findPetsByStatus(status: Seq[String]): ApiRequest[Seq[Pet]] =
- ApiRequest[Seq[Pet]](ApiMethods.GET, "http://petstore.swagger.io/v2", "/pet/findByStatus", "application/json")
- .withQueryParam("status", ArrayValues(status, MULTI))
- .withSuccessResponse[Seq[Pet]](200)
- .withErrorResponse[Unit](400)
-
- /**
- * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
- *
- * Expected answers:
- * code 200 : Seq[Pet] (successful operation)
- * code 400 : (Invalid tag value)
- *
- * @param tags Tags to filter by
- */
- def findPetsByTags(tags: Seq[String]): ApiRequest[Seq[Pet]] =
- ApiRequest[Seq[Pet]](ApiMethods.GET, "http://petstore.swagger.io/v2", "/pet/findByTags", "application/json")
- .withQueryParam("tags", ArrayValues(tags, MULTI))
- .withSuccessResponse[Seq[Pet]](200)
- .withErrorResponse[Unit](400)
-
- /**
- * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
- *
- * Expected answers:
- * code 200 : Pet (successful operation)
- * code 400 : (Invalid ID supplied)
- * code 404 : (Pet not found)
- *
- * Available security schemes:
- * api_key (apiKey)
- *
- * @param petId ID of pet that needs to be fetched
- */
- def getPetById(petId: Long)(implicit apiKey: ApiKeyValue): ApiRequest[Pet] =
- ApiRequest[Pet](ApiMethods.GET, "http://petstore.swagger.io/v2", "/pet/{petId}", "application/json")
- .withApiKey(apiKey, "api_key", HEADER)
- .withPathParam("petId", petId)
- .withSuccessResponse[Pet](200)
- .withErrorResponse[Unit](400)
- .withErrorResponse[Unit](404)
-
- /**
- *
- * Expected answers:
- * code 405 : (Invalid input)
- *
- * @param petId ID of pet that needs to be updated
- * @param name Updated name of the pet
- * @param status Updated status of the pet
- */
- def updatePetWithForm(petId: String, name: Option[String] = None, status: Option[String] = None): ApiRequest[Unit] =
- ApiRequest[Unit](ApiMethods.POST, "http://petstore.swagger.io/v2", "/pet/{petId}", "application/x-www-form-urlencoded")
- .withFormParam("name", name)
- .withFormParam("status", status)
- .withPathParam("petId", petId)
- .withErrorResponse[Unit](405)
-
- /**
+ /**
*
* Expected answers:
* code 400 : (Invalid pet value)
@@ -116,24 +38,100 @@ object PetApi {
.withPathParam("petId", petId)
.withHeaderParam("api_key", apiKey)
.withErrorResponse[Unit](400)
-
- /**
+ /**
+ * Multiple status values can be provided with comma separated strings
*
* Expected answers:
- * code 0 : (successful operation)
+ * code 200 : Seq[Pet] (successful operation)
+ * code 400 : (Invalid status value)
+ *
+ * @param status Status values that need to be considered for filter
+ */
+ def findPetsByStatus(status: Seq[String]): ApiRequest[Seq[Pet]] =
+ ApiRequest[Seq[Pet]](ApiMethods.GET, "http://petstore.swagger.io/v2", "/pet/findByStatus", "application/json")
+ .withQueryParam("status", ArrayValues(status, CSV))
+ .withSuccessResponse[Seq[Pet]](200)
+ .withErrorResponse[Unit](400)
+ /**
+ * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+ *
+ * Expected answers:
+ * code 200 : Seq[Pet] (successful operation)
+ * code 400 : (Invalid tag value)
+ *
+ * @param tags Tags to filter by
+ */
+ def findPetsByTags(tags: Seq[String]): ApiRequest[Seq[Pet]] =
+ ApiRequest[Seq[Pet]](ApiMethods.GET, "http://petstore.swagger.io/v2", "/pet/findByTags", "application/json")
+ .withQueryParam("tags", ArrayValues(tags, CSV))
+ .withSuccessResponse[Seq[Pet]](200)
+ .withErrorResponse[Unit](400)
+ /**
+ * Returns a single pet
+ *
+ * Expected answers:
+ * code 200 : Pet (successful operation)
+ * code 400 : (Invalid ID supplied)
+ * code 404 : (Pet not found)
+ *
+ * Available security schemes:
+ * api_key (apiKey)
+ *
+ * @param petId ID of pet to return
+ */
+ def getPetById(petId: Long)(implicit apiKey: ApiKeyValue): ApiRequest[Pet] =
+ ApiRequest[Pet](ApiMethods.GET, "http://petstore.swagger.io/v2", "/pet/{petId}", "application/json")
+ .withApiKey(apiKey, "api_key", HEADER)
+ .withPathParam("petId", petId)
+ .withSuccessResponse[Pet](200)
+ .withErrorResponse[Unit](400)
+ .withErrorResponse[Unit](404)
+ /**
+ *
+ * Expected answers:
+ * code 400 : (Invalid ID supplied)
+ * code 404 : (Pet not found)
+ * code 405 : (Validation exception)
+ *
+ * @param body Pet object that needs to be added to the store
+ */
+ def updatePet(body: Pet): ApiRequest[Unit] =
+ ApiRequest[Unit](ApiMethods.PUT, "http://petstore.swagger.io/v2", "/pet", "application/json")
+ .withBody(body)
+ .withErrorResponse[Unit](400)
+ .withErrorResponse[Unit](404)
+ .withErrorResponse[Unit](405)
+ /**
+ *
+ * Expected answers:
+ * code 405 : (Invalid input)
+ *
+ * @param petId ID of pet that needs to be updated
+ * @param name Updated name of the pet
+ * @param status Updated status of the pet
+ */
+ def updatePetWithForm(petId: Long, name: Option[String] = None, status: Option[String] = None): ApiRequest[Unit] =
+ ApiRequest[Unit](ApiMethods.POST, "http://petstore.swagger.io/v2", "/pet/{petId}", "application/x-www-form-urlencoded")
+ .withFormParam("name", name)
+ .withFormParam("status", status)
+ .withPathParam("petId", petId)
+ .withErrorResponse[Unit](405)
+ /**
+ *
+ * Expected answers:
+ * code 200 : ApiResponse (successful operation)
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
*/
- def uploadFile(petId: Long, additionalMetadata: Option[String] = None, file: Option[File] = None): ApiRequest[Unit] =
- ApiRequest[Unit](ApiMethods.POST, "http://petstore.swagger.io/v2", "/pet/{petId}/uploadImage", "multipart/form-data")
+ def uploadFile(petId: Long, additionalMetadata: Option[String] = None, file: Option[File] = None): ApiRequest[ApiResponse] =
+ ApiRequest[ApiResponse](ApiMethods.POST, "http://petstore.swagger.io/v2", "/pet/{petId}/uploadImage", "multipart/form-data")
.withFormParam("additionalMetadata", additionalMetadata)
.withFormParam("file", file)
.withPathParam("petId", petId)
- .withDefaultSuccessResponse[Unit]
+ .withSuccessResponse[ApiResponse](200)
-
}
diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/StoreApi.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/StoreApi.scala
index f3ab28da05f..3ecb7ad9dae 100644
--- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/StoreApi.scala
+++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/StoreApi.scala
@@ -1,3 +1,8 @@
+/**
+ * NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen
+ * For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
+ */
package io.swagger.client.api
import io.swagger.client.model.Order
@@ -7,51 +12,6 @@ import io.swagger.client.core.ApiKeyLocations._
object StoreApi {
- /**
- * Returns a map of status codes to quantities
- *
- * Expected answers:
- * code 200 : Map[String, Int] (successful operation)
- *
- * Available security schemes:
- * api_key (apiKey)
- */
- def getInventory()(implicit apiKey: ApiKeyValue): ApiRequest[Map[String, Int]] =
- ApiRequest[Map[String, Int]](ApiMethods.GET, "http://petstore.swagger.io/v2", "/store/inventory", "application/json")
- .withApiKey(apiKey, "api_key", HEADER)
- .withSuccessResponse[Map[String, Int]](200)
-
- /**
- *
- * Expected answers:
- * code 200 : Order (successful operation)
- * code 400 : (Invalid Order)
- *
- * @param body order placed for purchasing the pet
- */
- def placeOrder(body: Option[Order] = None): ApiRequest[Order] =
- ApiRequest[Order](ApiMethods.POST, "http://petstore.swagger.io/v2", "/store/order", "application/json")
- .withBody(body)
- .withSuccessResponse[Order](200)
- .withErrorResponse[Unit](400)
-
- /**
- * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
- *
- * Expected answers:
- * code 200 : Order (successful operation)
- * code 400 : (Invalid ID supplied)
- * code 404 : (Order not found)
- *
- * @param orderId ID of pet that needs to be fetched
- */
- def getOrderById(orderId: String): ApiRequest[Order] =
- ApiRequest[Order](ApiMethods.GET, "http://petstore.swagger.io/v2", "/store/order/{orderId}", "application/json")
- .withPathParam("orderId", orderId)
- .withSuccessResponse[Order](200)
- .withErrorResponse[Unit](400)
- .withErrorResponse[Unit](404)
-
/**
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
*
@@ -66,8 +26,49 @@ object StoreApi {
.withPathParam("orderId", orderId)
.withErrorResponse[Unit](400)
.withErrorResponse[Unit](404)
+ /**
+ * Returns a map of status codes to quantities
+ *
+ * Expected answers:
+ * code 200 : Map[String, Int] (successful operation)
+ *
+ * Available security schemes:
+ * api_key (apiKey)
+ */
+ def getInventory()(implicit apiKey: ApiKeyValue): ApiRequest[Map[String, Int]] =
+ ApiRequest[Map[String, Int]](ApiMethods.GET, "http://petstore.swagger.io/v2", "/store/inventory", "application/json")
+ .withApiKey(apiKey, "api_key", HEADER)
+ .withSuccessResponse[Map[String, Int]](200)
+ /**
+ * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
+ *
+ * Expected answers:
+ * code 200 : Order (successful operation)
+ * code 400 : (Invalid ID supplied)
+ * code 404 : (Order not found)
+ *
+ * @param orderId ID of pet that needs to be fetched
+ */
+ def getOrderById(orderId: Long): ApiRequest[Order] =
+ ApiRequest[Order](ApiMethods.GET, "http://petstore.swagger.io/v2", "/store/order/{orderId}", "application/json")
+ .withPathParam("orderId", orderId)
+ .withSuccessResponse[Order](200)
+ .withErrorResponse[Unit](400)
+ .withErrorResponse[Unit](404)
+ /**
+ *
+ * Expected answers:
+ * code 200 : Order (successful operation)
+ * code 400 : (Invalid Order)
+ *
+ * @param body order placed for purchasing the pet
+ */
+ def placeOrder(body: Order): ApiRequest[Order] =
+ ApiRequest[Order](ApiMethods.POST, "http://petstore.swagger.io/v2", "/store/order", "application/json")
+ .withBody(body)
+ .withSuccessResponse[Order](200)
+ .withErrorResponse[Unit](400)
-
}
diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/UserApi.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/UserApi.scala
index b759a799e3d..642c76b8d8c 100644
--- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/UserApi.scala
+++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/api/UserApi.scala
@@ -1,3 +1,8 @@
+/**
+ * NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen
+ * For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
+ */
package io.swagger.client.api
import io.swagger.client.model.User
@@ -15,12 +20,11 @@ object UserApi {
*
* @param body Created user object
*/
- def createUser(body: Option[User] = None): ApiRequest[Unit] =
+ def createUser(body: User): ApiRequest[Unit] =
ApiRequest[Unit](ApiMethods.POST, "http://petstore.swagger.io/v2", "/user", "application/json")
.withBody(body)
.withDefaultSuccessResponse[Unit]
-
- /**
+ /**
*
* Expected answers:
* code 0 : (successful operation)
@@ -31,8 +35,7 @@ object UserApi {
ApiRequest[Unit](ApiMethods.POST, "http://petstore.swagger.io/v2", "/user/createWithArray", "application/json")
.withBody(body)
.withDefaultSuccessResponse[Unit]
-
- /**
+ /**
*
* Expected answers:
* code 0 : (successful operation)
@@ -43,66 +46,7 @@ object UserApi {
ApiRequest[Unit](ApiMethods.POST, "http://petstore.swagger.io/v2", "/user/createWithList", "application/json")
.withBody(body)
.withDefaultSuccessResponse[Unit]
-
- /**
- *
- * Expected answers:
- * code 200 : String (successful operation)
- * code 400 : (Invalid username/password supplied)
- *
- * @param username The user name for login
- * @param password The password for login in clear text
- */
- def loginUser(username: Option[String] = None, password: Option[String] = None): ApiRequest[String] =
- ApiRequest[String](ApiMethods.GET, "http://petstore.swagger.io/v2", "/user/login", "application/json")
- .withQueryParam("username", username)
- .withQueryParam("password", password)
- .withSuccessResponse[String](200)
- .withErrorResponse[Unit](400)
-
- /**
- *
- * Expected answers:
- * code 0 : (successful operation)
- */
- def logoutUser(): ApiRequest[Unit] =
- ApiRequest[Unit](ApiMethods.GET, "http://petstore.swagger.io/v2", "/user/logout", "application/json")
- .withDefaultSuccessResponse[Unit]
-
- /**
- *
- * Expected answers:
- * code 200 : User (successful operation)
- * code 400 : (Invalid username supplied)
- * code 404 : (User not found)
- *
- * @param username The name that needs to be fetched. Use user1 for testing.
- */
- def getUserByName(username: String): ApiRequest[User] =
- ApiRequest[User](ApiMethods.GET, "http://petstore.swagger.io/v2", "/user/{username}", "application/json")
- .withPathParam("username", username)
- .withSuccessResponse[User](200)
- .withErrorResponse[Unit](400)
- .withErrorResponse[Unit](404)
-
- /**
- * This can only be done by the logged in user.
- *
- * Expected answers:
- * code 400 : (Invalid user supplied)
- * code 404 : (User not found)
- *
- * @param username name that need to be deleted
- * @param body Updated user object
- */
- def updateUser(username: String, body: Option[User] = None): ApiRequest[Unit] =
- ApiRequest[Unit](ApiMethods.PUT, "http://petstore.swagger.io/v2", "/user/{username}", "application/json")
- .withBody(body)
- .withPathParam("username", username)
- .withErrorResponse[Unit](400)
- .withErrorResponse[Unit](404)
-
- /**
+ /**
* This can only be done by the logged in user.
*
* Expected answers:
@@ -116,8 +60,69 @@ object UserApi {
.withPathParam("username", username)
.withErrorResponse[Unit](400)
.withErrorResponse[Unit](404)
+ /**
+ *
+ * Expected answers:
+ * code 200 : User (successful operation)
+ * code 400 : (Invalid username supplied)
+ * code 404 : (User not found)
+ *
+ * @param username The name that needs to be fetched. Use user1 for testing.
+ */
+ def getUserByName(username: String): ApiRequest[User] =
+ ApiRequest[User](ApiMethods.GET, "http://petstore.swagger.io/v2", "/user/{username}", "application/json")
+ .withPathParam("username", username)
+ .withSuccessResponse[User](200)
+ .withErrorResponse[Unit](400)
+ .withErrorResponse[Unit](404)
+ /**
+ *
+ * Expected answers:
+ * code 200 : String (successful operation)
+ * Headers :
+ * X-Rate-Limit - calls per hour allowed by the user
+ * X-Expires-After - date in UTC when toekn expires
+ * code 400 : (Invalid username/password supplied)
+ *
+ * @param username The user name for login
+ * @param password The password for login in clear text
+ */
+ def loginUser(username: String, password: String): ApiRequest[String] =
+ ApiRequest[String](ApiMethods.GET, "http://petstore.swagger.io/v2", "/user/login", "application/json")
+ .withQueryParam("username", username)
+ .withQueryParam("password", password)
+ .withSuccessResponse[String](200)
+ .withErrorResponse[Unit](400)
+
+ object LoginUserHeaders {
+ def `x-Rate-Limit`(r: ApiReturnWithHeaders) = r.getIntHeader("X-Rate-Limit")
+ def `x-Expires-After`(r: ApiReturnWithHeaders) = r.getDateTimeHeader("X-Expires-After")
+ }
+ /**
+ *
+ * Expected answers:
+ * code 0 : (successful operation)
+ */
+ def logoutUser(): ApiRequest[Unit] =
+ ApiRequest[Unit](ApiMethods.GET, "http://petstore.swagger.io/v2", "/user/logout", "application/json")
+ .withDefaultSuccessResponse[Unit]
+ /**
+ * This can only be done by the logged in user.
+ *
+ * Expected answers:
+ * code 400 : (Invalid user supplied)
+ * code 404 : (User not found)
+ *
+ * @param username name that need to be deleted
+ * @param body Updated user object
+ */
+ def updateUser(username: String, body: User): ApiRequest[Unit] =
+ ApiRequest[Unit](ApiMethods.PUT, "http://petstore.swagger.io/v2", "/user/{username}", "application/json")
+ .withBody(body)
+ .withPathParam("username", username)
+ .withErrorResponse[Unit](400)
+ .withErrorResponse[Unit](404)
-
}
diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/core/ApiInvoker.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/core/ApiInvoker.scala
index 3b11d866017..18505facbd8 100644
--- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/core/ApiInvoker.scala
+++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/core/ApiInvoker.scala
@@ -1,3 +1,9 @@
+/**
+ * NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen
+ * For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
+ */
+
package io.swagger.client.core
import java.io.File
diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/core/ApiRequest.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/core/ApiRequest.scala
index 0588193cfbe..dd424e55fca 100644
--- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/core/ApiRequest.scala
+++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/core/ApiRequest.scala
@@ -1,3 +1,8 @@
+/**
+ * NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen
+ * For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
+ */
package io.swagger.client.core
sealed trait ResponseState
diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/core/ApiSettings.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/core/ApiSettings.scala
index 3162fb9f6be..7f7b6c0d965 100644
--- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/core/ApiSettings.scala
+++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/core/ApiSettings.scala
@@ -1,3 +1,8 @@
+/**
+ * NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen
+ * For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
+ */
package io.swagger.client.core
import java.util.concurrent.TimeUnit
diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/core/requests.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/core/requests.scala
index a096a994ea3..22db882ea8b 100644
--- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/core/requests.scala
+++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/core/requests.scala
@@ -1,3 +1,8 @@
+/**
+ * NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen
+ * For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
+ */
package io.swagger.client.core
import java.io.File
@@ -8,6 +13,8 @@ sealed trait ApiReturnWithHeaders {
def headers: Map[String, String]
def header(name: String): Option[String] = headers.get(name)
def getStringHeader(name: String) = header(name)
+ // workaround: return date time header in string instead of datetime object
+ def getDateTimeHeader(name: String) = header(name)
def getIntHeader(name: String) = castedHeader(name, java.lang.Integer.parseInt)
def getLongHeader(name: String) = castedHeader(name, java.lang.Long.parseLong)
def getFloatHeader(name: String) = castedHeader(name, java.lang.Float.parseFloat)
diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/ApiResponse.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/ApiResponse.scala
new file mode 100644
index 00000000000..31a9325c6f8
--- /dev/null
+++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/ApiResponse.scala
@@ -0,0 +1,19 @@
+/**
+ * NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen
+ * For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
+ */
+
+package io.swagger.client.model
+
+import io.swagger.client.core.ApiModel
+import org.joda.time.DateTime
+
+
+case class ApiResponse (
+ code: Option[Int],
+ `type`: Option[String],
+ message: Option[String])
+ extends ApiModel
+
+
diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Category.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Category.scala
index af66bc14753..6d14fc12276 100644
--- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Category.scala
+++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Category.scala
@@ -1,3 +1,9 @@
+/**
+ * NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen
+ * For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
+ */
+
package io.swagger.client.model
import io.swagger.client.core.ApiModel
diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Order.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Order.scala
index 83a40fb55d3..7ed7ae6109c 100644
--- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Order.scala
+++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Order.scala
@@ -1,3 +1,9 @@
+/**
+ * NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen
+ * For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
+ */
+
package io.swagger.client.model
import io.swagger.client.core.ApiModel
diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Pet.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Pet.scala
index 8cd3c61cb60..0b8cf84d49a 100644
--- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Pet.scala
+++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Pet.scala
@@ -1,3 +1,9 @@
+/**
+ * NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen
+ * For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
+ */
+
package io.swagger.client.model
import io.swagger.client.core.ApiModel
diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Tag.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Tag.scala
index 58aabadabe0..5a4b2f412c7 100644
--- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Tag.scala
+++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/Tag.scala
@@ -1,3 +1,9 @@
+/**
+ * NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen
+ * For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
+ */
+
package io.swagger.client.model
import io.swagger.client.core.ApiModel
diff --git a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/User.scala b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/User.scala
index dd0bce1d8a7..2dc7325c465 100644
--- a/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/User.scala
+++ b/samples/client/petstore/akka-scala/src/main/scala/io/swagger/client/model/User.scala
@@ -1,3 +1,9 @@
+/**
+ * NOTE: This class is auto generated by the akka-scala (beta) swagger code generator program.
+ * https://github.com/swagger-api/swagger-codegen
+ * For any issue or feedback, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues/new
+ */
+
package io.swagger.client.model
import io.swagger.client.core.ApiModel
diff --git a/samples/client/petstore/android/default/pom.xml b/samples/client/petstore/android/default/pom.xml
index f9c620b7528..afedf8f3027 100644
--- a/samples/client/petstore/android/default/pom.xml
+++ b/samples/client/petstore/android/default/pom.xml
@@ -110,7 +110,7 @@
io.swagger
swagger-annotations
- ${swagger-annotations-version}
+ ${swagger-core-version}
com.google.code.gson
@@ -145,7 +145,7 @@
- 1.5.4
+ 1.5.8
2.3.1
4.8.1
1.0.0
diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/JsonUtil.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/JsonUtil.java
index 49ce07a07ae..17ff327a8aa 100644
--- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/JsonUtil.java
+++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/JsonUtil.java
@@ -35,10 +35,22 @@ public class JsonUtil {
public static Type getListTypeForDeserialization(Class cls) {
String className = cls.getSimpleName();
+ if ("Animal".equalsIgnoreCase(className)) {
+ return new TypeToken>(){}.getType();
+ }
+
+ if ("Cat".equalsIgnoreCase(className)) {
+ return new TypeToken>(){}.getType();
+ }
+
if ("Category".equalsIgnoreCase(className)) {
return new TypeToken>(){}.getType();
}
+ if ("Dog".equalsIgnoreCase(className)) {
+ return new TypeToken>(){}.getType();
+ }
+
if ("InlineResponse200".equalsIgnoreCase(className)) {
return new TypeToken>(){}.getType();
}
@@ -81,10 +93,22 @@ public class JsonUtil {
public static Type getTypeForDeserialization(Class cls) {
String className = cls.getSimpleName();
+ if ("Animal".equalsIgnoreCase(className)) {
+ return new TypeToken(){}.getType();
+ }
+
+ if ("Cat".equalsIgnoreCase(className)) {
+ return new TypeToken(){}.getType();
+ }
+
if ("Category".equalsIgnoreCase(className)) {
return new TypeToken(){}.getType();
}
+ if ("Dog".equalsIgnoreCase(className)) {
+ return new TypeToken(){}.getType();
+ }
+
if ("InlineResponse200".equalsIgnoreCase(className)) {
return new TypeToken(){}.getType();
}
diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/api/UserApi.java
index a28410fd0a9..848f1d2a6cc 100644
--- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/api/UserApi.java
+++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/api/UserApi.java
@@ -258,7 +258,7 @@ public class UserApi {
/**
* Get user by user name
*
- * @param username The name that needs to be fetched. Use user1 for testing.
+ * @param username The name that needs to be fetched. Use user1 for testing.
* @return User
*/
public User getUserByName (String username) throws ApiException {
diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Animal.java
new file mode 100644
index 00000000000..6f956f69f9e
--- /dev/null
+++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Animal.java
@@ -0,0 +1,36 @@
+package io.swagger.client.model;
+
+
+import io.swagger.annotations.*;
+import com.google.gson.annotations.SerializedName;
+
+
+@ApiModel(description = "")
+public class Animal {
+
+ @SerializedName("className")
+ private String className = null;
+
+
+ /**
+ **/
+ @ApiModelProperty(required = true, value = "")
+ public String getClassName() {
+ return className;
+ }
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class Animal {\n");
+
+ sb.append(" className: ").append(className).append("\n");
+ sb.append("}\n");
+ return sb.toString();
+ }
+}
diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Cat.java
new file mode 100644
index 00000000000..b0cd7e96b43
--- /dev/null
+++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Cat.java
@@ -0,0 +1,51 @@
+package io.swagger.client.model;
+
+import io.swagger.client.model.Animal;
+
+import io.swagger.annotations.*;
+import com.google.gson.annotations.SerializedName;
+
+
+@ApiModel(description = "")
+public class Cat extends Animal {
+
+ @SerializedName("className")
+ private String className = null;
+ @SerializedName("declawed")
+ private Boolean declawed = null;
+
+
+ /**
+ **/
+ @ApiModelProperty(required = true, value = "")
+ public String getClassName() {
+ return className;
+ }
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+
+ /**
+ **/
+ @ApiModelProperty(value = "")
+ public Boolean getDeclawed() {
+ return declawed;
+ }
+ public void setDeclawed(Boolean declawed) {
+ this.declawed = declawed;
+ }
+
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class Cat {\n");
+ sb.append(" " + super.toString()).append("\n");
+ sb.append(" className: ").append(className).append("\n");
+ sb.append(" declawed: ").append(declawed).append("\n");
+ sb.append("}\n");
+ return sb.toString();
+ }
+}
diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Dog.java
new file mode 100644
index 00000000000..07b2df5488a
--- /dev/null
+++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Dog.java
@@ -0,0 +1,51 @@
+package io.swagger.client.model;
+
+import io.swagger.client.model.Animal;
+
+import io.swagger.annotations.*;
+import com.google.gson.annotations.SerializedName;
+
+
+@ApiModel(description = "")
+public class Dog extends Animal {
+
+ @SerializedName("className")
+ private String className = null;
+ @SerializedName("breed")
+ private String breed = null;
+
+
+ /**
+ **/
+ @ApiModelProperty(required = true, value = "")
+ public String getClassName() {
+ return className;
+ }
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+
+ /**
+ **/
+ @ApiModelProperty(value = "")
+ public String getBreed() {
+ return breed;
+ }
+ public void setBreed(String breed) {
+ this.breed = breed;
+ }
+
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class Dog {\n");
+ sb.append(" " + super.toString()).append("\n");
+ sb.append(" className: ").append(className).append("\n");
+ sb.append(" breed: ").append(breed).append("\n");
+ sb.append("}\n");
+ return sb.toString();
+ }
+}
diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/InlineResponse200.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/InlineResponse200.java
index c4fd8ce357d..303d160d764 100644
--- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/InlineResponse200.java
+++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/InlineResponse200.java
@@ -10,31 +10,42 @@ import com.google.gson.annotations.SerializedName;
@ApiModel(description = "")
public class InlineResponse200 {
- @SerializedName("tags")
- private List tags = null;
+ @SerializedName("photoUrls")
+ private List photoUrls = null;
+ @SerializedName("name")
+ private String name = null;
@SerializedName("id")
private Long id = null;
@SerializedName("category")
private Object category = null;
+ @SerializedName("tags")
+ private List tags = null;
public enum StatusEnum {
available, pending, sold,
};
@SerializedName("status")
private StatusEnum status = null;
- @SerializedName("name")
- private String name = null;
- @SerializedName("photoUrls")
- private List photoUrls = null;
/**
**/
@ApiModelProperty(value = "")
- public List getTags() {
- return tags;
+ public List getPhotoUrls() {
+ return photoUrls;
}
- public void setTags(List tags) {
- this.tags = tags;
+ public void setPhotoUrls(List photoUrls) {
+ this.photoUrls = photoUrls;
+ }
+
+
+ /**
+ **/
+ @ApiModelProperty(value = "")
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
}
@@ -60,6 +71,17 @@ public class InlineResponse200 {
}
+ /**
+ **/
+ @ApiModelProperty(value = "")
+ public List getTags() {
+ return tags;
+ }
+ public void setTags(List tags) {
+ this.tags = tags;
+ }
+
+
/**
* pet status in the store
**/
@@ -72,40 +94,18 @@ public class InlineResponse200 {
}
- /**
- **/
- @ApiModelProperty(value = "")
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
-
-
- /**
- **/
- @ApiModelProperty(value = "")
- public List getPhotoUrls() {
- return photoUrls;
- }
- public void setPhotoUrls(List photoUrls) {
- this.photoUrls = photoUrls;
- }
-
-
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class InlineResponse200 {\n");
- sb.append(" tags: ").append(tags).append("\n");
+ sb.append(" photoUrls: ").append(photoUrls).append("\n");
+ sb.append(" name: ").append(name).append("\n");
sb.append(" id: ").append(id).append("\n");
sb.append(" category: ").append(category).append("\n");
+ sb.append(" tags: ").append(tags).append("\n");
sb.append(" status: ").append(status).append("\n");
- sb.append(" name: ").append(name).append("\n");
- sb.append(" photoUrls: ").append(photoUrls).append("\n");
sb.append("}\n");
return sb.toString();
}
diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Model200Response.java
index 4a6e58b2a5e..6d3c93d9799 100644
--- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Model200Response.java
+++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Model200Response.java
@@ -5,7 +5,10 @@ import io.swagger.annotations.*;
import com.google.gson.annotations.SerializedName;
-@ApiModel(description = "")
+/**
+ * Model for testing model name starting with number
+ **/
+@ApiModel(description = "Model for testing model name starting with number")
public class Model200Response {
@SerializedName("name")
diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/ModelReturn.java
index 24763f3acb4..464b0cca25e 100644
--- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/ModelReturn.java
+++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/ModelReturn.java
@@ -5,7 +5,10 @@ import io.swagger.annotations.*;
import com.google.gson.annotations.SerializedName;
-@ApiModel(description = "")
+/**
+ * Model for testing reserved words
+ **/
+@ApiModel(description = "Model for testing reserved words")
public class ModelReturn {
@SerializedName("return")
diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Name.java
index 9763aca7b34..1b320fb26ea 100644
--- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Name.java
+++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Name.java
@@ -5,7 +5,10 @@ import io.swagger.annotations.*;
import com.google.gson.annotations.SerializedName;
-@ApiModel(description = "")
+/**
+ * Model for testing model name same as property name
+ **/
+@ApiModel(description = "Model for testing model name same as property name")
public class Name {
@SerializedName("name")
diff --git a/samples/client/petstore/android/volley/build.gradle b/samples/client/petstore/android/volley/build.gradle
index e678620cb00..f794267c737 100644
--- a/samples/client/petstore/android/volley/build.gradle
+++ b/samples/client/petstore/android/volley/build.gradle
@@ -6,10 +6,8 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.5.0'
-
+ classpath 'com.android.tools.build:gradle:1.5.+'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
-
}
}
@@ -55,9 +53,10 @@ android {
ext {
swagger_annotations_version = "1.5.0"
gson_version = "2.3.1"
- httpclient_version = "4.3.3"
+ httpclient_version = "4.5.2"
+ httpcore_version = "4.4.4"
volley_version = "1.0.19"
- junit_version = "4.8.1"
+ junit_version = "4.12"
robolectric_version = "3.0"
concurrent_unit_version = "0.4.2"
}
@@ -65,7 +64,7 @@ ext {
dependencies {
compile "io.swagger:swagger-annotations:$swagger_annotations_version"
compile "com.google.code.gson:gson:$gson_version"
- compile "org.apache.httpcomponents:httpcore:$httpclient_version"
+ compile "org.apache.httpcomponents:httpcore:$httpcore_version"
compile "org.apache.httpcomponents:httpmime:$httpclient_version"
compile "com.mcxiaoke.volley:library:${volley_version}@aar"
testCompile "junit:junit:$junit_version"
diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java
index 21ee5f36286..7ef69c6f0ab 100644
--- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java
+++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java
@@ -189,50 +189,14 @@ public class ApiInvoker {
// Setup authentications (key: authentication name, value: authentication).
INSTANCE.authentications = new HashMap();
-
-
- INSTANCE.authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header"));
-
-
-
-
-
- INSTANCE.authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
-
-
-
-
-
-
- INSTANCE.authentications.put("test_http_basic", new HttpBasicAuth());
-
-
-
-
- INSTANCE.authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret"));
-
-
-
-
-
- INSTANCE.authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id"));
-
-
-
-
-
- INSTANCE.authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query"));
-
-
-
-
-
-
-
// TODO: comment out below as OAuth does not exist
//INSTANCE.authentications.put("petstore_auth", new OAuth());
-
-
+ INSTANCE.authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id"));
+ INSTANCE.authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret"));
+ INSTANCE.authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
+ INSTANCE.authentications.put("test_http_basic", new HttpBasicAuth());
+ INSTANCE.authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query"));
+ INSTANCE.authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header"));
// Prevent the authentications from being modified.
INSTANCE.authentications = Collections.unmodifiableMap(INSTANCE.authentications);
}
diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/JsonUtil.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/JsonUtil.java
index 49ce07a07ae..318c23f957d 100644
--- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/JsonUtil.java
+++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/JsonUtil.java
@@ -35,10 +35,26 @@ public class JsonUtil {
public static Type getListTypeForDeserialization(Class cls) {
String className = cls.getSimpleName();
+ if ("Animal".equalsIgnoreCase(className)) {
+ return new TypeToken>(){}.getType();
+ }
+
+ if ("Cat".equalsIgnoreCase(className)) {
+ return new TypeToken>(){}.getType();
+ }
+
if ("Category".equalsIgnoreCase(className)) {
return new TypeToken>(){}.getType();
}
+ if ("Dog".equalsIgnoreCase(className)) {
+ return new TypeToken>(){}.getType();
+ }
+
+ if ("FormatTest".equalsIgnoreCase(className)) {
+ return new TypeToken>(){}.getType();
+ }
+
if ("InlineResponse200".equalsIgnoreCase(className)) {
return new TypeToken>(){}.getType();
}
@@ -81,10 +97,26 @@ public class JsonUtil {
public static Type getTypeForDeserialization(Class cls) {
String className = cls.getSimpleName();
+ if ("Animal".equalsIgnoreCase(className)) {
+ return new TypeToken(){}.getType();
+ }
+
+ if ("Cat".equalsIgnoreCase(className)) {
+ return new TypeToken(){}.getType();
+ }
+
if ("Category".equalsIgnoreCase(className)) {
return new TypeToken(){}.getType();
}
+ if ("Dog".equalsIgnoreCase(className)) {
+ return new TypeToken(){}.getType();
+ }
+
+ if ("FormatTest".equalsIgnoreCase(className)) {
+ return new TypeToken(){}.getType();
+ }
+
if ("InlineResponse200".equalsIgnoreCase(className)) {
return new TypeToken(){}.getType();
}
diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/PetApi.java
index b0a72ab7d8a..2f39cf7cab1 100644
--- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/PetApi.java
+++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/PetApi.java
@@ -45,7 +45,6 @@ public class PetApi {
return basePath;
}
-
/**
* Add a new pet to the store
*
@@ -66,9 +65,7 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
"application/json","application/xml"
@@ -84,8 +81,7 @@ public class PetApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "petstore_auth" };
@@ -102,7 +98,10 @@ public class PetApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -130,9 +129,7 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
"application/json","application/xml"
@@ -148,8 +145,7 @@ public class PetApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "petstore_auth" };
@@ -158,11 +154,7 @@ public class PetApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
-
responseListener.onResponse(localVarResponse);
-
-
}
}, new Response.ErrorListener() {
@Override
@@ -174,7 +166,6 @@ public class PetApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Fake endpoint to test byte array in body parameter for adding a new pet to the store
*
@@ -186,7 +177,7 @@ public class PetApi {
// create path and map variables
- String path = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json");
+ String path = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json");
// query params
List queryParams = new ArrayList();
@@ -195,9 +186,7 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
"application/json","application/xml"
@@ -213,8 +202,7 @@ public class PetApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "petstore_auth" };
@@ -231,7 +219,10 @@ public class PetApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -250,7 +241,7 @@ public class PetApi {
// create path and map variables
- String path = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json");
+ String path = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json");
// query params
List queryParams = new ArrayList();
@@ -259,9 +250,7 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
"application/json","application/xml"
@@ -277,8 +266,7 @@ public class PetApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "petstore_auth" };
@@ -287,11 +275,7 @@ public class PetApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
-
responseListener.onResponse(localVarResponse);
-
-
}
}, new Response.ErrorListener() {
@Override
@@ -303,7 +287,6 @@ public class PetApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Deletes a pet
*
@@ -331,11 +314,8 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
-
headerParams.put("api_key", ApiInvoker.parameterToString(apiKey));
-
String[] contentTypes = {
@@ -351,8 +331,7 @@ public class PetApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "petstore_auth" };
@@ -369,7 +348,10 @@ public class PetApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -403,11 +385,8 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
-
headerParams.put("api_key", ApiInvoker.parameterToString(apiKey));
-
String[] contentTypes = {
@@ -423,8 +402,7 @@ public class PetApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "petstore_auth" };
@@ -433,11 +411,7 @@ public class PetApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
-
responseListener.onResponse(localVarResponse);
-
-
}
}, new Response.ErrorListener() {
@Override
@@ -449,7 +423,6 @@ public class PetApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
@@ -470,11 +443,8 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
queryParams.addAll(ApiInvoker.parameterToPairs("multi", "status", status));
-
-
String[] contentTypes = {
@@ -490,8 +460,7 @@ public class PetApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "petstore_auth" };
@@ -508,7 +477,10 @@ public class PetApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -536,11 +508,8 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
queryParams.addAll(ApiInvoker.parameterToPairs("multi", "status", status));
-
-
String[] contentTypes = {
@@ -556,8 +525,7 @@ public class PetApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "petstore_auth" };
@@ -566,16 +534,11 @@ public class PetApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
try {
responseListener.onResponse((List) ApiInvoker.deserialize(localVarResponse, "array", Pet.class));
-
-
-
} catch (ApiException exception) {
errorListener.onErrorResponse(new VolleyError(exception));
}
-
}
}, new Response.ErrorListener() {
@Override
@@ -587,7 +550,6 @@ public class PetApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Finds Pets by tags
* Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
@@ -608,11 +570,8 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
queryParams.addAll(ApiInvoker.parameterToPairs("multi", "tags", tags));
-
-
String[] contentTypes = {
@@ -628,8 +587,7 @@ public class PetApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "petstore_auth" };
@@ -646,7 +604,10 @@ public class PetApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -674,11 +635,8 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
queryParams.addAll(ApiInvoker.parameterToPairs("multi", "tags", tags));
-
-
String[] contentTypes = {
@@ -694,8 +652,7 @@ public class PetApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "petstore_auth" };
@@ -704,16 +661,11 @@ public class PetApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
try {
responseListener.onResponse((List) ApiInvoker.deserialize(localVarResponse, "array", Pet.class));
-
-
-
} catch (ApiException exception) {
errorListener.onErrorResponse(new VolleyError(exception));
}
-
}
}, new Response.ErrorListener() {
@Override
@@ -725,7 +677,6 @@ public class PetApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Find pet by ID
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
@@ -752,9 +703,7 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -770,10 +719,9 @@ public class PetApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
- String[] authNames = new String[] { "api_key", "petstore_auth" };
+ String[] authNames = new String[] { "petstore_auth", "api_key" };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
@@ -788,7 +736,10 @@ public class PetApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -822,9 +773,7 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -840,26 +789,20 @@ public class PetApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
- String[] authNames = new String[] { "api_key", "petstore_auth" };
+ String[] authNames = new String[] { "petstore_auth", "api_key" };
try {
apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames,
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
try {
responseListener.onResponse((Pet) ApiInvoker.deserialize(localVarResponse, "", Pet.class));
-
-
-
} catch (ApiException exception) {
errorListener.onErrorResponse(new VolleyError(exception));
}
-
}
}, new Response.ErrorListener() {
@Override
@@ -871,7 +814,6 @@ public class PetApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
@@ -889,7 +831,7 @@ public class PetApi {
// create path and map variables
- String path = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
+ String path = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
// query params
List queryParams = new ArrayList();
@@ -898,9 +840,7 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -916,10 +856,9 @@ public class PetApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
- String[] authNames = new String[] { "api_key", "petstore_auth" };
+ String[] authNames = new String[] { "petstore_auth", "api_key" };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
@@ -934,7 +873,10 @@ public class PetApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -959,7 +901,7 @@ public class PetApi {
// create path and map variables
- String path = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
+ String path = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
// query params
List queryParams = new ArrayList();
@@ -968,9 +910,7 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -986,26 +926,20 @@ public class PetApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
- String[] authNames = new String[] { "api_key", "petstore_auth" };
+ String[] authNames = new String[] { "petstore_auth", "api_key" };
try {
apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames,
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
try {
responseListener.onResponse((InlineResponse200) ApiInvoker.deserialize(localVarResponse, "", InlineResponse200.class));
-
-
-
} catch (ApiException exception) {
errorListener.onErrorResponse(new VolleyError(exception));
}
-
}
}, new Response.ErrorListener() {
@Override
@@ -1017,7 +951,6 @@ public class PetApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Fake endpoint to test byte array return by 'Find pet by ID'
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
@@ -1035,7 +968,7 @@ public class PetApi {
// create path and map variables
- String path = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
+ String path = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
// query params
List queryParams = new ArrayList();
@@ -1044,9 +977,7 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -1062,10 +993,9 @@ public class PetApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
- String[] authNames = new String[] { "api_key", "petstore_auth" };
+ String[] authNames = new String[] { "petstore_auth", "api_key" };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
@@ -1080,7 +1010,10 @@ public class PetApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -1105,7 +1038,7 @@ public class PetApi {
// create path and map variables
- String path = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
+ String path = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
// query params
List queryParams = new ArrayList();
@@ -1114,9 +1047,7 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -1132,26 +1063,20 @@ public class PetApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
- String[] authNames = new String[] { "api_key", "petstore_auth" };
+ String[] authNames = new String[] { "petstore_auth", "api_key" };
try {
apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames,
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
try {
responseListener.onResponse((byte[]) ApiInvoker.deserialize(localVarResponse, "", byte[].class));
-
-
-
} catch (ApiException exception) {
errorListener.onErrorResponse(new VolleyError(exception));
}
-
}
}, new Response.ErrorListener() {
@Override
@@ -1163,7 +1088,6 @@ public class PetApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Update an existing pet
*
@@ -1184,9 +1108,7 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
"application/json","application/xml"
@@ -1202,8 +1124,7 @@ public class PetApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "petstore_auth" };
@@ -1220,7 +1141,10 @@ public class PetApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -1248,9 +1172,7 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
"application/json","application/xml"
@@ -1266,8 +1188,7 @@ public class PetApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "petstore_auth" };
@@ -1276,11 +1197,7 @@ public class PetApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
-
responseListener.onResponse(localVarResponse);
-
-
}
}, new Response.ErrorListener() {
@Override
@@ -1292,7 +1209,6 @@ public class PetApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Updates a pet in the store with form data
*
@@ -1321,9 +1237,7 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
"application/x-www-form-urlencoded"
@@ -1348,8 +1262,7 @@ public class PetApi {
} else {
// normal form params
formParams.put("name", ApiInvoker.parameterToString(name));
- formParams.put("status", ApiInvoker.parameterToString(status));
-
+formParams.put("status", ApiInvoker.parameterToString(status));
}
String[] authNames = new String[] { "petstore_auth" };
@@ -1367,7 +1280,10 @@ public class PetApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -1401,9 +1317,7 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
"application/x-www-form-urlencoded"
@@ -1428,8 +1342,7 @@ public class PetApi {
} else {
// normal form params
formParams.put("name", ApiInvoker.parameterToString(name));
- formParams.put("status", ApiInvoker.parameterToString(status));
-
+formParams.put("status", ApiInvoker.parameterToString(status));
}
String[] authNames = new String[] { "petstore_auth" };
@@ -1439,11 +1352,7 @@ public class PetApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
-
responseListener.onResponse(localVarResponse);
-
-
}
}, new Response.ErrorListener() {
@Override
@@ -1455,7 +1364,6 @@ public class PetApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* uploads an image
*
@@ -1484,9 +1392,7 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
"multipart/form-data"
@@ -1511,8 +1417,7 @@ public class PetApi {
} else {
// normal form params
formParams.put("additionalMetadata", ApiInvoker.parameterToString(additionalMetadata));
-
-
+
}
String[] authNames = new String[] { "petstore_auth" };
@@ -1530,7 +1435,10 @@ public class PetApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -1564,9 +1472,7 @@ public class PetApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
"multipart/form-data"
@@ -1591,8 +1497,7 @@ public class PetApi {
} else {
// normal form params
formParams.put("additionalMetadata", ApiInvoker.parameterToString(additionalMetadata));
-
-
+
}
String[] authNames = new String[] { "petstore_auth" };
@@ -1602,11 +1507,7 @@ public class PetApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
-
responseListener.onResponse(localVarResponse);
-
-
}
}, new Response.ErrorListener() {
@Override
@@ -1618,5 +1519,4 @@ public class PetApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
}
diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/StoreApi.java
index e0aa403200a..2d7b1e7683f 100644
--- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/StoreApi.java
+++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/StoreApi.java
@@ -44,7 +44,6 @@ public class StoreApi {
return basePath;
}
-
/**
* Delete purchase order by ID
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
@@ -71,9 +70,7 @@ public class StoreApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -89,8 +86,7 @@ public class StoreApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { };
@@ -107,7 +103,10 @@ public class StoreApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -141,9 +140,7 @@ public class StoreApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -159,8 +156,7 @@ public class StoreApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { };
@@ -169,11 +165,7 @@ public class StoreApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
-
responseListener.onResponse(localVarResponse);
-
-
}
}, new Response.ErrorListener() {
@Override
@@ -185,7 +177,6 @@ public class StoreApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Finds orders by status
* A single status value can be provided as a string
@@ -206,11 +197,8 @@ public class StoreApi {
// form params
Map formParams = new HashMap();
-
queryParams.addAll(ApiInvoker.parameterToPairs("", "status", status));
-
-
String[] contentTypes = {
@@ -226,8 +214,7 @@ public class StoreApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" };
@@ -244,7 +231,10 @@ public class StoreApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -272,11 +262,8 @@ public class StoreApi {
// form params
Map formParams = new HashMap();
-
queryParams.addAll(ApiInvoker.parameterToPairs("", "status", status));
-
-
String[] contentTypes = {
@@ -292,8 +279,7 @@ public class StoreApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" };
@@ -302,16 +288,11 @@ public class StoreApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
try {
responseListener.onResponse((List) ApiInvoker.deserialize(localVarResponse, "array", Order.class));
-
-
-
} catch (ApiException exception) {
errorListener.onErrorResponse(new VolleyError(exception));
}
-
}
}, new Response.ErrorListener() {
@Override
@@ -323,7 +304,6 @@ public class StoreApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
@@ -343,9 +323,7 @@ public class StoreApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -361,8 +339,7 @@ public class StoreApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "api_key" };
@@ -379,7 +356,10 @@ public class StoreApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -407,9 +387,7 @@ public class StoreApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -425,8 +403,7 @@ public class StoreApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "api_key" };
@@ -435,16 +412,11 @@ public class StoreApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
try {
responseListener.onResponse((Map) ApiInvoker.deserialize(localVarResponse, "map", Map.class));
-
-
-
} catch (ApiException exception) {
errorListener.onErrorResponse(new VolleyError(exception));
}
-
}
}, new Response.ErrorListener() {
@Override
@@ -456,7 +428,6 @@ public class StoreApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Fake endpoint to test arbitrary object return by 'Get inventory'
* Returns an arbitrary object which is actually a map of status codes to quantities
@@ -467,7 +438,7 @@ public class StoreApi {
// create path and map variables
- String path = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json");
+ String path = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json");
// query params
List queryParams = new ArrayList();
@@ -476,9 +447,7 @@ public class StoreApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -494,8 +463,7 @@ public class StoreApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "api_key" };
@@ -512,7 +480,10 @@ public class StoreApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -531,7 +502,7 @@ public class StoreApi {
// create path and map variables
- String path = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json");
+ String path = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json");
// query params
List queryParams = new ArrayList();
@@ -540,9 +511,7 @@ public class StoreApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -558,8 +527,7 @@ public class StoreApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "api_key" };
@@ -568,16 +536,11 @@ public class StoreApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
try {
responseListener.onResponse((Object) ApiInvoker.deserialize(localVarResponse, "", Object.class));
-
-
-
} catch (ApiException exception) {
errorListener.onErrorResponse(new VolleyError(exception));
}
-
}
}, new Response.ErrorListener() {
@Override
@@ -589,10 +552,9 @@ public class StoreApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Find purchase order by ID
- * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
+ * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
* @return Order
*/
@@ -616,9 +578,7 @@ public class StoreApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -634,10 +594,9 @@ public class StoreApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
- String[] authNames = new String[] { "test_api_key_header", "test_api_key_query" };
+ String[] authNames = new String[] { "test_api_key_query", "test_api_key_header" };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
@@ -652,7 +611,10 @@ public class StoreApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -662,7 +624,7 @@ public class StoreApi {
/**
* Find purchase order by ID
- * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
+ * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
*/
public void getOrderById (String orderId, final Response.Listener responseListener, final Response.ErrorListener errorListener) {
@@ -686,9 +648,7 @@ public class StoreApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -704,26 +664,20 @@ public class StoreApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
- String[] authNames = new String[] { "test_api_key_header", "test_api_key_query" };
+ String[] authNames = new String[] { "test_api_key_query", "test_api_key_header" };
try {
apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames,
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
try {
responseListener.onResponse((Order) ApiInvoker.deserialize(localVarResponse, "", Order.class));
-
-
-
} catch (ApiException exception) {
errorListener.onErrorResponse(new VolleyError(exception));
}
-
}
}, new Response.ErrorListener() {
@Override
@@ -735,7 +689,6 @@ public class StoreApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Place an order for a pet
*
@@ -756,9 +709,7 @@ public class StoreApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -774,8 +725,7 @@ public class StoreApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" };
@@ -792,7 +742,10 @@ public class StoreApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -820,9 +773,7 @@ public class StoreApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -838,8 +789,7 @@ public class StoreApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" };
@@ -848,16 +798,11 @@ public class StoreApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
try {
responseListener.onResponse((Order) ApiInvoker.deserialize(localVarResponse, "", Order.class));
-
-
-
} catch (ApiException exception) {
errorListener.onErrorResponse(new VolleyError(exception));
}
-
}
}, new Response.ErrorListener() {
@Override
@@ -869,5 +814,4 @@ public class StoreApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
}
diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/UserApi.java
index 0938e600dd2..33575e314b9 100644
--- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/UserApi.java
+++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/UserApi.java
@@ -44,7 +44,6 @@ public class UserApi {
return basePath;
}
-
/**
* Create user
* This can only be done by the logged in user.
@@ -65,9 +64,7 @@ public class UserApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -83,8 +80,7 @@ public class UserApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { };
@@ -101,7 +97,10 @@ public class UserApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -129,9 +128,7 @@ public class UserApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -147,8 +144,7 @@ public class UserApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { };
@@ -157,11 +153,7 @@ public class UserApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
-
responseListener.onResponse(localVarResponse);
-
-
}
}, new Response.ErrorListener() {
@Override
@@ -173,7 +165,6 @@ public class UserApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Creates list of users with given input array
*
@@ -194,9 +185,7 @@ public class UserApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -212,8 +201,7 @@ public class UserApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { };
@@ -230,7 +218,10 @@ public class UserApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -258,9 +249,7 @@ public class UserApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -276,8 +265,7 @@ public class UserApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { };
@@ -286,11 +274,7 @@ public class UserApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
-
responseListener.onResponse(localVarResponse);
-
-
}
}, new Response.ErrorListener() {
@Override
@@ -302,7 +286,6 @@ public class UserApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Creates list of users with given input array
*
@@ -323,9 +306,7 @@ public class UserApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -341,8 +322,7 @@ public class UserApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { };
@@ -359,7 +339,10 @@ public class UserApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -387,9 +370,7 @@ public class UserApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -405,8 +386,7 @@ public class UserApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { };
@@ -415,11 +395,7 @@ public class UserApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
-
responseListener.onResponse(localVarResponse);
-
-
}
}, new Response.ErrorListener() {
@Override
@@ -431,7 +407,6 @@ public class UserApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Delete user
* This can only be done by the logged in user.
@@ -458,9 +433,7 @@ public class UserApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -476,8 +449,7 @@ public class UserApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "test_http_basic" };
@@ -494,7 +466,10 @@ public class UserApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -528,9 +503,7 @@ public class UserApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -546,8 +519,7 @@ public class UserApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { "test_http_basic" };
@@ -556,11 +528,7 @@ public class UserApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
-
responseListener.onResponse(localVarResponse);
-
-
}
}, new Response.ErrorListener() {
@Override
@@ -572,11 +540,10 @@ public class UserApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Get user by user name
*
- * @param username The name that needs to be fetched. Use user1 for testing.
+ * @param username The name that needs to be fetched. Use user1 for testing.
* @return User
*/
public User getUserByName (String username) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
@@ -599,9 +566,7 @@ public class UserApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -617,8 +582,7 @@ public class UserApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { };
@@ -635,7 +599,10 @@ public class UserApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -646,7 +613,7 @@ public class UserApi {
/**
* Get user by user name
*
- * @param username The name that needs to be fetched. Use user1 for testing.
+ * @param username The name that needs to be fetched. Use user1 for testing.
*/
public void getUserByName (String username, final Response.Listener responseListener, final Response.ErrorListener errorListener) {
Object postBody = null;
@@ -669,9 +636,7 @@ public class UserApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -687,8 +652,7 @@ public class UserApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { };
@@ -697,16 +661,11 @@ public class UserApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
try {
responseListener.onResponse((User) ApiInvoker.deserialize(localVarResponse, "", User.class));
-
-
-
} catch (ApiException exception) {
errorListener.onErrorResponse(new VolleyError(exception));
}
-
}
}, new Response.ErrorListener() {
@Override
@@ -718,7 +677,6 @@ public class UserApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Logs user into the system
*
@@ -740,13 +698,9 @@ public class UserApi {
// form params
Map formParams = new HashMap();
-
queryParams.addAll(ApiInvoker.parameterToPairs("", "username", username));
-
queryParams.addAll(ApiInvoker.parameterToPairs("", "password", password));
-
-
String[] contentTypes = {
@@ -762,8 +716,7 @@ public class UserApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { };
@@ -780,7 +733,10 @@ public class UserApi {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
- throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage());
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
}
throw ex;
} catch (TimeoutException ex) {
@@ -808,13 +764,9 @@ public class UserApi {
// form params
Map