com.google.code.gson
gson
@@ -133,7 +138,7 @@
1.5.0
- 2.4.0
+ 2.7.2
2.3.1
1.0.0
4.8.1
diff --git a/modules/swagger-codegen/src/main/resources/Java/pojo.mustache b/modules/swagger-codegen/src/main/resources/Java/pojo.mustache
index eea33d346d4..0bc15c0ecb0 100644
--- a/modules/swagger-codegen/src/main/resources/Java/pojo.mustache
+++ b/modules/swagger-codegen/src/main/resources/Java/pojo.mustache
@@ -27,22 +27,23 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
{{/vars}}
@Override
- public boolean equals(Object o) {
+ public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
- {{classname}} {{classVarName}} = ({{classname}}) o;{{#hasVars}}
- return {{#vars}}Objects.equals({{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
- {{/hasMore}}{{^hasMore}};{{/hasMore}}{{/vars}}{{/hasVars}}{{^hasVars}}
- return true;{{/hasVars}}
+ {{classname}} {{classVarName}} = ({{classname}}) o;
+
+ return true {{#hasVars}}&& {{#vars}}Objects.equals({{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
+ {{/hasMore}}{{/vars}}{{/hasVars}}
+ {{#parent}}&& super.equals(o){{/parent}};
}
@Override
public int hashCode() {
- return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}});
+ return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}},{{/hasVars}} super.hashCode(){{/parent}});
}
@Override
@@ -59,7 +60,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
- private String toIndentedString(Object o) {
+ private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
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 ccd12fd67c5..1d70000c1dc 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
@@ -1,6 +1,5 @@
package {{package}};
-import {{invokerPackage}}.Responses;
import {{invokerPackage}}.ApiInvoker;
import {{invokerPackage}}.ApiException;
import {{invokerPackage}}.Pair;
@@ -50,7 +49,7 @@ public class {{classname}} {
{{#allParams}} * @param {{paramName}} {{description}}
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
*/
- public void {{nickname}} ({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{^hasMore}}, {{/hasMore}}{{/allParams}}final {{#returnBaseType}}Responses.{{returnBaseType}}{{#isListContainer}}List{{/isListContainer}}Response{{/returnBaseType}}{{^returnBaseType}}Responses.StringResponse{{/returnBaseType}} responseListener, final Response.ErrorListener errorListener) {
+ public void {{nickname}} ({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{^hasMore}}, {{/hasMore}}{{/allParams}}final Response.Listener<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}String{{/returnType}}> responseListener, final Response.ErrorListener errorListener) {
Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
{{#allParams}}{{#required}}
diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/build.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/build.mustache
index ec599632fd8..87d7f4a882c 100644
--- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/build.mustache
+++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/build.mustache
@@ -28,11 +28,11 @@ apply plugin: 'com.github.dcendents.android-maven'
{{/useAndroidMavenGradlePlugin}}
android {
- compileSdkVersion 22
- buildToolsVersion '22.0.0'
+ compileSdkVersion 23
+ buildToolsVersion '23.0.2'
defaultConfig {
minSdkVersion 14
- targetSdkVersion 22
+ targetSdkVersion 23
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/responses.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/responses.mustache
deleted file mode 100644
index 7cb955f7239..00000000000
--- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/responses.mustache
+++ /dev/null
@@ -1,24 +0,0 @@
-package {{invokerPackage}};
-
-import java.util.List;
-import {{modelPackage}}.*;
-
-public class Responses {
- {{#models}}
- {{#model}}
- public static interface {{classname}}Response {
- public void onResponse({{classname}} {{classVarName}});
- }
- public static interface {{classname}}ListResponse {
- public void onResponse(List<{{classname}}> {{classVarName}}List);
- }
- {{/model}}
- {{/models}}
- public static interface StringResponse {
- public void onResponse(String response);
- }
-
- public static interface StringListResponse {
- public void onResponse(List stringList);
- }
-}
\ No newline at end of file
diff --git a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache
index 142b2e6bbb9..8a22c2f23f9 100644
--- a/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache
+++ b/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache
@@ -77,9 +77,10 @@ namespace {{packageName}}.Client
// Creates and sets up a RestRequest prior to a call.
private RestRequest PrepareRequest(
- String path, RestSharp.Method method, Dictionary queryParams, String postBody,
+ String path, RestSharp.Method method, Dictionary queryParams, Object postBody,
Dictionary headerParams, Dictionary formParams,
- Dictionary fileParams, Dictionary pathParams)
+ Dictionary fileParams, Dictionary pathParams,
+ String contentType)
{
var request = new RestRequest(path, method);
@@ -103,8 +104,17 @@ namespace {{packageName}}.Client
foreach(var param in fileParams)
request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentType);
- if (postBody != null) // http body (model) parameter
- request.AddParameter("application/json", postBody, ParameterType.RequestBody);
+ if (postBody != null) // http body (model or byte[]) parameter
+ {
+ if (postBody.GetType() == typeof(String))
+ {
+ request.AddParameter("application/json", postBody, ParameterType.RequestBody);
+ }
+ else if (postBody.GetType() == typeof(byte[]))
+ {
+ request.AddParameter(contentType, postBody, ParameterType.RequestBody);
+ }
+ }
return request;
}
@@ -120,14 +130,18 @@ namespace {{packageName}}.Client
/// Form parameters.
/// File parameters.
/// Path parameters.
+ /// Content Type of the request
/// Object
public Object CallApi(
- String path, RestSharp.Method method, Dictionary queryParams, String postBody,
+ String path, RestSharp.Method method, Dictionary queryParams, Object postBody,
Dictionary headerParams, Dictionary formParams,
- Dictionary fileParams, Dictionary pathParams)
+ Dictionary fileParams, Dictionary pathParams,
+ String contentType)
{
var request = PrepareRequest(
- path, method, queryParams, postBody, headerParams, formParams, fileParams, pathParams);
+ path, method, queryParams, postBody, headerParams, formParams, fileParams,
+ pathParams, contentType);
+
var response = RestClient.Execute(request);
return (Object) response;
}
@@ -143,14 +157,17 @@ namespace {{packageName}}.Client
/// Form parameters.
/// File parameters.
/// Path parameters.
+ /// Content type.
/// The Task instance.
public async System.Threading.Tasks.Task
diff --git a/modules/swagger-generator/src/main/java/io/swagger/generator/Bootstrap.java b/modules/swagger-generator/src/main/java/io/swagger/generator/Bootstrap.java
index 7d1c46c4362..995fc8c80e7 100644
--- a/modules/swagger-generator/src/main/java/io/swagger/generator/Bootstrap.java
+++ b/modules/swagger-generator/src/main/java/io/swagger/generator/Bootstrap.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2015 SmartBear Software
+ * Copyright 2016 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/modules/swagger-generator/src/main/java/io/swagger/generator/exception/ApiException.java b/modules/swagger-generator/src/main/java/io/swagger/generator/exception/ApiException.java
index fe8b455ecb0..4ffc2348c27 100644
--- a/modules/swagger-generator/src/main/java/io/swagger/generator/exception/ApiException.java
+++ b/modules/swagger-generator/src/main/java/io/swagger/generator/exception/ApiException.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2015 SmartBear Software
+ * Copyright 2016 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/modules/swagger-generator/src/main/java/io/swagger/generator/exception/BadRequestException.java b/modules/swagger-generator/src/main/java/io/swagger/generator/exception/BadRequestException.java
index 7cab512b58c..14093f536d2 100644
--- a/modules/swagger-generator/src/main/java/io/swagger/generator/exception/BadRequestException.java
+++ b/modules/swagger-generator/src/main/java/io/swagger/generator/exception/BadRequestException.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2015 SmartBear Software
+ * Copyright 2016 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/modules/swagger-generator/src/main/java/io/swagger/generator/exception/NotFoundException.java b/modules/swagger-generator/src/main/java/io/swagger/generator/exception/NotFoundException.java
index b84985d51e1..cdae50ce9b6 100644
--- a/modules/swagger-generator/src/main/java/io/swagger/generator/exception/NotFoundException.java
+++ b/modules/swagger-generator/src/main/java/io/swagger/generator/exception/NotFoundException.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2015 SmartBear Software
+ * Copyright 2016 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/modules/swagger-generator/src/main/java/io/swagger/generator/model/ApiResponse.java b/modules/swagger-generator/src/main/java/io/swagger/generator/model/ApiResponse.java
index 8fe9d41fb7e..424b9dd2b0a 100644
--- a/modules/swagger-generator/src/main/java/io/swagger/generator/model/ApiResponse.java
+++ b/modules/swagger-generator/src/main/java/io/swagger/generator/model/ApiResponse.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2015 SmartBear Software
+ * Copyright 2016 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/modules/swagger-generator/src/main/java/io/swagger/generator/model/Generated.java b/modules/swagger-generator/src/main/java/io/swagger/generator/model/Generated.java
index 614adcc61bc..f48be6a77da 100644
--- a/modules/swagger-generator/src/main/java/io/swagger/generator/model/Generated.java
+++ b/modules/swagger-generator/src/main/java/io/swagger/generator/model/Generated.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2015 SmartBear Software
+ * Copyright 2016 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/modules/swagger-generator/src/main/java/io/swagger/generator/model/InputOption.java b/modules/swagger-generator/src/main/java/io/swagger/generator/model/InputOption.java
index 45b3b7b7bbf..33df1bc5071 100644
--- a/modules/swagger-generator/src/main/java/io/swagger/generator/model/InputOption.java
+++ b/modules/swagger-generator/src/main/java/io/swagger/generator/model/InputOption.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2015 SmartBear Software
+ * Copyright 2016 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/modules/swagger-generator/src/main/java/io/swagger/generator/util/ApiOriginFilter.java b/modules/swagger-generator/src/main/java/io/swagger/generator/util/ApiOriginFilter.java
index 07ee795f588..aca470bd89b 100644
--- a/modules/swagger-generator/src/main/java/io/swagger/generator/util/ApiOriginFilter.java
+++ b/modules/swagger-generator/src/main/java/io/swagger/generator/util/ApiOriginFilter.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2015 SmartBear Software
+ * Copyright 2016 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/modules/swagger-generator/src/main/java/io/swagger/generator/util/ZipUtil.java b/modules/swagger-generator/src/main/java/io/swagger/generator/util/ZipUtil.java
index ca0a0e62018..c63f161b702 100644
--- a/modules/swagger-generator/src/main/java/io/swagger/generator/util/ZipUtil.java
+++ b/modules/swagger-generator/src/main/java/io/swagger/generator/util/ZipUtil.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2015 SmartBear Software
+ * Copyright 2016 SmartBear Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/pom.xml b/pom.xml
index 0f0e35a38c3..a47757a3597 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
swagger-codegen-project
pom
swagger-codegen-project
- 2.1.5
+ 2.1.6-SNAPSHOT
https://github.com/swagger-api/swagger-codegen
scm:git:git@github.com:swagger-api/swagger-codegen.git
@@ -151,54 +151,43 @@
maven-release-plugin
2.1
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.10.3
+
+ true
+ 1.7
+ UTF-8
+ 1g
+ ${javadoc.package.exclude}
+
+
+
+ attach-javadocs
+ verify
+
+ jar
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 2.1.2
+
+
+ attach-sources
+ verify
+
+ jar-no-fork
+
+
+
+
-
-
-
- net.alchim31.maven
- scala-maven-plugin
- ${scala-maven-plugin-version}
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- 2.9
-
- true
- 1.6
- UTF-8
- 1g
-
- http://java.sun.com/javase/6/docs/api/
-
- ${javadoc.package.exclude}
-
-
-
- attach-javadocs
- verify
-
- jar
-
-
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.1.2
-
-
- attach-sources
- verify
-
- jar-no-fork
-
-
-
-
-
-
@@ -530,10 +519,10 @@
- 1.0.15-SNAPSHOT
+ 1.0.17-SNAPSHOT
2.11.1
2.3.4
- 1.5.5
+ 1.5.6
2.4
1.2
4.8.1
diff --git a/samples/client/petstore/android/default/src/test/java/io/swagger/petstore/test/PetApiTest.java b/samples/client/petstore/android/default/src/test/java/io/swagger/petstore/test/PetApiTest.java
index ca868d2ea22..75039a9fa39 100644
--- a/samples/client/petstore/android/default/src/test/java/io/swagger/petstore/test/PetApiTest.java
+++ b/samples/client/petstore/android/default/src/test/java/io/swagger/petstore/test/PetApiTest.java
@@ -72,6 +72,11 @@ public class PetApiTest {
}
@Test
+ @Ignore
+ /* ignoring the findPetByTags test below as it's very similar to
+ * testFindPetsByStatus and testFindPetsByTags sometimes got 500
+ * due to server issue, which makes the test unstable.
+ */
public void testFindPetsByTags() throws Exception {
Pet pet = createRandomPet();
pet.setName("monster");
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/compile-mono.sh b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/compile-mono.sh
index bc4e0989945..352274186d2 100644
--- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/compile-mono.sh
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/compile-mono.sh
@@ -7,6 +7,6 @@ vendor/RestSharp.Net2.1.1.11/lib/net20/RestSharp.Net2.dll,\
System.Runtime.Serialization.dll \
-target:library \
-out:bin/IO.Swagger.dll \
--recurse:src/*.cs \
+-recurse:'src/*.cs' \
-doc:bin/IO.Swagger.xml \
--platform:anycpu
\ No newline at end of file
+-platform:anycpu
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/PetApi.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/PetApi.cs
index 7db0f993846..b09b31264c3 100644
--- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/PetApi.cs
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/PetApi.cs
@@ -8,6 +8,9 @@ using IO.Swagger.Model;
namespace IO.Swagger.Api
{
+ ///
+ /// Represents a collection of functions to interact with the API endpoints
+ ///
public interface IPetApi
{
@@ -29,14 +32,14 @@ namespace IO.Swagger.Api
/// Finds Pets by status Multiple status values can be provided with comma seperated strings
///
/// Status values that need to be considered for filter
- /// List
+ /// List<Pet>
List FindPetsByStatus (List status);
///
/// Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
///
/// Tags to filter by
- /// List
+ /// List<Pet>
List FindPetsByTags (List tags);
///
@@ -124,7 +127,7 @@ namespace IO.Swagger.Api
///
/// Gets or sets the API client.
///
- /// An instance of the ApiClient
+ /// An instance of the ApiClient
public ApiClient ApiClient {get; set;}
@@ -212,7 +215,7 @@ namespace IO.Swagger.Api
/// Finds Pets by status Multiple status values can be provided with comma seperated strings
///
/// Status values that need to be considered for filter
- /// List
+ /// List<Pet>
public List FindPetsByStatus (List status)
{
@@ -252,7 +255,7 @@ namespace IO.Swagger.Api
/// Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
///
/// Tags to filter by
- /// List
+ /// List<Pet>
public List FindPetsByTags (List tags)
{
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/StoreApi.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/StoreApi.cs
index c6c90631bef..ba269cc2b0c 100644
--- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/StoreApi.cs
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/StoreApi.cs
@@ -8,13 +8,16 @@ using IO.Swagger.Model;
namespace IO.Swagger.Api
{
+ ///
+ /// Represents a collection of functions to interact with the API endpoints
+ ///
public interface IStoreApi
{
///
/// Returns pet inventories by status Returns a map of status codes to quantities
///
- /// Dictionary
+ /// Dictionary<String, int?>
Dictionary GetInventory ();
///
@@ -90,14 +93,14 @@ namespace IO.Swagger.Api
///
/// Gets or sets the API client.
///
- /// An instance of the ApiClient
+ /// An instance of the ApiClient
public ApiClient ApiClient {get; set;}
///
/// Returns pet inventories by status Returns a map of status codes to quantities
///
- /// Dictionary
+ /// Dictionary<String, int?>
public Dictionary GetInventory ()
{
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/UserApi.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/UserApi.cs
index 3e3c8869d04..1374556698e 100644
--- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/UserApi.cs
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/UserApi.cs
@@ -8,6 +8,9 @@ using IO.Swagger.Model;
namespace IO.Swagger.Api
{
+ ///
+ /// Represents a collection of functions to interact with the API endpoints
+ ///
public interface IUserApi
{
@@ -120,7 +123,7 @@ namespace IO.Swagger.Api
///
/// Gets or sets the API client.
///
- /// An instance of the ApiClient
+ /// An instance of the ApiClient
public ApiClient ApiClient {get; set;}
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/ApiClient.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/ApiClient.cs
index 56331e606a9..3041cde567e 100644
--- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/ApiClient.cs
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/ApiClient.cs
@@ -159,6 +159,7 @@ namespace IO.Swagger.Client
///
/// HTTP body (e.g. string, JSON).
/// Object type.
+ /// HTTP headers.
/// Object representation of the JSON string.
public object Deserialize(string content, Type type, IList headers=null)
{
diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/ApiException.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/ApiException.cs
index ff0b4be791e..dfc5fd9fc03 100644
--- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/ApiException.cs
+++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/ApiException.cs
@@ -20,7 +20,6 @@ namespace IO.Swagger.Client {
///
/// Initializes a new instance of the class.
///
- /// The base path.
public ApiException() {}
///
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/Properties/AssemblyInfo.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000000..1de9edb2a81
--- /dev/null
+++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Swagger Library")]
+[assembly: AssemblyDescription("A library generated from a Swagger doc")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Swagger")]
+[assembly: AssemblyProduct("SwaggerLibrary")]
+[assembly: AssemblyCopyright("No Copyright")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0")]
+[assembly: AssemblyFileVersion("1.0.0")]
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs
index ba58eeac9e0..892412e5b3e 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs
+++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs
@@ -355,6 +355,86 @@ namespace IO.Swagger.Api
/// Task of ApiResponse
System.Threading.Tasks.Task> UploadFileAsyncWithHttpInfo (long? petId, string additionalMetadata = null, Stream file = null);
+ ///
+ /// Fake endpoint to test byte array return by 'Find pet by ID'
+ ///
+ ///
+ /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
+ ///
+ /// ID of pet that needs to be fetched
+ /// byte[]
+ byte[] GetPetByIdWithByteArray (long? petId);
+
+ ///
+ /// Fake endpoint to test byte array return by 'Find pet by ID'
+ ///
+ ///
+ /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
+ ///
+ /// ID of pet that needs to be fetched
+ /// ApiResponse of byte[]
+ ApiResponse GetPetByIdWithByteArrayWithHttpInfo (long? petId);
+
+ ///
+ /// Fake endpoint to test byte array return by 'Find pet by ID'
+ ///
+ ///
+ /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
+ ///
+ /// ID of pet that needs to be fetched
+ /// Task of byte[]
+ System.Threading.Tasks.Task GetPetByIdWithByteArrayAsync (long? petId);
+
+ ///
+ /// Fake endpoint to test byte array return by 'Find pet by ID'
+ ///
+ ///
+ /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
+ ///
+ /// ID of pet that needs to be fetched
+ /// Task of ApiResponse (byte[])
+ System.Threading.Tasks.Task> GetPetByIdWithByteArrayAsyncWithHttpInfo (long? petId);
+
+ ///
+ /// Fake endpoint to test byte array in body parameter for adding a new pet to the store
+ ///
+ ///
+ ///
+ ///
+ /// Pet object in the form of byte array
+ ///
+ void AddPetUsingByteArray (byte[] body = null);
+
+ ///
+ /// Fake endpoint to test byte array in body parameter for adding a new pet to the store
+ ///
+ ///
+ ///
+ ///
+ /// Pet object in the form of byte array
+ /// ApiResponse of Object(void)
+ ApiResponse
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/TestApiClient.cs b/samples/client/petstore/csharp/SwaggerClientTest/TestApiClient.cs
index f0232c330f0..6eb32a38442 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/TestApiClient.cs
+++ b/samples/client/petstore/csharp/SwaggerClientTest/TestApiClient.cs
@@ -14,6 +14,26 @@ namespace SwaggerClientTest.TestApiClient
Configuration.Default.DateTimeFormat = "o";
}
+ ///
+ /// Test SelectHeaderContentType
+ ///
+ [Test ()]
+ public void TestSelectHeaderContentType ()
+ {
+ ApiClient api = new ApiClient ();
+ String[] contentTypes = new String[] { "application/json", "application/xml" };
+ Assert.AreEqual("application/json", api.SelectHeaderContentType (contentTypes));
+
+ contentTypes = new String[] { "application/xml" };
+ Assert.AreEqual("application/xml", api.SelectHeaderContentType (contentTypes));
+
+ contentTypes = new String[] {};
+ Assert.IsNull(api.SelectHeaderContentType (contentTypes));
+ }
+
+ ///
+ /// Test ParameterToString
+ ///
[Test ()]
public void TestParameterToString ()
{
@@ -48,7 +68,7 @@ namespace SwaggerClientTest.TestApiClient
{
ApiClient api = new ApiClient ();
// test datetime with a time zone
- DateTime dateWithTz = DateTime.Parse("2008-04-10T13:30:00.0000000-04:00", null, System.Globalization.DateTimeStyles.RoundtripKind);
+ DateTimeOffset dateWithTz = DateTimeOffset.Parse("2008-04-10T13:30:00.0000000-04:00", null, System.Globalization.DateTimeStyles.RoundtripKind);
Assert.AreEqual("2008-04-10T13:30:00.0000000-04:00", api.ParameterToString(dateWithTz));
}
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/TestPet.cs b/samples/client/petstore/csharp/SwaggerClientTest/TestPet.cs
index fbbf4494951..001b052bf76 100644
--- a/samples/client/petstore/csharp/SwaggerClientTest/TestPet.cs
+++ b/samples/client/petstore/csharp/SwaggerClientTest/TestPet.cs
@@ -15,7 +15,10 @@ namespace SwaggerClientTest.TestPet
{
public long petId = 11088;
- [SetUp] public void Init()
+ ///
+ /// Create a Pet object
+ ///
+ private Pet createPet()
{
// create pet
Pet p = new Pet();
@@ -36,6 +39,24 @@ namespace SwaggerClientTest.TestPet
p.Category = category;
p.PhotoUrls = photoUrls;
+ return p;
+ }
+
+ ///
+ /// Convert string to byte array
+ ///
+ private byte[] GetBytes(string str)
+ {
+ byte[] bytes = new byte[str.Length * sizeof(char)];
+ System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
+ return bytes;
+ }
+
+ [SetUp] public void Init()
+ {
+ // create pet
+ Pet p = createPet();
+
// add pet before testing
PetApi petApi = new PetApi("http://petstore.swagger.io/v2/");
petApi.AddPet (p);
@@ -137,6 +158,35 @@ namespace SwaggerClientTest.TestPet
}
+ ///
+ /// Test GetPetByIdWithByteArray
+ ///
+ [Test ()]
+ public void TestGetPetByIdWithByteArray ()
+ {
+ // set timeout to 10 seconds
+ Configuration c1 = new Configuration (timeout: 10000);
+
+ PetApi petApi = new PetApi (c1);
+ byte[] response = petApi.GetPetByIdWithByteArray (petId);
+ Assert.IsInstanceOf (response, "Response is byte array");
+ }
+
+ ///
+ /// Test AddPetUsingByteArray
+ ///
+ [Test ()]
+ public void TestAddPetUsingByteArray ()
+ {
+ // set timeout to 10 seconds
+ Configuration c1 = new Configuration (timeout: 10000);
+
+ PetApi petApi = new PetApi (c1);
+ Pet p = createPet ();
+ byte[] petByteArray = GetBytes ((string)petApi.Configuration.ApiClient.Serialize (p));
+ petApi.AddPetUsingByteArray (petByteArray);
+ }
+
///
/// Test UpdatePetWithForm
///
diff --git a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb
deleted file mode 100644
index d4c01b5c42a..00000000000
Binary files a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb and /dev/null differ
diff --git a/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiClient.java b/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiClient.java
index 057dcd7d72d..581eafa51ca 100644
--- a/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiClient.java
+++ b/samples/client/petstore/java/default/src/main/java/io/swagger/client/ApiClient.java
@@ -41,12 +41,14 @@ import io.swagger.client.auth.HttpBasicAuth;
import io.swagger.client.auth.ApiKeyAuth;
import io.swagger.client.auth.OAuth;
-@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-05T14:39:16.440+08:00")
+@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-08T18:50:38.131+08:00")
public class ApiClient {
- private Map hostMap = new HashMap();
private Map defaultHeaderMap = new HashMap();
- private boolean debugging = false;
private String basePath = "http://petstore.swagger.io/v2";
+ private boolean debugging = false;
+ private int connectionTimeout = 0;
+
+ private Client httpClient;
private ObjectMapper mapper;
private Map authentications;
@@ -64,7 +66,9 @@ public class ApiClient {
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
mapper.registerModule(new JodaModule());
-
+
+ httpClient = buildHttpClient(debugging);
+
// Use RFC3339 format for date and datetime.
// See http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14
this.dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
@@ -79,8 +83,8 @@ public class ApiClient {
// Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap();
- authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
authentications.put("petstore_auth", new OAuth());
+ authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
// Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications);
}
@@ -223,9 +227,29 @@ public class ApiClient {
*/
public ApiClient setDebugging(boolean debugging) {
this.debugging = debugging;
+ // Rebuild HTTP Client according to the new "debugging" value.
+ this.httpClient = buildHttpClient(debugging);
return this;
}
+ /**
+ * Connect timeout (in milliseconds).
+ */
+ public int getConnectTimeout() {
+ return connectionTimeout;
+ }
+
+ /**
+ * Set the connect timeout (in milliseconds).
+ * A value of 0 means no timeout, otherwise values must be between 1 and
+ * {@link Integer#MAX_VALUE}.
+ */
+ public ApiClient setConnectTimeout(int connectionTimeout) {
+ this.connectionTimeout = connectionTimeout;
+ httpClient.setConnectTimeout(connectionTimeout);
+ return this;
+ }
+
/**
* Get the date format used to parse/format date parameters.
*/
@@ -435,8 +459,6 @@ public class ApiClient {
updateParamsForAuth(authNames, queryParams, headerParams);
- Client client = getClient();
-
StringBuilder b = new StringBuilder();
b.append("?");
if (queryParams != null){
@@ -454,9 +476,9 @@ public class ApiClient {
Builder builder;
if (accept == null)
- builder = client.resource(basePath + path + querystring).getRequestBuilder();
+ builder = httpClient.resource(basePath + path + querystring).getRequestBuilder();
else
- builder = client.resource(basePath + path + querystring).accept(accept);
+ builder = httpClient.resource(basePath + path + querystring).accept(accept);
for (String key : headerParams.keySet()) {
builder = builder.header(key, headerParams.get(key));
@@ -570,19 +592,17 @@ public class ApiClient {
}
/**
- * Get an existing client or create a new client to handle HTTP request.
+ * Build the Client used to make HTTP requests.
*/
- private Client getClient() {
- if(!hostMap.containsKey(basePath)) {
- // Add the JSON serialization support to Jersey
- JacksonJsonProvider jsonProvider = new JacksonJsonProvider(mapper);
- DefaultClientConfig conf = new DefaultClientConfig();
- conf.getSingletons().add(jsonProvider);
- Client client = Client.create(conf);
- if (debugging)
- client.addFilter(new LoggingFilter());
- hostMap.put(basePath, client);
+ private Client buildHttpClient(boolean debugging) {
+ // Add the JSON serialization support to Jersey
+ JacksonJsonProvider jsonProvider = new JacksonJsonProvider(mapper);
+ DefaultClientConfig conf = new DefaultClientConfig();
+ conf.getSingletons().add(jsonProvider);
+ Client client = Client.create(conf);
+ if (debugging) {
+ client.addFilter(new LoggingFilter());
}
- return hostMap.get(basePath);
+ return client;
}
}
diff --git a/samples/client/petstore/java/feign/pom.xml b/samples/client/petstore/java/feign/pom.xml
index 5f7e9551862..d7ad6ee49b9 100644
--- a/samples/client/petstore/java/feign/pom.xml
+++ b/samples/client/petstore/java/feign/pom.xml
@@ -164,6 +164,12 @@
2.2
+