diff --git a/README.md b/README.md
index b49bf4994ffe..3fccbaff1f02 100644
--- a/README.md
+++ b/README.md
@@ -799,6 +799,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
- [Plexxi](http://www.plexxi.com)
- [Pixoneye](http://www.pixoneye.com/)
- [PostAffiliatePro](https://www.postaffiliatepro.com/)
+- [Prill Tecnologia](http://www.prill.com.br)
- [QAdept](http://qadept.com/)
- [QuantiModo](https://quantimo.do/)
- [Rapid7](https://rapid7.com/)
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/examples/ExampleGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/examples/ExampleGenerator.java
index 228e5afb90de..26a4422f071b 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/examples/ExampleGenerator.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/examples/ExampleGenerator.java
@@ -93,7 +93,7 @@ public class ExampleGenerator {
};
}
} else if (property instanceof DateProperty) {
- return "2000-01-23T04:56:07.000+00:00";
+ return "2000-01-23";
} else if (property instanceof DateTimeProperty) {
return "2000-01-23T04:56:07.000+00:00";
} else if (property instanceof DecimalProperty) {
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/examples/XmlExampleGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/examples/XmlExampleGenerator.java
index 3b7700115e18..ed9ab1233547 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/examples/XmlExampleGenerator.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/examples/XmlExampleGenerator.java
@@ -180,7 +180,7 @@ public class XmlExampleGenerator {
if (property.getExample() != null) {
return property.getExample().toString();
} else {
- return "2000-01-23T04:56:07.000Z";
+ return "2000-01-23";
}
} else if (property instanceof IntegerProperty) {
if (property.getExample() != null) {
diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java
index 5f08cebcdf9d..4fb1660db46b 100644
--- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java
+++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AndroidClientCodegen.java
@@ -390,7 +390,6 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
// need to put back serializableModel (boolean) into additionalProperties as value in additionalProperties is string
additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, serializableModel);
- LOGGER.info("CodegenConstants.SERIALIZABLE_MODEL = " + additionalProperties.get(CodegenConstants.SERIALIZABLE_MODEL));
//make api and model doc path available in mustache template
additionalProperties.put( "apiDocPath", apiDocPath );
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 9537b7abc2c5..dbcf9d70613f 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
@@ -21,6 +21,9 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege
protected String packageVersion = "1.0.0";
protected String clientPackage = "IO.Swagger.Client";
protected String sourceFolder = "src" + File.separator + "main" + File.separator + "CsharpDotNet2";
+ protected String apiDocPath = "docs/";
+ protected String modelDocPath = "docs/";
+
public CsharpDotNet2ClientCodegen() {
super();
@@ -35,6 +38,8 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege
embeddedTemplateDir = templateDir = "CsharpDotNet2";
apiPackage = "IO.Swagger.Api";
modelPackage = "IO.Swagger.Model";
+ modelDocTemplateFiles.put("model_doc.mustache", ".md");
+ apiDocTemplateFiles.put("api_doc.mustache", ".md");
setReservedWordsLowerCase(
Arrays.asList(
@@ -122,6 +127,9 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege
additionalProperties.put(CLIENT_PACKAGE, clientPackage);
}
+ additionalProperties.put("apiDocPath", apiDocPath);
+ additionalProperties.put("modelDocPath", modelDocPath);
+
supportingFiles.add(new SupportingFile("Configuration.mustache",
sourceFolder + File.separator + clientPackage.replace(".", java.io.File.separator), "Configuration.cs"));
supportingFiles.add(new SupportingFile("ApiClient.mustache",
@@ -130,7 +138,7 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege
sourceFolder + File.separator + clientPackage.replace(".", java.io.File.separator), "ApiException.cs"));
supportingFiles.add(new SupportingFile("packages.config.mustache", "vendor", "packages.config"));
supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "compile-mono.sh"));
- supportingFiles.add(new SupportingFile("README.md", "", "README.md"));
+ supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
}
@@ -292,4 +300,14 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege
return input.replace("*/", "*_/").replace("/*", "/_*");
}
+ @Override
+ public String apiDocFileFolder() {
+ return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar);
+ }
+
+ @Override
+ public String modelDocFileFolder() {
+ return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar);
+ }
+
}
diff --git a/modules/swagger-codegen/src/main/resources/CsharpDotNet2/README.md b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/README.md
deleted file mode 100644
index 5fe03fcb316f..000000000000
--- a/modules/swagger-codegen/src/main/resources/CsharpDotNet2/README.md
+++ /dev/null
@@ -1,10 +0,0 @@
-# Csharp-DotNet2
-
-This generator creates C# code targeting the .Net 2.0 framework. The resulting DLLs can be used in places where .Net 2.0 is the maximum supported version, such as in the Unity3d.
-
-## Dependencies
-- Mono compiler
-- Note: NuGet is downloaded by the mono compilation script and packages are installed with it. No dependency DLLs are bundled with this generator.
-
-
-
diff --git a/modules/swagger-codegen/src/main/resources/CsharpDotNet2/README.mustache b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/README.mustache
new file mode 100644
index 000000000000..6056d800a240
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/README.mustache
@@ -0,0 +1,153 @@
+# {{packageName}} - the C# library for the {{appName}}
+
+{{#appDescription}}
+{{{appDescription}}}
+{{/appDescription}}
+
+This C# SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
+
+- API version: {{appVersion}}
+- SDK version: {{packageVersion}}
+{{^hideGenerationTimestamp}}
+- Build date: {{generatedDate}}
+{{/hideGenerationTimestamp}}
+- Build package: {{generatorClass}}
+{{#infoUrl}}
+ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
+{{/infoUrl}}
+
+
+## Frameworks supported
+{{^supportUWP}}
+- .NET 2.0
+{{/supportUWP}}
+{{#supportUWP}}
+- UWP
+{{/supportUWP}}
+
+
+## Dependencies
+- Mono compiler
+- Newtonsoft.Json.7.0.1
+- RestSharp.Net2.1.1.11
+
+Note: NuGet is downloaded by the mono compilation script and packages are installed with it. No dependency DLLs are bundled with this generator
+
+
+## Installation
+Run the following command to generate the DLL
+- [Mac/Linux] `/bin/sh compile-mono.sh`
+- [Windows] TODO
+
+Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces:
+```csharp
+using {{packageName}}.{{apiPackage}};
+using {{packageName}}.Client;
+using {{packageName}}.{{modelPackage}};
+```
+
+## Getting Started
+
+```csharp
+using System;
+using System.Diagnostics;
+using {{apiPackage}};
+using {{packageName}}.Client;
+using {{modelPackage}};
+
+namespace Example
+{
+ public class {{operationId}}Example
+ {
+ public void main()
+ {
+ {{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
+ // Configure HTTP basic authorization: {{{name}}}
+ Configuration.Default.Username = "YOUR_USERNAME";
+ Configuration.Default.Password = "YOUR_PASSWORD";{{/isBasic}}{{#isApiKey}}
+ // Configure API key authorization: {{{name}}}
+ Configuration.Default.ApiKey.Add("{{{keyParamName}}}", "YOUR_API_KEY");
+ // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
+ // Configuration.Default.ApiKeyPrefix.Add("{{{keyParamName}}}", "Bearer");{{/isApiKey}}{{#isOAuth}}
+ // Configure OAuth2 access token for authorization: {{{name}}}
+ Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";{{/isOAuth}}{{/authMethods}}
+ {{/hasAuthMethods}}
+
+ var apiInstance = new {{classname}}();
+ {{#allParams}}
+ {{#isPrimitiveType}}
+ var {{paramName}} = {{example}}; // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
+ {{/isPrimitiveType}}
+ {{^isPrimitiveType}}
+ var {{paramName}} = new {{{dataType}}}(); // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
+ {{/isPrimitiveType}}
+ {{/allParams}}
+
+ try
+ {
+ {{#summary}}
+ // {{{.}}}
+ {{/summary}}
+ {{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
+ Debug.WriteLine(result);{{/returnType}}
+ }
+ catch (Exception e)
+ {
+ Debug.Print("Exception when calling {{classname}}.{{operationId}}: " + e.Message );
+ }
+ }
+ }
+}{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
+```
+
+
+## Documentation for API Endpoints
+
+All URIs are relative to *{{{basePath}}}*
+
+Class | Method | HTTP request | Description
+------------ | ------------- | ------------- | -------------
+{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}}
+{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
+
+
+## Documentation for Models
+
+{{#modelPackage}}
+{{#models}}{{#model}} - [{{{modelPackage}}}.{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
+{{/model}}{{/models}}
+{{/modelPackage}}
+{{^modelPackage}}
+No model defined in this package
+{{/modelPackage}}
+
+
+## Documentation for Authorization
+
+{{^authMethods}}
+All endpoints do not require authorization.
+{{/authMethods}}
+{{#authMethods}}
+{{#last}}
+Authentication schemes defined for the API:
+{{/last}}
+{{/authMethods}}
+{{#authMethods}}
+
+### {{name}}
+
+{{#isApiKey}}- **Type**: API key
+- **API key parameter name**: {{keyParamName}}
+- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
+{{/isApiKey}}
+{{#isBasic}}- **Type**: HTTP basic authentication
+{{/isBasic}}
+{{#isOAuth}}- **Type**: OAuth
+- **Flow**: {{flow}}
+- **Authorization URL**: {{authorizationUrl}}
+- **Scopes**: {{^scopes}}N/A{{/scopes}}
+{{#scopes}} - {{scope}}: {{description}}
+{{/scopes}}
+{{/isOAuth}}
+
+{{/authMethods}}
diff --git a/modules/swagger-codegen/src/main/resources/CsharpDotNet2/api_doc.mustache b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/api_doc.mustache
new file mode 100644
index 000000000000..c61043bf1ea1
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/api_doc.mustache
@@ -0,0 +1,97 @@
+# {{packageName}}.{{apiPackage}}.{{classname}}{{#description}}
+{{description}}{{/description}}
+
+All URIs are relative to *{{{basePath}}}*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
+{{/operation}}{{/operations}}
+
+{{#operations}}
+{{#operation}}
+
+# **{{{operationId}}}**
+> {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{operationId}} ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = null{{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
+
+{{{summary}}}{{#notes}}
+
+{{{notes}}}{{/notes}}
+
+### Example
+```csharp
+using System;
+using System.Diagnostics;
+using {{packageName}}.Api;
+using {{packageName}}.Client;
+using {{modelPackage}};
+
+namespace Example
+{
+ public class {{operationId}}Example
+ {
+ public void main()
+ {
+ {{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
+ // Configure HTTP basic authorization: {{{name}}}
+ Configuration.Default.Username = "YOUR_USERNAME";
+ Configuration.Default.Password = "YOUR_PASSWORD";{{/isBasic}}{{#isApiKey}}
+ // Configure API key authorization: {{{name}}}
+ Configuration.Default.ApiKey.Add("{{{keyParamName}}}", "YOUR_API_KEY");
+ // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
+ // Configuration.Default.ApiKeyPrefix.Add("{{{keyParamName}}}", "Bearer");{{/isApiKey}}{{#isOAuth}}
+ // Configure OAuth2 access token for authorization: {{{name}}}
+ Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";{{/isOAuth}}{{/authMethods}}
+ {{/hasAuthMethods}}
+
+ var apiInstance = new {{classname}}();
+ {{#allParams}}
+ {{#isPrimitiveType}}
+ var {{paramName}} = {{example}}; // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
+ {{/isPrimitiveType}}
+ {{^isPrimitiveType}}
+ var {{paramName}} = new {{{dataType}}}(); // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
+ {{/isPrimitiveType}}
+ {{/allParams}}
+
+ try
+ {
+ {{#summary}}
+ // {{{.}}}
+ {{/summary}}
+ {{#returnType}}{{returnType}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
+ Debug.WriteLine(result);{{/returnType}}
+ }
+ catch (Exception e)
+ {
+ Debug.Print("Exception when calling {{classname}}.{{operationId}}: " + e.Message );
+ }
+ }
+ }
+}
+```
+
+### Parameters
+{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
+{{#allParams}} **{{paramName}}** | {{#isFile}}**{{{dataType}}}**{{/isFile}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{{dataType}}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
+{{/allParams}}
+
+### Return type
+
+{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}}
+
+### Authorization
+
+{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}}
+
+### HTTP request headers
+
+ - **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
+ - **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+{{/operation}}
+{{/operations}}
diff --git a/modules/swagger-codegen/src/main/resources/CsharpDotNet2/model_doc.mustache b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/model_doc.mustache
new file mode 100644
index 000000000000..aff3e7e0d1e4
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/model_doc.mustache
@@ -0,0 +1,14 @@
+{{#models}}
+{{#model}}
+# {{{packageName}}}.Model.{{{classname}}}
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
+{{/vars}}
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+{{/model}}
+{{/models}}
diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/api.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/api.mustache
index 7fbcc9cea4d1..47062c394d2e 100644
--- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/api.mustache
+++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/api.mustache
@@ -37,7 +37,7 @@ public interface {{classname}} {
@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} })
{{/hasProduces}}
@ApiOperation(value = "{{summary}}", tags={ {{#vendorExtensions.x-tags}}"{{tag}}"{{#hasMore}}, {{/hasMore}}{{/vendorExtensions.x-tags}} })
- public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
+ public {{>returnTypes}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
{{/operation}}
}
{{/operations}}
diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/apiServiceImpl.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/apiServiceImpl.mustache
index ee5d82699555..70f5f4f37ded 100644
--- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/apiServiceImpl.mustache
+++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/apiServiceImpl.mustache
@@ -28,7 +28,7 @@ import org.springframework.stereotype.Service;
public class {{classname}}ServiceImpl implements {{classname}} {
{{#operations}}
{{#operation}}
- public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}} {{nickname}}({{#allParams}}{{>queryParamsImpl}}{{>pathParamsImpl}}{{>headerParamsImpl}}{{>bodyParams}}{{>formParamsImpl}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
+ public {{>returnTypes}} {{nickname}}({{#allParams}}{{>queryParamsImpl}}{{>pathParamsImpl}}{{>headerParamsImpl}}{{>bodyParams}}{{>formParamsImpl}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
// TODO: Implement...
{{^vendorExtensions.x-java-is-response-void}}return null;{{/vendorExtensions.x-java-is-response-void}}
diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/api_test.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/api_test.mustache
index 34308df43140..919e7d38206b 100644
--- a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/api_test.mustache
+++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/api_test.mustache
@@ -103,7 +103,7 @@ public class {{classname}}Test {
{{#allParams}}
{{^isFile}}{{{dataType}}} {{paramName}} = null;{{/isFile}}{{#isFile}}org.apache.cxf.jaxrs.ext.multipart.Attachment {{paramName}} = null;{{/isFile}}
{{/allParams}}
- //{{^vendorExtensions.x-java-is-response-void}}{{{returnType}}} response = {{/vendorExtensions.x-java-is-response-void}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
+ //{{^vendorExtensions.x-java-is-response-void}}{{>returnTypes}} response = {{/vendorExtensions.x-java-is-response-void}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
{{^vendorExtensions.x-java-is-response-void}}//assertNotNull(response);{{/vendorExtensions.x-java-is-response-void}}
// TODO: test validations
diff --git a/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/returnTypes.mustache b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/returnTypes.mustache
new file mode 100644
index 000000000000..c8f7a56938aa
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/JavaJaxRS/cxf/returnTypes.mustache
@@ -0,0 +1 @@
+{{#returnContainer}}{{#isMapContainer}}Map{{/isMapContainer}}{{#isListContainer}}List<{{{returnType}}}>{{/isListContainer}}{{/returnContainer}}{{^returnContainer}}{{{returnType}}}{{/returnContainer}}
\ No newline at end of file
diff --git a/modules/swagger-codegen/src/main/resources/android/enum_outer_doc.mustache b/modules/swagger-codegen/src/main/resources/android/enum_outer_doc.mustache
new file mode 100644
index 000000000000..20c512aaeae4
--- /dev/null
+++ b/modules/swagger-codegen/src/main/resources/android/enum_outer_doc.mustache
@@ -0,0 +1,7 @@
+# {{classname}}
+
+## Enum
+
+{{#allowableValues}}{{#enumVars}}
+* `{{name}}` (value: `{{{value}}}`)
+{{/enumVars}}{{/allowableValues}}
diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/Pair.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/Pair.mustache
index 60e15c94ed49..442f9c7a811b 100644
--- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/Pair.mustache
+++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/Pair.mustache
@@ -2,38 +2,38 @@
package {{invokerPackage}};
public class Pair {
- private String name = "";
- private String value = "";
+ private String name = "";
+ private String value = "";
- public Pair(String name, String value) {
- setName(name);
- setValue(value);
- }
+ public Pair(String name, String value) {
+ setName(name);
+ setValue(value);
+ }
- private void setName(String name) {
- if (!isValidString(name)) return;
+ private void setName(String name) {
+ if (!isValidString(name)) return;
- this.name = name;
- }
+ this.name = name;
+ }
- private void setValue(String value) {
- if (!isValidString(value)) return;
+ private void setValue(String value) {
+ if (!isValidString(value)) return;
- this.value = value;
- }
+ this.value = value;
+ }
- public String getName() {
- return this.name;
- }
+ public String getName() {
+ return this.name;
+ }
- public String getValue() {
- return this.value;
- }
+ public String getValue() {
+ return this.value;
+ }
- private boolean isValidString(String arg) {
- if (arg == null) return false;
- if (arg.trim().isEmpty()) return false;
+ private boolean isValidString(String arg) {
+ if (arg == null) return false;
+ if (arg.trim().isEmpty()) return false;
- return true;
- }
+ return true;
+ }
}
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 0d18ad5572e1..288408ab26c3 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
@@ -54,83 +54,89 @@ public class {{classname}} {
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
*/
public {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{nickname}} ({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
- Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
- {{#allParams}}{{#required}}
- // verify the required parameter '{{paramName}}' is set
- if ({{paramName}} == null) {
+ Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
+ {{#allParams}}
+ {{#required}}
+ // verify the required parameter '{{paramName}}' is set
+ if ({{paramName}} == null) {
VolleyError error = new VolleyError("Missing the required parameter '{{paramName}}' when calling {{nickname}}",
- new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{nickname}}"));
- }
- {{/required}}{{/allParams}}
+ new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{nickname}}"));
+ }
+ {{/required}}
+ {{/allParams}}
- // create path and map variables
- String path = "{{path}}".replaceAll("\\{format\\}","json"){{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}", apiInvoker.escapeString({{{paramName}}}.toString())){{/pathParams}};
+ // create path and map variables
+ String path = "{{path}}".replaceAll("\\{format\\}","json"){{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}", apiInvoker.escapeString({{{paramName}}}.toString())){{/pathParams}};
- // query params
- List queryParams = new ArrayList();
- // header params
- Map headerParams = new HashMap();
- // form params
- Map formParams = new HashMap();
+ // query params
+ List queryParams = new ArrayList();
+ // header params
+ Map headerParams = new HashMap();
+ // form params
+ Map formParams = new HashMap();
+ {{#queryParams}}
+ queryParams.addAll(ApiInvoker.parameterToPairs("{{#collectionFormat}}{{{collectionFormat}}}{{/collectionFormat}}", "{{baseName}}", {{paramName}}));
+ {{/queryParams}}
+ {{#headerParams}}
+ headerParams.put("{{baseName}}", ApiInvoker.parameterToString({{paramName}}));
+ {{/headerParams}}
+ String[] contentTypes = {
+ {{#consumes}}
+ "{{{mediaType}}}"{{#hasMore}},{{/hasMore}}
+ {{/consumes}}
+ };
+ String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
- {{#queryParams}}
- queryParams.addAll(ApiInvoker.parameterToPairs("{{#collectionFormat}}{{{collectionFormat}}}{{/collectionFormat}}", "{{baseName}}", {{paramName}}));
- {{/queryParams}}
-
- {{#headerParams}}
- headerParams.put("{{baseName}}", ApiInvoker.parameterToString({{paramName}}));
- {{/headerParams}}
-
- String[] contentTypes = {
- {{#consumes}}"{{{mediaType}}}"{{#hasMore}},{{/hasMore}}{{/consumes}}
- };
- String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
-
- if (contentType.startsWith("multipart/form-data")) {
+ if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
- {{#formParams}}{{#notFile}}
- if ({{paramName}} != null) {
- localVarBuilder.addTextBody("{{baseName}}", ApiInvoker.parameterToString({{paramName}}), ApiInvoker.TEXT_PLAIN_UTF8);
- }
- {{/notFile}}{{#isFile}}
- if ({{paramName}} != null) {
- localVarBuilder.addBinaryBody("{{baseName}}", {{paramName}});
- }
- {{/isFile}}{{/formParams}}
-
+ {{#formParams}}
+ {{^isFile}}
+ if ({{paramName}} != null) {
+ localVarBuilder.addTextBody("{{baseName}}", ApiInvoker.parameterToString({{paramName}}), ApiInvoker.TEXT_PLAIN_UTF8);
+ }
+ {{/isFile}}
+ {{#isFile}}
+ if ({{paramName}} != null) {
+ localVarBuilder.addBinaryBody("{{baseName}}", {{paramName}});
+ }
+ {{/isFile}}
+ {{/formParams}}
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
- } else {
+ } else {
// normal form params
- {{#formParams}}{{#notFile}}formParams.put("{{baseName}}", ApiInvoker.parameterToString({{paramName}}));{{/notFile}}
- {{/formParams}}
+ {{#formParams}}
+ {{^isFile}}
+ formParams.put("{{baseName}}", ApiInvoker.parameterToString({{paramName}}));
+ {{/isFile}}
+ {{/formParams}}
+ }
+
+ String[] authNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} };
+
+ try {
+ String localVarResponse = apiInvoker.invokeAPI (basePath, path, "{{httpMethod}}", queryParams, postBody, headerParams, formParams, contentType, authNames);
+ if (localVarResponse != null) {
+ return {{#returnType}}({{{returnType}}}) ApiInvoker.deserialize(localVarResponse, "{{returnContainer}}", {{returnBaseType}}.class){{/returnType}};
+ } else {
+ return {{#returnType}}null{{/returnType}};
}
-
- String[] authNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} };
-
- try {
- String localVarResponse = apiInvoker.invokeAPI (basePath, path, "{{httpMethod}}", queryParams, postBody, headerParams, formParams, contentType, authNames);
- if(localVarResponse != null){
- return {{#returnType}}({{{returnType}}}) ApiInvoker.deserialize(localVarResponse, "{{returnContainer}}", {{returnBaseType}}.class){{/returnType}};
- } else {
- return {{#returnType}}null{{/returnType}};
- }
- } catch (ApiException ex) {
- throw ex;
- } catch (InterruptedException ex) {
- throw ex;
- } catch (ExecutionException ex) {
- if(ex.getCause() instanceof VolleyError) {
- VolleyError volleyError = (VolleyError)ex.getCause();
- if (volleyError.networkResponse != null) {
- throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
- }
+ } catch (ApiException ex) {
+ throw ex;
+ } catch (InterruptedException ex) {
+ throw ex;
+ } catch (ExecutionException ex) {
+ if (ex.getCause() instanceof VolleyError) {
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
- throw ex;
- } catch (TimeoutException ex) {
- throw ex;
- }
+ }
+ throw ex;
+ } catch (TimeoutException ex) {
+ throw ex;
+ }
}
/**
diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/apiException.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/apiException.mustache
index 8d9da2fbe5d8..381af8fb4b04 100644
--- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/apiException.mustache
+++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/apiException.mustache
@@ -12,18 +12,38 @@ public class ApiException extends Exception {
this.message = message;
}
+ /**
+ * Get the HTTP status code.
+ *
+ * @return HTTP status code
+ */
public int getCode() {
return code;
}
+ /**
+ * Set the HTTP status code.
+ *
+ * @param code HTTP status code.
+ */
public void setCode(int code) {
this.code = code;
}
+ /**
+ * Get the error message.
+ *
+ * @return Error message.
+ */
public String getMessage() {
return message;
}
+ /**
+ * Set the error messages.
+ *
+ * @param message Error message.
+ */
public void setMessage(String message) {
this.message = message;
}
diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/apiInvoker.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/apiInvoker.mustache
index d57d8bb058f9..09e2b177fab9 100644
--- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/apiInvoker.mustache
+++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/apiInvoker.mustache
@@ -179,48 +179,48 @@ public class ApiInvoker {
}
public static void initializeInstance() {
- initializeInstance(null);
+ initializeInstance(null);
}
public static void initializeInstance(Cache cache) {
- initializeInstance(cache, null, 0, null, 30);
+ initializeInstance(cache, null, 0, null, 30);
}
public static void initializeInstance(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery, int connectionTimeout) {
- INSTANCE = new ApiInvoker(cache, network, threadPoolSize, delivery, connectionTimeout);
- setUserAgent("{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{artifactVersion}}}/android{{/httpUserAgent}}");
+ INSTANCE = new ApiInvoker(cache, network, threadPoolSize, delivery, connectionTimeout);
+ setUserAgent("{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{artifactVersion}}}/android{{/httpUserAgent}}");
- // Setup authentications (key: authentication name, value: authentication).
- INSTANCE.authentications = new HashMap();
- {{#authMethods}}
- {{#isApiKey}}
- INSTANCE.authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));
- {{/isApiKey}}
- {{#isBasic}}
- INSTANCE.authentications.put("{{name}}", new HttpBasicAuth());
- {{/isBasic}}
- {{#isOAuth}}
- // TODO: comment out below as OAuth does not exist
- //INSTANCE.authentications.put("{{name}}", new OAuth());
- {{/isOAuth}}
- {{/authMethods}}
- // Prevent the authentications from being modified.
- INSTANCE.authentications = Collections.unmodifiableMap(INSTANCE.authentications);
+ // Setup authentications (key: authentication name, value: authentication).
+ INSTANCE.authentications = new HashMap();
+ {{#authMethods}}
+ {{#isApiKey}}
+ INSTANCE.authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));
+ {{/isApiKey}}
+ {{#isBasic}}
+ INSTANCE.authentications.put("{{name}}", new HttpBasicAuth());
+ {{/isBasic}}
+ {{#isOAuth}}
+ // TODO: comment out below as OAuth does not exist
+ //INSTANCE.authentications.put("{{name}}", new OAuth());
+ {{/isOAuth}}
+ {{/authMethods}}
+ // Prevent the authentications from being modified.
+ INSTANCE.authentications = Collections.unmodifiableMap(INSTANCE.authentications);
}
private ApiInvoker(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery, int connectionTimeout) {
- if(cache == null) cache = new NoCache();
- if(network == null) {
- HttpStack stack = new HurlStack();
- network = new BasicNetwork(stack);
- }
+ if(cache == null) cache = new NoCache();
+ if(network == null) {
+ HttpStack stack = new HurlStack();
+ network = new BasicNetwork(stack);
+ }
- if(delivery == null) {
- initConnectionRequest(cache, network);
- } else {
- initConnectionRequest(cache, network, threadPoolSize, delivery);
- }
- this.connectionTimeout = connectionTimeout;
+ if(delivery == null) {
+ initConnectionRequest(cache, network);
+ } else {
+ initConnectionRequest(cache, network, threadPoolSize, delivery);
+ }
+ this.connectionTimeout = connectionTimeout;
}
public static ApiInvoker getInstance() {
@@ -273,25 +273,25 @@ public class ApiInvoker {
}
/**
- * Get authentications (key: authentication name, value: authentication).
- */
+ * Get authentications (key: authentication name, value: authentication).
+ */
public Map getAuthentications() {
return authentications;
}
/**
- * Get authentication for the given name.
- *
- * @param authName The authentication name
- * @return The authentication, null if not found
- */
+ * Get authentication for the given name.
+ *
+ * @param authName The authentication name
+ * @return The authentication, null if not found
+ */
public Authentication getAuthentication(String authName) {
return authentications.get(authName);
}
/**
- * Helper method to set username for the first HTTP basic authentication.
- */
+ * Helper method to set username for the first HTTP basic authentication.
+ */
public void setUsername(String username) {
for (Authentication auth : authentications.values()) {
if (auth instanceof HttpBasicAuth) {
@@ -303,21 +303,21 @@ public class ApiInvoker {
}
/**
- * Helper method to set password for the first HTTP basic authentication.
- */
+ * Helper method to set password for the first HTTP basic authentication.
+ */
public void setPassword(String password) {
- for (Authentication auth : authentications.values()) {
- if (auth instanceof HttpBasicAuth) {
- ((HttpBasicAuth) auth).setPassword(password);
- return;
- }
- }
- throw new RuntimeException("No HTTP basic authentication configured!");
+ for (Authentication auth : authentications.values()) {
+ if (auth instanceof HttpBasicAuth) {
+ ((HttpBasicAuth) auth).setPassword(password);
+ return;
+ }
+ }
+ throw new RuntimeException("No HTTP basic authentication configured!");
}
/**
- * Helper method to set API key value for the first API key authentication.
- */
+ * Helper method to set API key value for the first API key authentication.
+ */
public void setApiKey(String apiKey) {
for (Authentication auth : authentications.values()) {
if (auth instanceof ApiKeyAuth) {
@@ -329,8 +329,8 @@ public class ApiInvoker {
}
/**
- * Helper method to set API key prefix for the first API key authentication.
- */
+ * Helper method to set API key prefix for the first API key authentication.
+ */
public void setApiKeyPrefix(String apiKeyPrefix) {
for (Authentication auth : authentications.values()) {
if (auth instanceof ApiKeyAuth) {
@@ -342,18 +342,18 @@ public class ApiInvoker {
}
public void setConnectionTimeout(int connectionTimeout){
- this.connectionTimeout = connectionTimeout;
+ this.connectionTimeout = connectionTimeout;
}
public int getConnectionTimeout() {
- return connectionTimeout;
+ return connectionTimeout;
}
/**
- * Update query and header parameters based on authentication settings.
- *
- * @param authNames The authentications to apply
- */
+ * Update query and header parameters based on authentication settings.
+ *
+ * @param authNames The authentications to apply
+ */
private void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) {
for (String authName : authNames) {
Authentication auth = authentications.get(authName);
@@ -363,17 +363,21 @@ public class ApiInvoker {
}
public String invokeAPI(String host, String path, String method, List queryParams, Object body, Map headerParams, Map formParams, String contentType, String[] authNames) throws ApiException, InterruptedException, ExecutionException, TimeoutException {
- RequestFuture future = RequestFuture.newFuture();
- Request request = createRequest(host, path, method, queryParams, body, headerParams, formParams, contentType, authNames, future, future);
- if(request != null) {
- mRequestQueue.add(request);
- return future.get(connectionTimeout, TimeUnit.SECONDS);
- } else return "no data";
+ RequestFuture future = RequestFuture.newFuture();
+ Request request = createRequest(host, path, method, queryParams, body, headerParams, formParams, contentType, authNames, future, future);
+ if(request != null) {
+ mRequestQueue.add(request);
+ return future.get(connectionTimeout, TimeUnit.SECONDS);
+ } else {
+ return "no data";
+ }
}
public void invokeAPI(String host, String path, String method, List queryParams, Object body, Map headerParams, Map formParams, String contentType, String[] authNames, Response.Listener stringRequest, Response.ErrorListener errorListener) throws ApiException {
- Request request = createRequest(host, path, method, queryParams, body, headerParams, formParams, contentType, authNames, stringRequest, errorListener);
- if (request != null) mRequestQueue.add(request);
+ Request request = createRequest(host, path, method, queryParams, body, headerParams, formParams, contentType, authNames, stringRequest, errorListener);
+ if (request != null) {
+ mRequestQueue.add(request);
+ }
}
public Request createRequest(String host, String path, String method, List queryParams, Object body, Map headerParams, Map formParams, String contentType, String[] authNames, Response.Listener stringRequest, Response.ErrorListener errorListener) throws ApiException {
@@ -503,16 +507,16 @@ public class ApiInvoker {
}
private void initConnectionRequest(Cache cache, Network network) {
- mRequestQueue = new RequestQueue(cache, network);
- mRequestQueue.start();
+ mRequestQueue = new RequestQueue(cache, network);
+ mRequestQueue.start();
}
private void initConnectionRequest(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery) {
- mRequestQueue = new RequestQueue(cache, network, threadPoolSize, delivery);
- mRequestQueue.start();
+ mRequestQueue = new RequestQueue(cache, network, threadPoolSize, delivery);
+ mRequestQueue.start();
}
public void stopQueue() {
- mRequestQueue.stop();
+ mRequestQueue.stop();
}
}
diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/auth/apikeyauth.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/auth/apikeyauth.mustache
index 2208935ee42b..9f5c6dcbaa2c 100644
--- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/auth/apikeyauth.mustache
+++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/auth/apikeyauth.mustache
@@ -46,7 +46,7 @@ public class ApiKeyAuth implements Authentication {
public void applyToParams(List queryParams, Map headerParams) {
String value;
if (apiKey == null) {
- return;
+ return;
}
if (apiKeyPrefix != null) {
value = apiKeyPrefix + " " + apiKey;
diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/auth/httpbasicauth.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/auth/httpbasicauth.mustache
index 51017997ed41..f4f9a1a0bc09 100644
--- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/auth/httpbasicauth.mustache
+++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/auth/httpbasicauth.mustache
@@ -9,28 +9,28 @@ import java.util.Map;
import java.util.List;
public class HttpBasicAuth implements Authentication {
- private String username;
- private String password;
+ private String username;
+ private String password;
- public String getUsername() {
- return username;
- }
+ public String getUsername() {
+ return username;
+ }
- public void setUsername(String username) {
- this.username = username;
- }
+ public void setUsername(String username) {
+ this.username = username;
+ }
- public String getPassword() {
- return password;
- }
+ public String getPassword() {
+ return password;
+ }
- public void setPassword(String password) {
- this.password = password;
- }
+ public void setPassword(String password) {
+ this.password = password;
+ }
- @Override
- public void applyToParams(List queryParams, Map headerParams) {
- String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
- headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes(), Base64.DEFAULT));
- }
+ @Override
+ public void applyToParams(List queryParams, Map headerParams) {
+ String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
+ headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes(), Base64.DEFAULT));
+ }
}
diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/auth/oauth.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/auth/oauth.mustache
index 72b5e0baab89..1839e96bf08b 100644
--- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/auth/oauth.mustache
+++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/auth/oauth.mustache
@@ -7,8 +7,8 @@ import java.util.Map;
import java.util.List;
public class OAuth implements Authentication {
- @Override
- public void applyToParams(List queryParams, Map headerParams) {
- // TODO stub
- }
+ @Override
+ public void applyToParams(List queryParams, Map headerParams) {
+ // TODO stub
+ }
}
diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/request/deleterequest.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/request/deleterequest.mustache
index 7dcc613d0f00..90956e791dcf 100644
--- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/request/deleterequest.mustache
+++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/request/deleterequest.mustache
@@ -19,75 +19,75 @@ import java.util.Map;
public class DeleteRequest extends Request {
- HttpEntity entity;
+ HttpEntity entity;
- private final Response.Listener mListener;
+ private final Response.Listener mListener;
- String contentType;
- Map apiHeaders;
- public DeleteRequest(String url, Map apiHeaders, String contentType, HttpEntity entity, Response.Listener listener, Response.ErrorListener errorListener) {
- super(Method.DELETE, url, errorListener);
- mListener = listener;
- this.entity = entity;
- this.contentType = contentType;
- this.apiHeaders = apiHeaders;
+ String contentType;
+ Map apiHeaders;
+ public DeleteRequest(String url, Map apiHeaders, String contentType, HttpEntity entity, Response.Listener listener, Response.ErrorListener errorListener) {
+ super(Method.DELETE, url, errorListener);
+ mListener = listener;
+ this.entity = entity;
+ this.contentType = contentType;
+ this.apiHeaders = apiHeaders;
+ }
+
+ @Override
+ public String getBodyContentType() {
+ if(entity == null) {
+ return null;
+ }
+ return entity.getContentType().getValue();
+ }
+
+ @Override
+ public byte[] getBody() throws AuthFailureError {
+ if(entity == null) {
+ return null;
+ }
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ try {
+ entity.writeTo(bos);
+ }
+ catch (IOException e) {
+ VolleyLog.e("IOException writing to ByteArrayOutputStream");
+ }
+ return bos.toByteArray();
+ }
+
+ @Override
+ protected Response parseNetworkResponse(NetworkResponse response) {
+ String parsed;
+ try {
+ parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
+ } catch (UnsupportedEncodingException e) {
+ parsed = new String(response.data);
+ }
+ return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
+ }
+
+ @Override
+ protected void deliverResponse(String response) {
+ mListener.onResponse(response);
+ }
+
+ /* (non-Javadoc)
+ * @see com.android.volley.Request#getHeaders()
+ */
+ @Override
+ public Map getHeaders() throws AuthFailureError {
+ Map headers = super.getHeaders();
+ if (headers == null || headers.equals(Collections.emptyMap())) {
+ headers = new HashMap();
+ }
+ if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
+ headers.putAll(apiHeaders);
+ }
+ if(contentType != null) {
+ headers.put("Content-Type", contentType);
}
- @Override
- public String getBodyContentType() {
- if(entity == null) {
- return null;
- }
- return entity.getContentType().getValue();
- }
-
- @Override
- public byte[] getBody() throws AuthFailureError {
- if(entity == null) {
- return null;
- }
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- try {
- entity.writeTo(bos);
- }
- catch (IOException e) {
- VolleyLog.e("IOException writing to ByteArrayOutputStream");
- }
- return bos.toByteArray();
- }
-
- @Override
- protected Response parseNetworkResponse(NetworkResponse response) {
- String parsed;
- try {
- parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
- } catch (UnsupportedEncodingException e) {
- parsed = new String(response.data);
- }
- return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
- }
-
- @Override
- protected void deliverResponse(String response) {
- mListener.onResponse(response);
- }
-
- /* (non-Javadoc)
- * @see com.android.volley.Request#getHeaders()
- */
- @Override
- public Map getHeaders() throws AuthFailureError {
- Map headers = super.getHeaders();
- if (headers == null || headers.equals(Collections.emptyMap())) {
- headers = new HashMap();
- }
- if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
- headers.putAll(apiHeaders);
- }
- if(contentType != null) {
- headers.put("Content-Type", contentType);
- }
-
- return headers;
- }
+ return headers;
+ }
}
diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/request/patchrequest.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/request/patchrequest.mustache
index 5415ab602a24..b9a7fed67050 100644
--- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/request/patchrequest.mustache
+++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/request/patchrequest.mustache
@@ -19,75 +19,75 @@ import java.util.Map;
public class PatchRequest extends Request {
- HttpEntity entity;
+ HttpEntity entity;
- private final Response.Listener mListener;
+ private final Response.Listener mListener;
- String contentType;
- Map apiHeaders;
- public PatchRequest(String url, Map apiHeaders, String contentType, HttpEntity entity, Response.Listener listener, Response.ErrorListener errorListener) {
- super(Method.PATCH, url, errorListener);
- mListener = listener;
- this.entity = entity;
- this.contentType = contentType;
- this.apiHeaders = apiHeaders;
+ String contentType;
+ Map apiHeaders;
+ public PatchRequest(String url, Map apiHeaders, String contentType, HttpEntity entity, Response.Listener listener, Response.ErrorListener errorListener) {
+ super(Method.PATCH, url, errorListener);
+ mListener = listener;
+ this.entity = entity;
+ this.contentType = contentType;
+ this.apiHeaders = apiHeaders;
+ }
+
+ @Override
+ public String getBodyContentType() {
+ if(entity == null) {
+ return null;
+ }
+ return entity.getContentType().getValue();
+ }
+
+ @Override
+ public byte[] getBody() throws AuthFailureError {
+ if(entity == null) {
+ return null;
+ }
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ try {
+ entity.writeTo(bos);
+ }
+ catch (IOException e) {
+ VolleyLog.e("IOException writing to ByteArrayOutputStream");
+ }
+ return bos.toByteArray();
+ }
+
+ @Override
+ protected Response parseNetworkResponse(NetworkResponse response) {
+ String parsed;
+ try {
+ parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
+ } catch (UnsupportedEncodingException e) {
+ parsed = new String(response.data);
+ }
+ return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
+ }
+
+ @Override
+ protected void deliverResponse(String response) {
+ mListener.onResponse(response);
+ }
+
+ /* (non-Javadoc)
+ * @see com.android.volley.Request#getHeaders()
+ */
+ @Override
+ public Map getHeaders() throws AuthFailureError {
+ Map headers = super.getHeaders();
+ if (headers == null || headers.equals(Collections.emptyMap())) {
+ headers = new HashMap();
+ }
+ if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
+ headers.putAll(apiHeaders);
+ }
+ if(contentType != null) {
+ headers.put("Content-Type", contentType);
}
- @Override
- public String getBodyContentType() {
- if(entity == null) {
- return null;
- }
- return entity.getContentType().getValue();
- }
-
- @Override
- public byte[] getBody() throws AuthFailureError {
- if(entity == null) {
- return null;
- }
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- try {
- entity.writeTo(bos);
- }
- catch (IOException e) {
- VolleyLog.e("IOException writing to ByteArrayOutputStream");
- }
- return bos.toByteArray();
- }
-
- @Override
- protected Response parseNetworkResponse(NetworkResponse response) {
- String parsed;
- try {
- parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
- } catch (UnsupportedEncodingException e) {
- parsed = new String(response.data);
- }
- return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
- }
-
- @Override
- protected void deliverResponse(String response) {
- mListener.onResponse(response);
- }
-
- /* (non-Javadoc)
- * @see com.android.volley.Request#getHeaders()
- */
- @Override
- public Map getHeaders() throws AuthFailureError {
- Map headers = super.getHeaders();
- if (headers == null || headers.equals(Collections.emptyMap())) {
- headers = new HashMap();
- }
- if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
- headers.putAll(apiHeaders);
- }
- if(contentType != null) {
- headers.put("Content-Type", contentType);
- }
-
- return headers;
- }
+ return headers;
+ }
}
diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/request/postrequest.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/request/postrequest.mustache
index 183fe15b9b53..2349b51a3186 100644
--- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/request/postrequest.mustache
+++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/request/postrequest.mustache
@@ -19,75 +19,75 @@ import java.util.Map;
public class PostRequest extends Request {
- HttpEntity entity;
+ HttpEntity entity;
- private final Response.Listener mListener;
+ private final Response.Listener mListener;
- String contentType;
- Map apiHeaders;
- public PostRequest(String url, Map apiHeaders, String contentType, HttpEntity entity, Response.Listener listener, Response.ErrorListener errorListener) {
- super(Method.POST, url, errorListener);
- mListener = listener;
- this.entity = entity;
- this.contentType = contentType;
- this.apiHeaders = apiHeaders;
+ String contentType;
+ Map apiHeaders;
+ public PostRequest(String url, Map apiHeaders, String contentType, HttpEntity entity, Response.Listener listener, Response.ErrorListener errorListener) {
+ super(Method.POST, url, errorListener);
+ mListener = listener;
+ this.entity = entity;
+ this.contentType = contentType;
+ this.apiHeaders = apiHeaders;
+ }
+
+ @Override
+ public String getBodyContentType() {
+ if(entity == null) {
+ return null;
+ }
+ return entity.getContentType().getValue();
+ }
+
+ @Override
+ public byte[] getBody() throws AuthFailureError {
+ if(entity == null) {
+ return null;
+ }
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ try {
+ entity.writeTo(bos);
+ }
+ catch (IOException e) {
+ VolleyLog.e("IOException writing to ByteArrayOutputStream");
+ }
+ return bos.toByteArray();
+ }
+
+ @Override
+ protected Response parseNetworkResponse(NetworkResponse response) {
+ String parsed;
+ try {
+ parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
+ } catch (UnsupportedEncodingException e) {
+ parsed = new String(response.data);
+ }
+ return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
+ }
+
+ @Override
+ protected void deliverResponse(String response) {
+ mListener.onResponse(response);
+ }
+
+ /* (non-Javadoc)
+ * @see com.android.volley.Request#getHeaders()
+ */
+ @Override
+ public Map getHeaders() throws AuthFailureError {
+ Map headers = super.getHeaders();
+ if (headers == null || headers.equals(Collections.emptyMap())) {
+ headers = new HashMap();
+ }
+ if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
+ headers.putAll(apiHeaders);
+ }
+ if(contentType != null) {
+ headers.put("Content-Type", contentType);
}
- @Override
- public String getBodyContentType() {
- if(entity == null) {
- return null;
- }
- return entity.getContentType().getValue();
- }
-
- @Override
- public byte[] getBody() throws AuthFailureError {
- if(entity == null) {
- return null;
- }
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- try {
- entity.writeTo(bos);
- }
- catch (IOException e) {
- VolleyLog.e("IOException writing to ByteArrayOutputStream");
- }
- return bos.toByteArray();
- }
-
- @Override
- protected Response parseNetworkResponse(NetworkResponse response) {
- String parsed;
- try {
- parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
- } catch (UnsupportedEncodingException e) {
- parsed = new String(response.data);
- }
- return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
- }
-
- @Override
- protected void deliverResponse(String response) {
- mListener.onResponse(response);
- }
-
- /* (non-Javadoc)
- * @see com.android.volley.Request#getHeaders()
- */
- @Override
- public Map getHeaders() throws AuthFailureError {
- Map headers = super.getHeaders();
- if (headers == null || headers.equals(Collections.emptyMap())) {
- headers = new HashMap();
- }
- if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
- headers.putAll(apiHeaders);
- }
- if(contentType != null) {
- headers.put("Content-Type", contentType);
- }
-
- return headers;
- }
+ return headers;
+ }
}
diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/request/putrequest.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/request/putrequest.mustache
index 88cf2edce8ee..6773fb4da7f1 100644
--- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/request/putrequest.mustache
+++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/request/putrequest.mustache
@@ -19,75 +19,75 @@ import java.util.Map;
public class PutRequest extends Request {
- HttpEntity entity;
+ HttpEntity entity;
- private final Response.Listener mListener;
+ private final Response.Listener mListener;
- String contentType;
- Map apiHeaders;
- public PutRequest(String url, Map apiHeaders, String contentType, HttpEntity entity, Response.Listener listener, Response.ErrorListener errorListener) {
- super(Method.PUT, url, errorListener);
- mListener = listener;
- this.entity = entity;
- this.contentType = contentType;
- this.apiHeaders = apiHeaders;
+ String contentType;
+ Map apiHeaders;
+ public PutRequest(String url, Map apiHeaders, String contentType, HttpEntity entity, Response.Listener listener, Response.ErrorListener errorListener) {
+ super(Method.PUT, url, errorListener);
+ mListener = listener;
+ this.entity = entity;
+ this.contentType = contentType;
+ this.apiHeaders = apiHeaders;
+ }
+
+ @Override
+ public String getBodyContentType() {
+ if(entity == null) {
+ return null;
+ }
+ return entity.getContentType().getValue();
+ }
+
+ @Override
+ public byte[] getBody() throws AuthFailureError {
+ if(entity == null) {
+ return null;
+ }
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ try {
+ entity.writeTo(bos);
+ }
+ catch (IOException e) {
+ VolleyLog.e("IOException writing to ByteArrayOutputStream");
+ }
+ return bos.toByteArray();
+ }
+
+ @Override
+ protected Response parseNetworkResponse(NetworkResponse response) {
+ String parsed;
+ try {
+ parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
+ } catch (UnsupportedEncodingException e) {
+ parsed = new String(response.data);
+ }
+ return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
+ }
+
+ @Override
+ protected void deliverResponse(String response) {
+ mListener.onResponse(response);
+ }
+
+ /* (non-Javadoc)
+ * @see com.android.volley.Request#getHeaders()
+ */
+ @Override
+ public Map getHeaders() throws AuthFailureError {
+ Map headers = super.getHeaders();
+ if (headers == null || headers.equals(Collections.emptyMap())) {
+ headers = new HashMap();
+ }
+ if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
+ headers.putAll(apiHeaders);
+ }
+ if(contentType != null) {
+ headers.put("Content-Type", contentType);
}
- @Override
- public String getBodyContentType() {
- if(entity == null) {
- return null;
- }
- return entity.getContentType().getValue();
- }
-
- @Override
- public byte[] getBody() throws AuthFailureError {
- if(entity == null) {
- return null;
- }
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- try {
- entity.writeTo(bos);
- }
- catch (IOException e) {
- VolleyLog.e("IOException writing to ByteArrayOutputStream");
- }
- return bos.toByteArray();
- }
-
- @Override
- protected Response parseNetworkResponse(NetworkResponse response) {
- String parsed;
- try {
- parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
- } catch (UnsupportedEncodingException e) {
- parsed = new String(response.data);
- }
- return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
- }
-
- @Override
- protected void deliverResponse(String response) {
- mListener.onResponse(response);
- }
-
- /* (non-Javadoc)
- * @see com.android.volley.Request#getHeaders()
- */
- @Override
- public Map getHeaders() throws AuthFailureError {
- Map headers = super.getHeaders();
- if (headers == null || headers.equals(Collections.emptyMap())) {
- headers = new HashMap();
- }
- if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
- headers.putAll(apiHeaders);
- }
- if(contentType != null) {
- headers.put("Content-Type", contentType);
- }
-
- return headers;
- }
+ return headers;
+ }
}
diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/configuration.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/configuration.mustache
index dd8d4be97288..a566a180e4eb 100644
--- a/modules/swagger-codegen/src/main/resources/typescript-angular2/configuration.mustache
+++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/configuration.mustache
@@ -2,5 +2,5 @@ export class Configuration {
apiKey: string;
username: string;
password: string;
- accessToken: string | () => string;
+ accessToken: string | (() => string);
}
\ No newline at end of file
diff --git a/samples/client/petstore-security-test/typescript-angular2/configuration.ts b/samples/client/petstore-security-test/typescript-angular2/configuration.ts
index dd8d4be97288..a566a180e4eb 100644
--- a/samples/client/petstore-security-test/typescript-angular2/configuration.ts
+++ b/samples/client/petstore-security-test/typescript-angular2/configuration.ts
@@ -2,5 +2,5 @@ export class Configuration {
apiKey: string;
username: string;
password: string;
- accessToken: string | () => string;
+ accessToken: string | (() => string);
}
\ No newline at end of file
diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiException.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiException.java
index 60e7a3d92c9e..7ccb9a47f481 100644
--- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiException.java
+++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiException.java
@@ -23,18 +23,38 @@ public class ApiException extends Exception {
this.message = message;
}
+ /**
+ * Get the HTTP status code.
+ *
+ * @return HTTP status code
+ */
public int getCode() {
return code;
}
+ /**
+ * Set the HTTP status code.
+ *
+ * @param code HTTP status code.
+ */
public void setCode(int code) {
this.code = code;
}
+ /**
+ * Get the error message.
+ *
+ * @return Error message.
+ */
public String getMessage() {
return message;
}
+ /**
+ * Set the error messages.
+ *
+ * @param message Error message.
+ */
public void setMessage(String message) {
this.message = message;
}
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 e9a7d1b1624e..5791dbfd072d 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
@@ -190,39 +190,39 @@ public class ApiInvoker {
}
public static void initializeInstance() {
- initializeInstance(null);
+ initializeInstance(null);
}
public static void initializeInstance(Cache cache) {
- initializeInstance(cache, null, 0, null, 30);
+ initializeInstance(cache, null, 0, null, 30);
}
public static void initializeInstance(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery, int connectionTimeout) {
- INSTANCE = new ApiInvoker(cache, network, threadPoolSize, delivery, connectionTimeout);
- setUserAgent("Swagger-Codegen/1.0.0/android");
+ INSTANCE = new ApiInvoker(cache, network, threadPoolSize, delivery, connectionTimeout);
+ setUserAgent("Swagger-Codegen/1.0.0/android");
- // Setup authentications (key: authentication name, value: authentication).
- INSTANCE.authentications = new HashMap();
- INSTANCE.authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
- // TODO: comment out below as OAuth does not exist
- //INSTANCE.authentications.put("petstore_auth", new OAuth());
- // Prevent the authentications from being modified.
- INSTANCE.authentications = Collections.unmodifiableMap(INSTANCE.authentications);
+ // Setup authentications (key: authentication name, value: authentication).
+ INSTANCE.authentications = new HashMap();
+ INSTANCE.authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
+ // TODO: comment out below as OAuth does not exist
+ //INSTANCE.authentications.put("petstore_auth", new OAuth());
+ // Prevent the authentications from being modified.
+ INSTANCE.authentications = Collections.unmodifiableMap(INSTANCE.authentications);
}
private ApiInvoker(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery, int connectionTimeout) {
- if(cache == null) cache = new NoCache();
- if(network == null) {
- HttpStack stack = new HurlStack();
- network = new BasicNetwork(stack);
- }
+ if(cache == null) cache = new NoCache();
+ if(network == null) {
+ HttpStack stack = new HurlStack();
+ network = new BasicNetwork(stack);
+ }
- if(delivery == null) {
- initConnectionRequest(cache, network);
- } else {
- initConnectionRequest(cache, network, threadPoolSize, delivery);
- }
- this.connectionTimeout = connectionTimeout;
+ if(delivery == null) {
+ initConnectionRequest(cache, network);
+ } else {
+ initConnectionRequest(cache, network, threadPoolSize, delivery);
+ }
+ this.connectionTimeout = connectionTimeout;
}
public static ApiInvoker getInstance() {
@@ -275,25 +275,25 @@ public class ApiInvoker {
}
/**
- * Get authentications (key: authentication name, value: authentication).
- */
+ * Get authentications (key: authentication name, value: authentication).
+ */
public Map getAuthentications() {
return authentications;
}
/**
- * Get authentication for the given name.
- *
- * @param authName The authentication name
- * @return The authentication, null if not found
- */
+ * Get authentication for the given name.
+ *
+ * @param authName The authentication name
+ * @return The authentication, null if not found
+ */
public Authentication getAuthentication(String authName) {
return authentications.get(authName);
}
/**
- * Helper method to set username for the first HTTP basic authentication.
- */
+ * Helper method to set username for the first HTTP basic authentication.
+ */
public void setUsername(String username) {
for (Authentication auth : authentications.values()) {
if (auth instanceof HttpBasicAuth) {
@@ -305,21 +305,21 @@ public class ApiInvoker {
}
/**
- * Helper method to set password for the first HTTP basic authentication.
- */
+ * Helper method to set password for the first HTTP basic authentication.
+ */
public void setPassword(String password) {
- for (Authentication auth : authentications.values()) {
- if (auth instanceof HttpBasicAuth) {
- ((HttpBasicAuth) auth).setPassword(password);
- return;
- }
- }
- throw new RuntimeException("No HTTP basic authentication configured!");
+ for (Authentication auth : authentications.values()) {
+ if (auth instanceof HttpBasicAuth) {
+ ((HttpBasicAuth) auth).setPassword(password);
+ return;
+ }
+ }
+ throw new RuntimeException("No HTTP basic authentication configured!");
}
/**
- * Helper method to set API key value for the first API key authentication.
- */
+ * Helper method to set API key value for the first API key authentication.
+ */
public void setApiKey(String apiKey) {
for (Authentication auth : authentications.values()) {
if (auth instanceof ApiKeyAuth) {
@@ -331,8 +331,8 @@ public class ApiInvoker {
}
/**
- * Helper method to set API key prefix for the first API key authentication.
- */
+ * Helper method to set API key prefix for the first API key authentication.
+ */
public void setApiKeyPrefix(String apiKeyPrefix) {
for (Authentication auth : authentications.values()) {
if (auth instanceof ApiKeyAuth) {
@@ -344,18 +344,18 @@ public class ApiInvoker {
}
public void setConnectionTimeout(int connectionTimeout){
- this.connectionTimeout = connectionTimeout;
+ this.connectionTimeout = connectionTimeout;
}
public int getConnectionTimeout() {
- return connectionTimeout;
+ return connectionTimeout;
}
/**
- * Update query and header parameters based on authentication settings.
- *
- * @param authNames The authentications to apply
- */
+ * Update query and header parameters based on authentication settings.
+ *
+ * @param authNames The authentications to apply
+ */
private void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) {
for (String authName : authNames) {
Authentication auth = authentications.get(authName);
@@ -365,17 +365,21 @@ public class ApiInvoker {
}
public String invokeAPI(String host, String path, String method, List queryParams, Object body, Map headerParams, Map formParams, String contentType, String[] authNames) throws ApiException, InterruptedException, ExecutionException, TimeoutException {
- RequestFuture future = RequestFuture.newFuture();
- Request request = createRequest(host, path, method, queryParams, body, headerParams, formParams, contentType, authNames, future, future);
- if(request != null) {
- mRequestQueue.add(request);
- return future.get(connectionTimeout, TimeUnit.SECONDS);
- } else return "no data";
+ RequestFuture future = RequestFuture.newFuture();
+ Request request = createRequest(host, path, method, queryParams, body, headerParams, formParams, contentType, authNames, future, future);
+ if(request != null) {
+ mRequestQueue.add(request);
+ return future.get(connectionTimeout, TimeUnit.SECONDS);
+ } else {
+ return "no data";
+ }
}
public void invokeAPI(String host, String path, String method, List queryParams, Object body, Map headerParams, Map formParams, String contentType, String[] authNames, Response.Listener stringRequest, Response.ErrorListener errorListener) throws ApiException {
- Request request = createRequest(host, path, method, queryParams, body, headerParams, formParams, contentType, authNames, stringRequest, errorListener);
- if (request != null) mRequestQueue.add(request);
+ Request request = createRequest(host, path, method, queryParams, body, headerParams, formParams, contentType, authNames, stringRequest, errorListener);
+ if (request != null) {
+ mRequestQueue.add(request);
+ }
}
public Request createRequest(String host, String path, String method, List queryParams, Object body, Map headerParams, Map formParams, String contentType, String[] authNames, Response.Listener stringRequest, Response.ErrorListener errorListener) throws ApiException {
@@ -505,16 +509,16 @@ public class ApiInvoker {
}
private void initConnectionRequest(Cache cache, Network network) {
- mRequestQueue = new RequestQueue(cache, network);
- mRequestQueue.start();
+ mRequestQueue = new RequestQueue(cache, network);
+ mRequestQueue.start();
}
private void initConnectionRequest(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery) {
- mRequestQueue = new RequestQueue(cache, network, threadPoolSize, delivery);
- mRequestQueue.start();
+ mRequestQueue = new RequestQueue(cache, network, threadPoolSize, delivery);
+ mRequestQueue.start();
}
public void stopQueue() {
- mRequestQueue.stop();
+ mRequestQueue.stop();
}
}
diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/Pair.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/Pair.java
index d83f3053c713..df9d3f03908c 100644
--- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/Pair.java
+++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/Pair.java
@@ -13,38 +13,38 @@
package io.swagger.client;
public class Pair {
- private String name = "";
- private String value = "";
+ private String name = "";
+ private String value = "";
- public Pair(String name, String value) {
- setName(name);
- setValue(value);
- }
+ public Pair(String name, String value) {
+ setName(name);
+ setValue(value);
+ }
- private void setName(String name) {
- if (!isValidString(name)) return;
+ private void setName(String name) {
+ if (!isValidString(name)) return;
- this.name = name;
- }
+ this.name = name;
+ }
- private void setValue(String value) {
- if (!isValidString(value)) return;
+ private void setValue(String value) {
+ if (!isValidString(value)) return;
- this.value = value;
- }
+ this.value = value;
+ }
- public String getName() {
- return this.name;
- }
+ public String getName() {
+ return this.name;
+ }
- public String getValue() {
- return this.value;
- }
+ public String getValue() {
+ return this.value;
+ }
- private boolean isValidString(String arg) {
- if (arg == null) return false;
- if (arg.trim().isEmpty()) return false;
+ private boolean isValidString(String arg) {
+ if (arg == null) return false;
+ if (arg.trim().isEmpty()) return false;
- return true;
- }
+ return true;
+ }
}
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 02291b27fd24..644a15c5da30 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
@@ -63,61 +63,56 @@ public class PetApi {
* @return void
*/
public void addPet (Pet body) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
- Object postBody = body;
-
+ Object postBody = body;
- // create path and map variables
- String path = "/pet".replaceAll("\\{format\\}","json");
+ // create path and map variables
+ String path = "/pet".replaceAll("\\{format\\}","json");
- // query params
- List queryParams = new ArrayList();
- // header params
- Map headerParams = new HashMap();
- // form params
- Map formParams = new HashMap();
+ // query params
+ List queryParams = new ArrayList();
+ // header params
+ Map headerParams = new HashMap();
+ // form params
+ Map formParams = new HashMap();
+ String[] contentTypes = {
+ "application/json",
+ "application/xml"
+ };
+ String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
-
-
- String[] contentTypes = {
- "application/json","application/xml"
- };
- String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
-
- if (contentType.startsWith("multipart/form-data")) {
+ if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
-
-
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
- } else {
+ } else {
// normal form params
- }
+ }
- String[] authNames = new String[] { "petstore_auth" };
+ String[] authNames = new String[] { "petstore_auth" };
- try {
- String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
- if(localVarResponse != null){
- return ;
- } else {
- return ;
- }
- } catch (ApiException ex) {
- throw ex;
- } catch (InterruptedException ex) {
- throw ex;
- } catch (ExecutionException ex) {
- if(ex.getCause() instanceof VolleyError) {
- VolleyError volleyError = (VolleyError)ex.getCause();
- if (volleyError.networkResponse != null) {
- throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
- }
- }
- throw ex;
- } catch (TimeoutException ex) {
- throw ex;
+ try {
+ String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
+ if (localVarResponse != null) {
+ return ;
+ } else {
+ return ;
}
+ } catch (ApiException ex) {
+ throw ex;
+ } catch (InterruptedException ex) {
+ throw ex;
+ } catch (ExecutionException ex) {
+ if (ex.getCause() instanceof VolleyError) {
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
+ }
+ throw ex;
+ } catch (TimeoutException ex) {
+ throw ex;
+ }
}
/**
@@ -185,68 +180,60 @@ public class PetApi {
* @return void
*/
public void deletePet (Long petId, String apiKey) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
- Object postBody = null;
-
- // verify the required parameter 'petId' is set
- if (petId == null) {
+ Object postBody = null;
+ // verify the required parameter 'petId' is set
+ if (petId == null) {
VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling deletePet",
- new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"));
- }
-
+ new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"));
+ }
- // create path and map variables
- String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
+ // create path and map variables
+ String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
- // query params
- List queryParams = new ArrayList();
- // header params
- Map headerParams = new HashMap();
- // form params
- Map formParams = new HashMap();
+ // query params
+ List queryParams = new ArrayList();
+ // header params
+ Map headerParams = new HashMap();
+ // form params
+ Map formParams = new HashMap();
+ headerParams.put("api_key", ApiInvoker.parameterToString(apiKey));
+ String[] contentTypes = {
+ };
+ String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
-
- headerParams.put("api_key", ApiInvoker.parameterToString(apiKey));
-
- String[] contentTypes = {
-
- };
- String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
-
- if (contentType.startsWith("multipart/form-data")) {
+ if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
-
-
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
- } else {
+ } else {
// normal form params
- }
+ }
- String[] authNames = new String[] { "petstore_auth" };
+ String[] authNames = new String[] { "petstore_auth" };
- try {
- String localVarResponse = apiInvoker.invokeAPI (basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames);
- if(localVarResponse != null){
- return ;
- } else {
- return ;
- }
- } catch (ApiException ex) {
- throw ex;
- } catch (InterruptedException ex) {
- throw ex;
- } catch (ExecutionException ex) {
- if(ex.getCause() instanceof VolleyError) {
- VolleyError volleyError = (VolleyError)ex.getCause();
- if (volleyError.networkResponse != null) {
- throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
- }
- }
- throw ex;
- } catch (TimeoutException ex) {
- throw ex;
+ try {
+ String localVarResponse = apiInvoker.invokeAPI (basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames);
+ if (localVarResponse != null) {
+ return ;
+ } else {
+ return ;
}
+ } catch (ApiException ex) {
+ throw ex;
+ } catch (InterruptedException ex) {
+ throw ex;
+ } catch (ExecutionException ex) {
+ if (ex.getCause() instanceof VolleyError) {
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
+ }
+ throw ex;
+ } catch (TimeoutException ex) {
+ throw ex;
+ }
}
/**
@@ -320,62 +307,55 @@ public class PetApi {
* @return List
*/
public List findPetsByStatus (List status) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
- Object postBody = null;
-
+ Object postBody = null;
- // create path and map variables
- String path = "/pet/findByStatus".replaceAll("\\{format\\}","json");
+ // create path and map variables
+ String path = "/pet/findByStatus".replaceAll("\\{format\\}","json");
- // query params
- List queryParams = new ArrayList();
- // header params
- Map headerParams = new HashMap();
- // form params
- Map formParams = new HashMap();
+ // query params
+ List queryParams = new ArrayList();
+ // header params
+ Map headerParams = new HashMap();
+ // form params
+ Map formParams = new HashMap();
+ queryParams.addAll(ApiInvoker.parameterToPairs("multi", "status", status));
+ String[] contentTypes = {
+ };
+ String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
- queryParams.addAll(ApiInvoker.parameterToPairs("multi", "status", status));
-
-
- String[] contentTypes = {
-
- };
- String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
-
- if (contentType.startsWith("multipart/form-data")) {
+ if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
-
-
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
- } else {
+ } else {
// normal form params
- }
+ }
- String[] authNames = new String[] { "petstore_auth" };
+ String[] authNames = new String[] { "petstore_auth" };
- try {
- String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
- if(localVarResponse != null){
- return (List) ApiInvoker.deserialize(localVarResponse, "array", Pet.class);
- } else {
- return null;
- }
- } catch (ApiException ex) {
- throw ex;
- } catch (InterruptedException ex) {
- throw ex;
- } catch (ExecutionException ex) {
- if(ex.getCause() instanceof VolleyError) {
- VolleyError volleyError = (VolleyError)ex.getCause();
- if (volleyError.networkResponse != null) {
- throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
- }
- }
- throw ex;
- } catch (TimeoutException ex) {
- throw ex;
+ try {
+ String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
+ if (localVarResponse != null) {
+ return (List) ApiInvoker.deserialize(localVarResponse, "array", Pet.class);
+ } else {
+ return null;
}
+ } catch (ApiException ex) {
+ throw ex;
+ } catch (InterruptedException ex) {
+ throw ex;
+ } catch (ExecutionException ex) {
+ if (ex.getCause() instanceof VolleyError) {
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
+ }
+ throw ex;
+ } catch (TimeoutException ex) {
+ throw ex;
+ }
}
/**
@@ -447,62 +427,55 @@ public class PetApi {
* @return List
*/
public List findPetsByTags (List tags) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
- Object postBody = null;
-
+ Object postBody = null;
- // create path and map variables
- String path = "/pet/findByTags".replaceAll("\\{format\\}","json");
+ // create path and map variables
+ String path = "/pet/findByTags".replaceAll("\\{format\\}","json");
- // query params
- List queryParams = new ArrayList();
- // header params
- Map headerParams = new HashMap();
- // form params
- Map formParams = new HashMap();
+ // query params
+ List queryParams = new ArrayList();
+ // header params
+ Map headerParams = new HashMap();
+ // form params
+ Map formParams = new HashMap();
+ queryParams.addAll(ApiInvoker.parameterToPairs("multi", "tags", tags));
+ String[] contentTypes = {
+ };
+ String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
- queryParams.addAll(ApiInvoker.parameterToPairs("multi", "tags", tags));
-
-
- String[] contentTypes = {
-
- };
- String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
-
- if (contentType.startsWith("multipart/form-data")) {
+ if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
-
-
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
- } else {
+ } else {
// normal form params
- }
+ }
- String[] authNames = new String[] { "petstore_auth" };
+ String[] authNames = new String[] { "petstore_auth" };
- try {
- String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
- if(localVarResponse != null){
- return (List) ApiInvoker.deserialize(localVarResponse, "array", Pet.class);
- } else {
- return null;
- }
- } catch (ApiException ex) {
- throw ex;
- } catch (InterruptedException ex) {
- throw ex;
- } catch (ExecutionException ex) {
- if(ex.getCause() instanceof VolleyError) {
- VolleyError volleyError = (VolleyError)ex.getCause();
- if (volleyError.networkResponse != null) {
- throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
- }
- }
- throw ex;
- } catch (TimeoutException ex) {
- throw ex;
+ try {
+ String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
+ if (localVarResponse != null) {
+ return (List) ApiInvoker.deserialize(localVarResponse, "array", Pet.class);
+ } else {
+ return null;
}
+ } catch (ApiException ex) {
+ throw ex;
+ } catch (InterruptedException ex) {
+ throw ex;
+ } catch (ExecutionException ex) {
+ if (ex.getCause() instanceof VolleyError) {
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
+ }
+ throw ex;
+ } catch (TimeoutException ex) {
+ throw ex;
+ }
}
/**
@@ -574,67 +547,59 @@ public class PetApi {
* @return Pet
*/
public Pet getPetById (Long petId) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
- Object postBody = null;
-
- // verify the required parameter 'petId' is set
- if (petId == null) {
+ Object postBody = null;
+ // verify the required parameter 'petId' is set
+ if (petId == null) {
VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling getPetById",
- new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"));
- }
-
+ new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"));
+ }
- // create path and map variables
- String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
+ // create path and map variables
+ String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
- // query params
- List queryParams = new ArrayList();
- // header params
- Map headerParams = new HashMap();
- // form params
- Map formParams = new HashMap();
+ // query params
+ List queryParams = new ArrayList();
+ // header params
+ Map headerParams = new HashMap();
+ // form params
+ Map formParams = new HashMap();
+ String[] contentTypes = {
+ };
+ String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
-
-
- String[] contentTypes = {
-
- };
- String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
-
- if (contentType.startsWith("multipart/form-data")) {
+ if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
-
-
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
- } else {
+ } else {
// normal form params
- }
+ }
- String[] authNames = new String[] { "api_key", "petstore_auth" };
+ String[] authNames = new String[] { "api_key", "petstore_auth" };
- try {
- String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
- if(localVarResponse != null){
- return (Pet) ApiInvoker.deserialize(localVarResponse, "", Pet.class);
- } else {
- return null;
- }
- } catch (ApiException ex) {
- throw ex;
- } catch (InterruptedException ex) {
- throw ex;
- } catch (ExecutionException ex) {
- if(ex.getCause() instanceof VolleyError) {
- VolleyError volleyError = (VolleyError)ex.getCause();
- if (volleyError.networkResponse != null) {
- throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
- }
- }
- throw ex;
- } catch (TimeoutException ex) {
- throw ex;
+ try {
+ String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
+ if (localVarResponse != null) {
+ return (Pet) ApiInvoker.deserialize(localVarResponse, "", Pet.class);
+ } else {
+ return null;
}
+ } catch (ApiException ex) {
+ throw ex;
+ } catch (InterruptedException ex) {
+ throw ex;
+ } catch (ExecutionException ex) {
+ if (ex.getCause() instanceof VolleyError) {
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
+ }
+ throw ex;
+ } catch (TimeoutException ex) {
+ throw ex;
+ }
}
/**
@@ -711,61 +676,56 @@ public class PetApi {
* @return void
*/
public void updatePet (Pet body) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
- Object postBody = body;
-
+ Object postBody = body;
- // create path and map variables
- String path = "/pet".replaceAll("\\{format\\}","json");
+ // create path and map variables
+ String path = "/pet".replaceAll("\\{format\\}","json");
- // query params
- List queryParams = new ArrayList();
- // header params
- Map headerParams = new HashMap();
- // form params
- Map formParams = new HashMap();
+ // query params
+ List queryParams = new ArrayList();
+ // header params
+ Map headerParams = new HashMap();
+ // form params
+ Map formParams = new HashMap();
+ String[] contentTypes = {
+ "application/json",
+ "application/xml"
+ };
+ String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
-
-
- String[] contentTypes = {
- "application/json","application/xml"
- };
- String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
-
- if (contentType.startsWith("multipart/form-data")) {
+ if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
-
-
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
- } else {
+ } else {
// normal form params
- }
+ }
- String[] authNames = new String[] { "petstore_auth" };
+ String[] authNames = new String[] { "petstore_auth" };
- try {
- String localVarResponse = apiInvoker.invokeAPI (basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType, authNames);
- if(localVarResponse != null){
- return ;
- } else {
- return ;
- }
- } catch (ApiException ex) {
- throw ex;
- } catch (InterruptedException ex) {
- throw ex;
- } catch (ExecutionException ex) {
- if(ex.getCause() instanceof VolleyError) {
- VolleyError volleyError = (VolleyError)ex.getCause();
- if (volleyError.networkResponse != null) {
- throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
- }
- }
- throw ex;
- } catch (TimeoutException ex) {
- throw ex;
+ try {
+ String localVarResponse = apiInvoker.invokeAPI (basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType, authNames);
+ if (localVarResponse != null) {
+ return ;
+ } else {
+ return ;
}
+ } catch (ApiException ex) {
+ throw ex;
+ } catch (InterruptedException ex) {
+ throw ex;
+ } catch (ExecutionException ex) {
+ if (ex.getCause() instanceof VolleyError) {
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
+ }
+ throw ex;
+ } catch (TimeoutException ex) {
+ throw ex;
+ }
}
/**
@@ -834,77 +794,68 @@ public class PetApi {
* @return void
*/
public void updatePetWithForm (String petId, String name, String status) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
- Object postBody = null;
-
- // verify the required parameter 'petId' is set
- if (petId == null) {
+ Object postBody = null;
+ // verify the required parameter 'petId' is set
+ if (petId == null) {
VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling updatePetWithForm",
- new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"));
- }
-
+ new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"));
+ }
- // create path and map variables
- String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
+ // create path and map variables
+ String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
- // query params
- List queryParams = new ArrayList();
- // header params
- Map headerParams = new HashMap();
- // form params
- Map formParams = new HashMap();
+ // query params
+ List queryParams = new ArrayList();
+ // header params
+ Map headerParams = new HashMap();
+ // form params
+ Map formParams = new HashMap();
+ String[] contentTypes = {
+ "application/x-www-form-urlencoded"
+ };
+ String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
-
-
- String[] contentTypes = {
- "application/x-www-form-urlencoded"
- };
- String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
-
- if (contentType.startsWith("multipart/form-data")) {
+ if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
-
- if (name != null) {
- localVarBuilder.addTextBody("name", ApiInvoker.parameterToString(name), ApiInvoker.TEXT_PLAIN_UTF8);
- }
-
- if (status != null) {
- localVarBuilder.addTextBody("status", ApiInvoker.parameterToString(status), ApiInvoker.TEXT_PLAIN_UTF8);
- }
-
-
+ if (name != null) {
+ localVarBuilder.addTextBody("name", ApiInvoker.parameterToString(name), ApiInvoker.TEXT_PLAIN_UTF8);
+ }
+ if (status != null) {
+ localVarBuilder.addTextBody("status", ApiInvoker.parameterToString(status), ApiInvoker.TEXT_PLAIN_UTF8);
+ }
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
- } else {
+ } else {
// normal form params
- formParams.put("name", ApiInvoker.parameterToString(name));
-formParams.put("status", ApiInvoker.parameterToString(status));
+ formParams.put("name", ApiInvoker.parameterToString(name));
+ formParams.put("status", ApiInvoker.parameterToString(status));
+ }
+
+ String[] authNames = new String[] { "petstore_auth" };
+
+ try {
+ String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
+ if (localVarResponse != null) {
+ return ;
+ } else {
+ return ;
}
-
- String[] authNames = new String[] { "petstore_auth" };
-
- try {
- String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
- if(localVarResponse != null){
- return ;
- } else {
- return ;
- }
- } catch (ApiException ex) {
- throw ex;
- } catch (InterruptedException ex) {
- throw ex;
- } catch (ExecutionException ex) {
- if(ex.getCause() instanceof VolleyError) {
- VolleyError volleyError = (VolleyError)ex.getCause();
- if (volleyError.networkResponse != null) {
- throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
- }
+ } catch (ApiException ex) {
+ throw ex;
+ } catch (InterruptedException ex) {
+ throw ex;
+ } catch (ExecutionException ex) {
+ if (ex.getCause() instanceof VolleyError) {
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
- throw ex;
- } catch (TimeoutException ex) {
- throw ex;
- }
+ }
+ throw ex;
+ } catch (TimeoutException ex) {
+ throw ex;
+ }
}
/**
@@ -989,77 +940,67 @@ formParams.put("status", ApiInvoker.parameterToString(status));
* @return void
*/
public void uploadFile (Long petId, String additionalMetadata, File file) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
- Object postBody = null;
-
- // verify the required parameter 'petId' is set
- if (petId == null) {
+ Object postBody = null;
+ // verify the required parameter 'petId' is set
+ if (petId == null) {
VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling uploadFile",
- new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"));
- }
-
+ new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"));
+ }
- // create path and map variables
- String path = "/pet/{petId}/uploadImage".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
+ // create path and map variables
+ String path = "/pet/{petId}/uploadImage".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
- // query params
- List queryParams = new ArrayList();
- // header params
- Map headerParams = new HashMap();
- // form params
- Map formParams = new HashMap();
+ // query params
+ List queryParams = new ArrayList();
+ // header params
+ Map headerParams = new HashMap();
+ // form params
+ Map formParams = new HashMap();
+ String[] contentTypes = {
+ "multipart/form-data"
+ };
+ String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
-
-
- String[] contentTypes = {
- "multipart/form-data"
- };
- String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
-
- if (contentType.startsWith("multipart/form-data")) {
+ if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
-
- if (additionalMetadata != null) {
- localVarBuilder.addTextBody("additionalMetadata", ApiInvoker.parameterToString(additionalMetadata), ApiInvoker.TEXT_PLAIN_UTF8);
- }
-
- if (file != null) {
- localVarBuilder.addBinaryBody("file", file);
- }
-
-
+ if (additionalMetadata != null) {
+ localVarBuilder.addTextBody("additionalMetadata", ApiInvoker.parameterToString(additionalMetadata), ApiInvoker.TEXT_PLAIN_UTF8);
+ }
+ if (file != null) {
+ localVarBuilder.addBinaryBody("file", file);
+ }
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
- } else {
+ } else {
// normal form params
- formParams.put("additionalMetadata", ApiInvoker.parameterToString(additionalMetadata));
+ formParams.put("additionalMetadata", ApiInvoker.parameterToString(additionalMetadata));
+ }
+ String[] authNames = new String[] { "petstore_auth" };
+
+ try {
+ String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
+ if (localVarResponse != null) {
+ return ;
+ } else {
+ return ;
}
-
- String[] authNames = new String[] { "petstore_auth" };
-
- try {
- String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
- if(localVarResponse != null){
- return ;
- } else {
- return ;
- }
- } catch (ApiException ex) {
- throw ex;
- } catch (InterruptedException ex) {
- throw ex;
- } catch (ExecutionException ex) {
- if(ex.getCause() instanceof VolleyError) {
- VolleyError volleyError = (VolleyError)ex.getCause();
- if (volleyError.networkResponse != null) {
- throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
- }
+ } catch (ApiException ex) {
+ throw ex;
+ } catch (InterruptedException ex) {
+ throw ex;
+ } catch (ExecutionException ex) {
+ if (ex.getCause() instanceof VolleyError) {
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
- throw ex;
- } catch (TimeoutException ex) {
- throw ex;
- }
+ }
+ throw ex;
+ } catch (TimeoutException ex) {
+ throw 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 bc3646d399ae..1aac5e84fa5e 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
@@ -63,67 +63,59 @@ public class StoreApi {
* @return void
*/
public void deleteOrder (String orderId) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
- Object postBody = null;
-
- // verify the required parameter 'orderId' is set
- if (orderId == null) {
+ Object postBody = null;
+ // verify the required parameter 'orderId' is set
+ if (orderId == null) {
VolleyError error = new VolleyError("Missing the required parameter 'orderId' when calling deleteOrder",
- new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"));
- }
-
+ new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"));
+ }
- // create path and map variables
- String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString()));
+ // create path and map variables
+ String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString()));
- // query params
- List queryParams = new ArrayList();
- // header params
- Map headerParams = new HashMap();
- // form params
- Map formParams = new HashMap();
+ // query params
+ List queryParams = new ArrayList();
+ // header params
+ Map headerParams = new HashMap();
+ // form params
+ Map formParams = new HashMap();
+ String[] contentTypes = {
+ };
+ String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
-
-
- String[] contentTypes = {
-
- };
- String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
-
- if (contentType.startsWith("multipart/form-data")) {
+ if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
-
-
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
- } else {
+ } else {
// normal form params
- }
+ }
- String[] authNames = new String[] { };
+ String[] authNames = new String[] { };
- try {
- String localVarResponse = apiInvoker.invokeAPI (basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames);
- if(localVarResponse != null){
- return ;
- } else {
- return ;
- }
- } catch (ApiException ex) {
- throw ex;
- } catch (InterruptedException ex) {
- throw ex;
- } catch (ExecutionException ex) {
- if(ex.getCause() instanceof VolleyError) {
- VolleyError volleyError = (VolleyError)ex.getCause();
- if (volleyError.networkResponse != null) {
- throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
- }
- }
- throw ex;
- } catch (TimeoutException ex) {
- throw ex;
+ try {
+ String localVarResponse = apiInvoker.invokeAPI (basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames);
+ if (localVarResponse != null) {
+ return ;
+ } else {
+ return ;
}
+ } catch (ApiException ex) {
+ throw ex;
+ } catch (InterruptedException ex) {
+ throw ex;
+ } catch (ExecutionException ex) {
+ if (ex.getCause() instanceof VolleyError) {
+ VolleyError volleyError = (VolleyError)ex.getCause();
+ if (volleyError.networkResponse != null) {
+ throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
+ }
+ }
+ throw ex;
+ } catch (TimeoutException ex) {
+ throw ex;
+ }
}
/**
@@ -195,61 +187,54 @@ public class StoreApi {
* @return Map
*/
public Map getInventory () throws TimeoutException, ExecutionException, InterruptedException, ApiException {
- Object postBody = null;
-
+ Object postBody = null;
- // create path and map variables
- String path = "/store/inventory".replaceAll("\\{format\\}","json");
+ // create path and map variables
+ String path = "/store/inventory".replaceAll("\\{format\\}","json");
- // query params
- List queryParams = new ArrayList();
- // header params
- Map headerParams = new HashMap();
- // form params
- Map formParams = new HashMap