diff --git a/bin/csharp-dotnet2-petstore.sh b/bin/csharp-dotnet2-petstore.sh
index fdab8bc413b..a63bfa35bfd 100755
--- a/bin/csharp-dotnet2-petstore.sh
+++ b/bin/csharp-dotnet2-petstore.sh
@@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
-ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l CsharpDotNet2 -o samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient"
+ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l CsharpDotNet2 -o samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient"
java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/csharp-petstore.sh b/bin/csharp-petstore.sh
index c3fe78f0f36..c042dd9c0cd 100755
--- a/bin/csharp-petstore.sh
+++ b/bin/csharp-petstore.sh
@@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
-ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l csharp -o samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient"
+ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient"
java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/perl-petstore.sh b/bin/perl-petstore.sh
index b2eb1753d67..f3eb5b17bd9 100755
--- a/bin/perl-petstore.sh
+++ b/bin/perl-petstore.sh
@@ -27,7 +27,7 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
# complex module name used for testing
-ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l perl -o samples/client/petstore/perl"
+ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l perl -o samples/client/petstore/perl"
java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/php-petstore.sh b/bin/php-petstore.sh
index 14b53d65b4f..3b25c1c1cc3 100755
--- a/bin/php-petstore.sh
+++ b/bin/php-petstore.sh
@@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
-ags="$@ generate -t modules/swagger-codegen/src/main/resources/php -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l php -o samples/client/petstore/php"
+ags="$@ generate -t modules/swagger-codegen/src/main/resources/php -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l php -o samples/client/petstore/php"
java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/python-petstore.sh b/bin/python-petstore.sh
index 022629a9e20..ef120089f45 100755
--- a/bin/python-petstore.sh
+++ b/bin/python-petstore.sh
@@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
-ags="$@ generate -t modules/swagger-codegen/src/main/resources/python -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l python -o samples/client/petstore/python"
+ags="$@ generate -t modules/swagger-codegen/src/main/resources/python -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l python -o samples/client/petstore/python"
java $JAVA_OPTS -jar $executable $ags
diff --git a/bin/ruby-petstore.sh b/bin/ruby-petstore.sh
index 05cf1ee995e..f1c87e32028 100755
--- a/bin/ruby-petstore.sh
+++ b/bin/ruby-petstore.sh
@@ -26,6 +26,6 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
-ags="$@ generate -t modules/swagger-codegen/src/main/resources/ruby -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l ruby -c bin/ruby-petstore.json -o samples/client/petstore/ruby"
+ags="$@ generate -t modules/swagger-codegen/src/main/resources/ruby -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l ruby -c bin/ruby-petstore.json -o samples/client/petstore/ruby"
java $JAVA_OPTS -jar $executable $ags
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java
index 76c0d1277b1..df23c1f2275 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java
@@ -89,7 +89,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
"Int64",
"Float",
"Guid",
- "Stream", // not really a primitive, we include it to avoid model import
+ "System.IO.Stream", // not really a primitive, we include it to avoid model import
"Object")
);
@@ -110,7 +110,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
typeMapping.put("number", "double?");
typeMapping.put("datetime", "DateTime?");
typeMapping.put("date", "DateTime?");
- typeMapping.put("file", "Stream");
+ typeMapping.put("file", "System.IO.Stream");
typeMapping.put("array", "List");
typeMapping.put("list", "List");
typeMapping.put("map", "Dictionary");
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CsharpDotNet2ClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CsharpDotNet2ClientCodegen.java
index c08ae3456b1..05654eebe5c 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CsharpDotNet2ClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CsharpDotNet2ClientCodegen.java
@@ -60,7 +60,7 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege
"Integer",
"Long",
"Float",
- "Stream", // not really a primitive, we include it to avoid model import
+ "System.IO.Stream", // not really a primitive, we include it to avoid model import
"Object")
);
instantiationTypes.put("array", "List");
@@ -76,7 +76,7 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege
typeMapping.put("number", "double?");
typeMapping.put("datetime", "DateTime?");
typeMapping.put("date", "DateTime?");
- typeMapping.put("file", "Stream");
+ typeMapping.put("file", "System.IO.Stream");
typeMapping.put("array", "List");
typeMapping.put("list", "List");
typeMapping.put("map", "Dictionary");
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java
index b77239a5b4d..5bebf932851 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java
@@ -4,6 +4,7 @@ import io.swagger.codegen.*;
import io.swagger.models.properties.ArrayProperty;
import io.swagger.models.properties.MapProperty;
import io.swagger.models.properties.Property;
+import io.swagger.models.parameters.Parameter;
import java.io.File;
import java.util.*;
@@ -132,7 +133,7 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
- supportingFiles.add(new SupportingFile("configuration.mustache", packageName, "Configuration.go"));
+ supportingFiles.add(new SupportingFile("configuration.mustache", packageName, "configuration.go"));
}
@Override
@@ -196,6 +197,13 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
@Override
public String toModelName(String name) {
+ // camelize the model name
+ // phone_number => PhoneNumber
+ return camelize(toModelFilename(name));
+ }
+
+ @Override
+ public String toModelFilename(String name) {
if (!StringUtils.isEmpty(modelNamePrefix)) {
name = modelNamePrefix + "_" + name;
}
@@ -212,17 +220,48 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
name = "model_" + name; // e.g. return => ModelReturn (after camelize)
}
- // camelize the model name
- // phone_number => PhoneNumber
- return camelize(name);
+ return underscore(name);
}
@Override
- public String toModelFilename(String name) {
- // should be the same as the model name
- return toModelName(name);
+ public String toApiFilename(String name) {
+ // replace - with _ e.g. created-at => created_at
+ name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'.
+
+ // e.g. PetApi.go => pet_api.go
+ return underscore(name) + "_api";
}
+
+
+ /**
+ * Overrides postProcessParameter to add a vendor extension "x-exportParamName".
+ * This is useful when paramName starts with a lowercase letter, but we need that
+ * param to be exportable (starts with an Uppercase letter).
+ *
+ * @param parameter CodegenParameter object to be processed.
+ */
+ @Override
+ public void postProcessParameter(CodegenParameter parameter){
+
+ // Give the base class a chance to process
+ super.postProcessParameter(parameter);
+
+ char firstChar = parameter.paramName.charAt(0);
+
+ if (Character.isUpperCase(firstChar)) {
+ // First char is already uppercase, just use paramName.
+ parameter.vendorExtensions.put("x-exportParamName", parameter.paramName);
+
+ }
+
+ // It's a lowercase first char, let's convert it to uppercase
+ StringBuilder sb = new StringBuilder(parameter.paramName);
+ sb.setCharAt(0, Character.toUpperCase(firstChar));
+ parameter.vendorExtensions.put("x-exportParamName", sb.toString());
+ }
+
+
@Override
public String getTypeDeclaration(Property p) {
if(p instanceof ArrayProperty) {
diff --git a/modules/swagger-codegen/src/main/resources/CsharpDotNet2/api.mustache b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/api.mustache
index c3fb85acb4f..f1756813ef4 100644
--- a/modules/swagger-codegen/src/main/resources/CsharpDotNet2/api.mustache
+++ b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/api.mustache
@@ -1,5 +1,4 @@
using System;
-using System.IO;
using System.Collections.Generic;
using RestSharp;
using {{packageName}}.Client;
diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache
index 6e7ef1c19f3..bf6b76d6b41 100644
--- a/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache
+++ b/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache
@@ -190,9 +190,9 @@ export class {{classname}} {
let formParams: any = {};
{{#allParams}}{{#required}}
- // verify required parameter '{{paramName}}' is set
- if (!{{paramName}}) {
- throw new Error('Missing required parameter {{paramName}} when calling {{nickname}}');
+ // verify required parameter '{{paramName}}' is not null or undefined
+ if ({{paramName}} === null || {{paramName}} === undefined) {
+ throw new Error('Required parameter {{paramName}} was null or undefined when calling {{nickname}}.');
}
{{/required}}{{/allParams}}
{{#queryParams}}
diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/api.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/api.mustache
index af6f859c73d..38c7f00cdaa 100644
--- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/api.mustache
+++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/api.mustache
@@ -121,7 +121,10 @@ public class {{classname}} {
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) {
diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/build.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/build.mustache
index fabdd14a6d6..917f9d11eff 100644
--- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/build.mustache
+++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/build.mustache
@@ -70,7 +70,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/modules/swagger-codegen/src/main/resources/csharp/api.mustache b/modules/swagger-codegen/src/main/resources/csharp/api.mustache
index 18c675d6350..85af270c213 100644
--- a/modules/swagger-codegen/src/main/resources/csharp/api.mustache
+++ b/modules/swagger-codegen/src/main/resources/csharp/api.mustache
@@ -1,5 +1,4 @@
using System;
-using System.IO;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
diff --git a/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache b/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache
index 5f5a03aa612..cb345a93cc4 100644
--- a/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache
+++ b/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache
@@ -61,7 +61,8 @@ namespace {{packageName}}.Test
public void {{operationId}}Test()
{
// TODO: add unit test for the method '{{operationId}}'
- {{#allParams}}{{{dataType}}} {{paramName}} = null; // TODO: replace null with proper value
+ {{#allParams}}
+ {{{dataType}}} {{paramName}} = null; // TODO: replace null with proper value
{{/allParams}}
{{#returnType}}var response = {{/returnType}}instance.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
{{#returnType}}Assert.IsInstanceOf<{{{returnType}}}> (response, "response is {{{returnType}}}");{{/returnType}}
diff --git a/modules/swagger-codegen/src/main/resources/go/api.mustache b/modules/swagger-codegen/src/main/resources/go/api.mustache
index 6c6ade4379e..233afa8ad89 100644
--- a/modules/swagger-codegen/src/main/resources/go/api.mustache
+++ b/modules/swagger-codegen/src/main/resources/go/api.mustache
@@ -81,10 +81,10 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{
}
{{#hasQueryParams}} type QueryParams struct {
- {{#queryParams}}{{paramName}} {{dataType}} `url:"{{baseName}},omitempty"`
+ {{#queryParams}}{{vendorExtensions.x-exportParamName}} {{dataType}} `url:"{{baseName}},omitempty"`
{{/queryParams}}
}
- _sling = _sling.QueryStruct(&QueryParams{ {{#queryParams}}{{paramName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/queryParams}} })
+ _sling = _sling.QueryStruct(&QueryParams{ {{#queryParams}}{{vendorExtensions.x-exportParamName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/queryParams}} })
{{/hasQueryParams}}
// accept header
accepts := []string { {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }
@@ -96,10 +96,10 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{
_sling = _sling.Set("{{baseName}}", {{paramName}})
{{/headerParams}}{{/hasHeaderParams}}
{{#hasFormParams}} type FormParams struct {
-{{#formParams}} {{paramName}} {{dataType}} `url:"{{baseName}},omitempty"`
+{{#formParams}} {{vendorExtensions.x-exportParamName}} {{dataType}} `url:"{{baseName}},omitempty"`
{{/formParams}}
}
- _sling = _sling.BodyForm(&FormParams{ {{#formParams}}{{paramName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/formParams}} })
+ _sling = _sling.BodyForm(&FormParams{ {{#formParams}}{{vendorExtensions.x-exportParamName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/formParams}} })
{{/hasFormParams}}
{{#hasBodyParam}}{{#bodyParams}}// body params
_sling = _sling.BodyJSON({{paramName}})
diff --git a/modules/swagger-codegen/src/main/resources/go/configuration.mustache b/modules/swagger-codegen/src/main/resources/go/configuration.mustache
index ae711d5dd49..301f46d8fd4 100644
--- a/modules/swagger-codegen/src/main/resources/go/configuration.mustache
+++ b/modules/swagger-codegen/src/main/resources/go/configuration.mustache
@@ -18,6 +18,7 @@ type Configuration struct {
Scheme string `json:"scheme,omitempty"`
AccessToken string `json:"accessToken,omitempty"`
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
+ UserAgent string `json:"userAgent,omitempty"`
}
func NewConfiguration() *Configuration {
@@ -27,7 +28,8 @@ func NewConfiguration() *Configuration {
Debug: false,
DefaultHeader: make(map[string]string),
ApiKey: make(map[string]string),
- ApiKeyPrefix: make(map[string]string) ,
+ ApiKeyPrefix: make(map[string]string),
+ UserAgent: "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{packageVersion}}}/go{{/httpUserAgent}}",
}
}
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/test/java/io/swagger/codegen/go/GoModelTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/go/GoModelTest.java
index 6f12032460c..83fa8d6437e 100644
--- 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
@@ -38,8 +38,7 @@ public class GoModelTest {
Assert.assertEquals(cm.classname, "Sample");
Assert.assertEquals(cm.description, "a sample model");
Assert.assertEquals(cm.vars.size(), 3);
- // {{imports}} is not used in template
- //Assert.assertEquals(cm.imports.size(), 1);
+ Assert.assertEquals(cm.imports.size(), 1);
final CodegenProperty property1 = cm.vars.get(0);
Assert.assertEquals(property1.baseName, "id");
@@ -199,8 +198,7 @@ public class GoModelTest {
Assert.assertEquals(cm.classname, "Sample");
Assert.assertEquals(cm.description, "a sample model");
Assert.assertEquals(cm.vars.size(), 1);
- // {{imports}} is not used in template
- //Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).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");
@@ -226,7 +224,7 @@ public class GoModelTest {
Assert.assertEquals(cm.classname, "Sample");
Assert.assertEquals(cm.description, "an array model");
Assert.assertEquals(cm.vars.size(), 0);
- // skip import test as import is not used by Go codegen
+ Assert.assertEquals(cm.imports.size(), 1);
}
@Test(description = "convert an map model")
@@ -241,9 +239,8 @@ public class GoModelTest {
Assert.assertEquals(cm.classname, "Sample");
Assert.assertEquals(cm.description, "a map model");
Assert.assertEquals(cm.vars.size(), 0);
- // {{imports}} is not used in template
- //Assert.assertEquals(cm.imports.size(), 2);
- //Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1);
+ Assert.assertEquals(cm.imports.size(), 1);
+ Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1);
}
@DataProvider(name = "modelNames")
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/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 formParams = new HashMap();
-
queryParams.addAll(ApiInvoker.parameterToPairs("", "username", username));
-
queryParams.addAll(ApiInvoker.parameterToPairs("", "password", password));
-
-
String[] contentTypes = {
@@ -830,8 +782,7 @@ public class UserApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { };
@@ -840,16 +791,11 @@ public class UserApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
try {
responseListener.onResponse((String) ApiInvoker.deserialize(localVarResponse, "", String.class));
-
-
-
} catch (ApiException exception) {
errorListener.onErrorResponse(new VolleyError(exception));
}
-
}
}, new Response.ErrorListener() {
@Override
@@ -861,7 +807,6 @@ public class UserApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Logs out current logged in user session
*
@@ -881,9 +826,7 @@ public class UserApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -899,8 +842,7 @@ public class UserApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { };
@@ -917,7 +859,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) {
@@ -945,9 +890,7 @@ public class UserApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -963,8 +906,7 @@ public class UserApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { };
@@ -973,11 +915,7 @@ public class UserApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
-
responseListener.onResponse(localVarResponse);
-
-
}
}, new Response.ErrorListener() {
@Override
@@ -989,7 +927,6 @@ public class UserApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
/**
* Updated user
* This can only be done by the logged in user.
@@ -1017,9 +954,7 @@ public class UserApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -1035,8 +970,7 @@ public class UserApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { };
@@ -1053,7 +987,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) {
@@ -1087,9 +1024,7 @@ public class UserApi {
// form params
Map formParams = new HashMap();
-
-
String[] contentTypes = {
@@ -1105,8 +1040,7 @@ public class UserApi {
postBody = httpEntity;
} else {
// normal form params
-
- }
+ }
String[] authNames = new String[] { };
@@ -1115,11 +1049,7 @@ public class UserApi {
new Response.Listener() {
@Override
public void onResponse(String localVarResponse) {
-
-
responseListener.onResponse(localVarResponse);
-
-
}
}, new Response.ErrorListener() {
@Override
@@ -1131,5 +1061,4 @@ public class UserApi {
errorListener.onErrorResponse(new VolleyError(ex));
}
}
-
}
diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Animal.java
new file mode 100644
index 00000000000..80b84fb850a
--- /dev/null
+++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Animal.java
@@ -0,0 +1,34 @@
+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/volley/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Cat.java
new file mode 100644
index 00000000000..449d6bddaa7
--- /dev/null
+++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Cat.java
@@ -0,0 +1,48 @@
+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/volley/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Category.java
index 44c71e8a620..b3fa2f93341 100644
--- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Category.java
+++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Category.java
@@ -13,7 +13,6 @@ public class Category {
@SerializedName("name")
private String name = null;
-
/**
**/
@ApiModelProperty(value = "")
@@ -24,7 +23,6 @@ public class Category {
this.id = id;
}
-
/**
**/
@ApiModelProperty(value = "")
@@ -35,7 +33,6 @@ public class Category {
this.name = name;
}
-
@Override
public String toString() {
diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Dog.java
new file mode 100644
index 00000000000..8f35b9b0ea9
--- /dev/null
+++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Dog.java
@@ -0,0 +1,48 @@
+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/volley/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/FormatTest.java
new file mode 100644
index 00000000000..3f362afc925
--- /dev/null
+++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/FormatTest.java
@@ -0,0 +1,179 @@
+package io.swagger.client.model;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import io.swagger.annotations.*;
+import com.google.gson.annotations.SerializedName;
+
+
+@ApiModel(description = "")
+public class FormatTest {
+
+ @SerializedName("integer")
+ private Integer integer = null;
+ @SerializedName("int32")
+ private Integer int32 = null;
+ @SerializedName("int64")
+ private Long int64 = null;
+ @SerializedName("number")
+ private BigDecimal number = null;
+ @SerializedName("float")
+ private Float _float = null;
+ @SerializedName("double")
+ private Double _double = null;
+ @SerializedName("string")
+ private String string = null;
+ @SerializedName("byte")
+ private byte[] _byte = null;
+ @SerializedName("binary")
+ private byte[] binary = null;
+ @SerializedName("date")
+ private Date date = null;
+ @SerializedName("dateTime")
+ private Date dateTime = null;
+ @SerializedName("password")
+ private String password = null;
+
+ /**
+ **/
+ @ApiModelProperty(value = "")
+ public Integer getInteger() {
+ return integer;
+ }
+ public void setInteger(Integer integer) {
+ this.integer = integer;
+ }
+
+ /**
+ **/
+ @ApiModelProperty(value = "")
+ public Integer getInt32() {
+ return int32;
+ }
+ public void setInt32(Integer int32) {
+ this.int32 = int32;
+ }
+
+ /**
+ **/
+ @ApiModelProperty(value = "")
+ public Long getInt64() {
+ return int64;
+ }
+ public void setInt64(Long int64) {
+ this.int64 = int64;
+ }
+
+ /**
+ **/
+ @ApiModelProperty(required = true, value = "")
+ public BigDecimal getNumber() {
+ return number;
+ }
+ public void setNumber(BigDecimal number) {
+ this.number = number;
+ }
+
+ /**
+ **/
+ @ApiModelProperty(value = "")
+ public Float getFloat() {
+ return _float;
+ }
+ public void setFloat(Float _float) {
+ this._float = _float;
+ }
+
+ /**
+ **/
+ @ApiModelProperty(value = "")
+ public Double getDouble() {
+ return _double;
+ }
+ public void setDouble(Double _double) {
+ this._double = _double;
+ }
+
+ /**
+ **/
+ @ApiModelProperty(value = "")
+ public String getString() {
+ return string;
+ }
+ public void setString(String string) {
+ this.string = string;
+ }
+
+ /**
+ **/
+ @ApiModelProperty(value = "")
+ public byte[] getByte() {
+ return _byte;
+ }
+ public void setByte(byte[] _byte) {
+ this._byte = _byte;
+ }
+
+ /**
+ **/
+ @ApiModelProperty(value = "")
+ public byte[] getBinary() {
+ return binary;
+ }
+ public void setBinary(byte[] binary) {
+ this.binary = binary;
+ }
+
+ /**
+ **/
+ @ApiModelProperty(value = "")
+ public Date getDate() {
+ return date;
+ }
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ /**
+ **/
+ @ApiModelProperty(value = "")
+ public Date getDateTime() {
+ return dateTime;
+ }
+ public void setDateTime(Date dateTime) {
+ this.dateTime = dateTime;
+ }
+
+ /**
+ **/
+ @ApiModelProperty(value = "")
+ public String getPassword() {
+ return password;
+ }
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("class FormatTest {\n");
+
+ sb.append(" integer: ").append(integer).append("\n");
+ sb.append(" int32: ").append(int32).append("\n");
+ sb.append(" int64: ").append(int64).append("\n");
+ sb.append(" number: ").append(number).append("\n");
+ sb.append(" _float: ").append(_float).append("\n");
+ sb.append(" _double: ").append(_double).append("\n");
+ sb.append(" string: ").append(string).append("\n");
+ sb.append(" _byte: ").append(_byte).append("\n");
+ sb.append(" binary: ").append(binary).append("\n");
+ sb.append(" date: ").append(date).append("\n");
+ sb.append(" dateTime: ").append(dateTime).append("\n");
+ sb.append(" password: ").append(password).append("\n");
+ sb.append("}\n");
+ return sb.toString();
+ }
+}
diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/InlineResponse200.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/InlineResponse200.java
index c4fd8ce357d..85b56f0e488 100644
--- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/InlineResponse200.java
+++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/InlineResponse200.java
@@ -10,34 +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;
}
-
/**
**/
@ApiModelProperty(required = true, value = "")
@@ -48,7 +56,6 @@ public class InlineResponse200 {
this.id = id;
}
-
/**
**/
@ApiModelProperty(value = "")
@@ -59,7 +66,16 @@ public class InlineResponse200 {
this.category = category;
}
-
+ /**
+ **/
+ @ApiModelProperty(value = "")
+ public List getTags() {
+ return tags;
+ }
+ public void setTags(List tags) {
+ this.tags = tags;
+ }
+
/**
* pet status in the store
**/
@@ -71,41 +87,18 @@ public class InlineResponse200 {
this.status = status;
}
-
- /**
- **/
- @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/volley/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Model200Response.java
index 4a6e58b2a5e..31664d1e6cf 100644
--- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Model200Response.java
+++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Model200Response.java
@@ -5,13 +5,15 @@ 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")
private Integer name = null;
-
/**
**/
@ApiModelProperty(value = "")
@@ -22,7 +24,6 @@ public class Model200Response {
this.name = name;
}
-
@Override
public String toString() {
diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/ModelReturn.java
index 24763f3acb4..f0b0802096f 100644
--- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/ModelReturn.java
+++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/ModelReturn.java
@@ -5,13 +5,15 @@ 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")
private Integer _return = null;
-
/**
**/
@ApiModelProperty(value = "")
@@ -22,7 +24,6 @@ public class ModelReturn {
this._return = _return;
}
-
@Override
public String toString() {
diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Name.java
index 9763aca7b34..d9f6153eb45 100644
--- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Name.java
+++ b/samples/client/petstore/android/volley/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")
@@ -13,10 +16,9 @@ public class Name {
@SerializedName("snake_case")
private Integer snakeCase = null;
-
/**
**/
- @ApiModelProperty(value = "")
+ @ApiModelProperty(required = true, value = "")
public Integer getName() {
return name;
}
@@ -24,7 +26,6 @@ public class Name {
this.name = name;
}
-
/**
**/
@ApiModelProperty(value = "")
@@ -35,7 +36,6 @@ public class Name {
this.snakeCase = snakeCase;
}
-
@Override
public String toString() {
diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Order.java
index f3f42db615c..be6f1b96db2 100644
--- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Order.java
+++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Order.java
@@ -25,7 +25,6 @@ public class Order {
@SerializedName("complete")
private Boolean complete = null;
-
/**
**/
@ApiModelProperty(value = "")
@@ -36,7 +35,6 @@ public class Order {
this.id = id;
}
-
/**
**/
@ApiModelProperty(value = "")
@@ -47,7 +45,6 @@ public class Order {
this.petId = petId;
}
-
/**
**/
@ApiModelProperty(value = "")
@@ -58,7 +55,6 @@ public class Order {
this.quantity = quantity;
}
-
/**
**/
@ApiModelProperty(value = "")
@@ -69,7 +65,6 @@ public class Order {
this.shipDate = shipDate;
}
-
/**
* Order Status
**/
@@ -81,7 +76,6 @@ public class Order {
this.status = status;
}
-
/**
**/
@ApiModelProperty(value = "")
@@ -92,7 +86,6 @@ public class Order {
this.complete = complete;
}
-
@Override
public String toString() {
diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Pet.java
index 20865ad5434..425b11a6ddc 100644
--- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Pet.java
+++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Pet.java
@@ -27,7 +27,6 @@ public class Pet {
@SerializedName("status")
private StatusEnum status = null;
-
/**
**/
@ApiModelProperty(value = "")
@@ -38,7 +37,6 @@ public class Pet {
this.id = id;
}
-
/**
**/
@ApiModelProperty(value = "")
@@ -49,7 +47,6 @@ public class Pet {
this.category = category;
}
-
/**
**/
@ApiModelProperty(required = true, value = "")
@@ -60,7 +57,6 @@ public class Pet {
this.name = name;
}
-
/**
**/
@ApiModelProperty(required = true, value = "")
@@ -71,7 +67,6 @@ public class Pet {
this.photoUrls = photoUrls;
}
-
/**
**/
@ApiModelProperty(value = "")
@@ -82,7 +77,6 @@ public class Pet {
this.tags = tags;
}
-
/**
* pet status in the store
**/
@@ -94,7 +88,6 @@ public class Pet {
this.status = status;
}
-
@Override
public String toString() {
diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/SpecialModelName.java
index d804bdd8765..78aae71a5c5 100644
--- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/SpecialModelName.java
+++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/SpecialModelName.java
@@ -11,7 +11,6 @@ public class SpecialModelName {
@SerializedName("$special[property.name]")
private Long specialPropertyName = null;
-
/**
**/
@ApiModelProperty(value = "")
@@ -22,7 +21,6 @@ public class SpecialModelName {
this.specialPropertyName = specialPropertyName;
}
-
@Override
public String toString() {
diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Tag.java
index 7c9651b1ba8..2d21e6240db 100644
--- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Tag.java
+++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Tag.java
@@ -13,7 +13,6 @@ public class Tag {
@SerializedName("name")
private String name = null;
-
/**
**/
@ApiModelProperty(value = "")
@@ -24,7 +23,6 @@ public class Tag {
this.id = id;
}
-
/**
**/
@ApiModelProperty(value = "")
@@ -35,7 +33,6 @@ public class Tag {
this.name = name;
}
-
@Override
public String toString() {
diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/User.java
index dc022697eb0..d2b89faec07 100644
--- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/User.java
+++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/User.java
@@ -25,7 +25,6 @@ public class User {
@SerializedName("userStatus")
private Integer userStatus = null;
-
/**
**/
@ApiModelProperty(value = "")
@@ -36,7 +35,6 @@ public class User {
this.id = id;
}
-
/**
**/
@ApiModelProperty(value = "")
@@ -47,7 +45,6 @@ public class User {
this.username = username;
}
-
/**
**/
@ApiModelProperty(value = "")
@@ -58,7 +55,6 @@ public class User {
this.firstName = firstName;
}
-
/**
**/
@ApiModelProperty(value = "")
@@ -69,7 +65,6 @@ public class User {
this.lastName = lastName;
}
-
/**
**/
@ApiModelProperty(value = "")
@@ -80,7 +75,6 @@ public class User {
this.email = email;
}
-
/**
**/
@ApiModelProperty(value = "")
@@ -91,7 +85,6 @@ public class User {
this.password = password;
}
-
/**
**/
@ApiModelProperty(value = "")
@@ -102,7 +95,6 @@ public class User {
this.phone = phone;
}
-
/**
* User Status
**/
@@ -114,7 +106,6 @@ public class User {
this.userStatus = userStatus;
}
-
@Override
public String toString() {
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/PetApi.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/PetApi.cs
index b09b31264c3..2a513818a31 100644
--- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/PetApi.cs
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/PetApi.cs
@@ -1,5 +1,4 @@
using System;
-using System.IO;
using System.Collections.Generic;
using RestSharp;
using IO.Swagger.Client;
@@ -7,57 +6,17 @@ using IO.Swagger.Model;
namespace IO.Swagger.Api
{
-
///
/// Represents a collection of functions to interact with the API endpoints
///
public interface IPetApi
{
-
- ///
- /// Update an existing pet
- ///
- /// Pet object that needs to be added to the store
- ///
- void UpdatePet (Pet body);
-
///
/// Add a new pet to the store
///
/// Pet object that needs to be added to the store
///
void AddPet (Pet body);
-
- ///
- /// Finds Pets by status Multiple status values can be provided with comma seperated strings
- ///
- /// Status values that need to be considered for filter
- /// List<Pet>
- List FindPetsByStatus (List status);
-
- ///
- /// Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
- ///
- /// Tags to filter by
- /// List<Pet>
- List FindPetsByTags (List tags);
-
- ///
- /// Find pet by ID Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
- ///
- /// ID of pet that needs to be fetched
- /// Pet
- Pet GetPetById (long? petId);
-
- ///
- /// Updates a pet in the store with form data
- ///
- /// ID of pet that needs to be updated
- /// Updated name of the pet
- /// Updated status of the pet
- ///
- void UpdatePetWithForm (string petId, string name, string status);
-
///
/// Deletes a pet
///
@@ -65,16 +24,46 @@ namespace IO.Swagger.Api
///
///
void DeletePet (long? petId, string apiKey);
-
+ ///
+ /// Finds Pets by status Multiple status values can be provided with comma separated strings
+ ///
+ /// Status values that need to be considered for filter
+ /// List<Pet>
+ List FindPetsByStatus (List status);
+ ///
+ /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+ ///
+ /// Tags to filter by
+ /// List<Pet>
+ List FindPetsByTags (List tags);
+ ///
+ /// Find pet by ID Returns a single pet
+ ///
+ /// ID of pet to return
+ /// Pet
+ Pet GetPetById (long? petId);
+ ///
+ /// Update an existing pet
+ ///
+ /// Pet object that needs to be added to the store
+ ///
+ void UpdatePet (Pet body);
+ ///
+ /// Updates a pet in the store with form data
+ ///
+ /// ID of pet that needs to be updated
+ /// Updated name of the pet
+ /// Updated status of the pet
+ ///
+ void UpdatePetWithForm (long? petId, string name, string status);
///
/// uploads an image
///
/// ID of pet to update
/// Additional data to pass to server
/// file to upload
- ///
- void UploadFile (long? petId, string additionalMetadata, Stream file);
-
+ /// ApiResponse
+ ApiResponse UploadFile (long? petId, string additionalMetadata, System.IO.Stream file);
}
///
@@ -130,47 +119,6 @@ namespace IO.Swagger.Api
/// An instance of the ApiClient
public ApiClient ApiClient {get; set;}
-
- ///
- /// Update an existing pet
- ///
- /// Pet object that needs to be added to the store
- ///
- public void UpdatePet (Pet body)
- {
-
-
- var path = "/pet";
- path = path.Replace("{format}", "json");
-
-
- var queryParams = new Dictionary();
- var headerParams = new Dictionary();
- var formParams = new Dictionary();
- var fileParams = new Dictionary();
- String postBody = null;
-
-
-
-
- postBody = ApiClient.Serialize(body); // http body (model) parameter
-
-
- // authentication setting, if any
- String[] authSettings = new String[] { "petstore_auth" };
-
- // make the HTTP request
- IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
-
- if (((int)response.StatusCode) >= 400)
- throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.Content, response.Content);
- else if (((int)response.StatusCode) == 0)
- throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.ErrorMessage, response.ErrorMessage);
-
- return;
- }
-
-
///
/// Add a new pet to the store
///
@@ -179,22 +127,20 @@ namespace IO.Swagger.Api
public void AddPet (Pet body)
{
+ // verify the required parameter 'body' is set
+ if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling AddPet");
+
var path = "/pet";
path = path.Replace("{format}", "json");
-
-
+
var queryParams = new Dictionary();
var headerParams = new Dictionary();
var formParams = new Dictionary();
var fileParams = new Dictionary();
String postBody = null;
-
-
-
- postBody = ApiClient.Serialize(body); // http body (model) parameter
-
+ postBody = ApiClient.Serialize(body); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
@@ -210,177 +156,6 @@ namespace IO.Swagger.Api
return;
}
-
- ///
- /// Finds Pets by status Multiple status values can be provided with comma seperated strings
- ///
- /// Status values that need to be considered for filter
- /// List<Pet>
- public List FindPetsByStatus (List status)
- {
-
-
- var path = "/pet/findByStatus";
- path = path.Replace("{format}", "json");
-
-
- var queryParams = new Dictionary();
- var headerParams = new Dictionary();
- var formParams = new Dictionary();
- var fileParams = new Dictionary();
- String postBody = null;
-
- if (status != null) queryParams.Add("status", ApiClient.ParameterToString(status)); // query parameter
-
-
-
-
-
- // authentication setting, if any
- String[] authSettings = new String[] { "petstore_auth" };
-
- // make the HTTP request
- IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
-
- if (((int)response.StatusCode) >= 400)
- throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.Content, response.Content);
- else if (((int)response.StatusCode) == 0)
- throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.ErrorMessage, response.ErrorMessage);
-
- return (List) ApiClient.Deserialize(response.Content, typeof(List), response.Headers);
- }
-
-
- ///
- /// Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
- ///
- /// Tags to filter by
- /// List<Pet>
- public List FindPetsByTags (List tags)
- {
-
-
- var path = "/pet/findByTags";
- path = path.Replace("{format}", "json");
-
-
- var queryParams = new Dictionary();
- var headerParams = new Dictionary();
- var formParams = new Dictionary();
- var fileParams = new Dictionary();
- String postBody = null;
-
- if (tags != null) queryParams.Add("tags", ApiClient.ParameterToString(tags)); // query parameter
-
-
-
-
-
- // authentication setting, if any
- String[] authSettings = new String[] { "petstore_auth" };
-
- // make the HTTP request
- IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
-
- if (((int)response.StatusCode) >= 400)
- throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.Content, response.Content);
- else if (((int)response.StatusCode) == 0)
- throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.ErrorMessage, response.ErrorMessage);
-
- return (List) ApiClient.Deserialize(response.Content, typeof(List), response.Headers);
- }
-
-
- ///
- /// Find pet by ID Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
- ///
- /// ID of pet that needs to be fetched
- /// Pet
- public Pet GetPetById (long? petId)
- {
-
- // verify the required parameter 'petId' is set
- if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling GetPetById");
-
-
- var path = "/pet/{petId}";
- path = path.Replace("{format}", "json");
- path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId));
-
-
- var queryParams = new Dictionary();
- var headerParams = new Dictionary();
- var formParams = new Dictionary();
- var fileParams = new Dictionary();
- String postBody = null;
-
-
-
-
-
-
- // authentication setting, if any
- String[] authSettings = new String[] { "api_key" };
-
- // make the HTTP request
- IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
-
- if (((int)response.StatusCode) >= 400)
- throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.Content, response.Content);
- else if (((int)response.StatusCode) == 0)
- throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.ErrorMessage, response.ErrorMessage);
-
- return (Pet) ApiClient.Deserialize(response.Content, typeof(Pet), response.Headers);
- }
-
-
- ///
- /// Updates a pet in the store with form data
- ///
- /// ID of pet that needs to be updated
- /// Updated name of the pet
- /// Updated status of the pet
- ///
- public void UpdatePetWithForm (string petId, string name, string status)
- {
-
- // verify the required parameter 'petId' is set
- if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling UpdatePetWithForm");
-
-
- var path = "/pet/{petId}";
- path = path.Replace("{format}", "json");
- path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId));
-
-
- var queryParams = new Dictionary();
- var headerParams = new Dictionary();
- var formParams = new Dictionary();
- var fileParams = new Dictionary();
- String postBody = null;
-
-
-
- if (name != null) formParams.Add("name", ApiClient.ParameterToString(name)); // form parameter
- if (status != null) formParams.Add("status", ApiClient.ParameterToString(status)); // form parameter
-
-
-
- // authentication setting, if any
- String[] authSettings = new String[] { "petstore_auth" };
-
- // make the HTTP request
- IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
-
- if (((int)response.StatusCode) >= 400)
- throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.Content, response.Content);
- else if (((int)response.StatusCode) == 0)
- throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.ErrorMessage, response.ErrorMessage);
-
- return;
- }
-
-
///
/// Deletes a pet
///
@@ -397,7 +172,6 @@ namespace IO.Swagger.Api
var path = "/pet/{petId}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId));
-
var queryParams = new Dictionary();
var headerParams = new Dictionary();
@@ -405,12 +179,8 @@ namespace IO.Swagger.Api
var fileParams = new Dictionary();
String postBody = null;
-
- if (apiKey != null) headerParams.Add("api_key", ApiClient.ParameterToString(apiKey)); // header parameter
-
-
-
-
+ if (apiKey != null) headerParams.Add("api_key", ApiClient.ParameterToString(apiKey)); // header parameter
+
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
@@ -425,15 +195,203 @@ namespace IO.Swagger.Api
return;
}
-
+ ///
+ /// Finds Pets by status Multiple status values can be provided with comma separated strings
+ ///
+ /// Status values that need to be considered for filter
+ /// List<Pet>
+ public List FindPetsByStatus (List status)
+ {
+
+ // verify the required parameter 'status' is set
+ if (status == null) throw new ApiException(400, "Missing required parameter 'status' when calling FindPetsByStatus");
+
+
+ var path = "/pet/findByStatus";
+ path = path.Replace("{format}", "json");
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+ if (status != null) queryParams.Add("status", ApiClient.ParameterToString(status)); // query parameter
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { "petstore_auth" };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.ErrorMessage, response.ErrorMessage);
+
+ return (List) ApiClient.Deserialize(response.Content, typeof(List), response.Headers);
+ }
+
+ ///
+ /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+ ///
+ /// Tags to filter by
+ /// List<Pet>
+ public List FindPetsByTags (List tags)
+ {
+
+ // verify the required parameter 'tags' is set
+ if (tags == null) throw new ApiException(400, "Missing required parameter 'tags' when calling FindPetsByTags");
+
+
+ var path = "/pet/findByTags";
+ path = path.Replace("{format}", "json");
+
+ var queryParams = new Dictionary();
+ var headerParams = new Dictionary();
+ var formParams = new Dictionary();
+ var fileParams = new Dictionary();
+ String postBody = null;
+
+ if (tags != null) queryParams.Add("tags", ApiClient.ParameterToString(tags)); // query parameter
+
+ // authentication setting, if any
+ String[] authSettings = new String[] { "petstore_auth" };
+
+ // make the HTTP request
+ IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
+
+ if (((int)response.StatusCode) >= 400)
+ throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.Content, response.Content);
+ else if (((int)response.StatusCode) == 0)
+ throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.ErrorMessage, response.ErrorMessage);
+
+ return (List