diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java index 322729ac8c0..8966e19b9ce 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java @@ -185,6 +185,8 @@ public class CSharpClientCodegen extends DefaultCodegen implements CodegenConfig supportingFiles.add(new SupportingFile("Newtonsoft.Json.dll", "bin", "Newtonsoft.Json.dll")); supportingFiles.add(new SupportingFile("RestSharp.dll", "bin", "RestSharp.dll")); supportingFiles.add(new SupportingFile("compile.mustache", "", "compile.bat")); + supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "compile-mono.sh")); + supportingFiles.add(new SupportingFile("packages.config.mustache", "vendor" + java.io.File.separator, "packages.config")); supportingFiles.add(new SupportingFile("README.md", "", "README.md")); if (optionalAssemblyInfoFlag) { diff --git a/modules/swagger-codegen/src/main/resources/CsharpDotNet2/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/ApiClient.mustache index a428cdc3630..ea92989daa4 100644 --- a/modules/swagger-codegen/src/main/resources/CsharpDotNet2/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/ApiClient.mustache @@ -159,6 +159,7 @@ namespace {{packageName}}.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/modules/swagger-codegen/src/main/resources/CsharpDotNet2/ApiException.mustache b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/ApiException.mustache index 71d0243d729..dd618e0a99c 100644 --- a/modules/swagger-codegen/src/main/resources/CsharpDotNet2/ApiException.mustache +++ b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/ApiException.mustache @@ -20,7 +20,6 @@ namespace {{packageName}}.Client { /// /// Initializes a new instance of the class. /// - /// The base path. public ApiException() {} /// diff --git a/modules/swagger-codegen/src/main/resources/CsharpDotNet2/api.mustache b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/api.mustache index 2e51c913c30..c3fb85acb4f 100644 --- a/modules/swagger-codegen/src/main/resources/CsharpDotNet2/api.mustache +++ b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/api.mustache @@ -9,6 +9,9 @@ using {{packageName}}.Client; namespace {{packageName}}.Api { {{#operations}} + /// + /// Represents a collection of functions to interact with the API endpoints + /// public interface I{{classname}} { {{#operation}} @@ -16,7 +19,7 @@ namespace {{packageName}}.Api /// {{summary}} {{notes}} /// {{#allParams}}/// {{description}} - {{/allParams}}/// {{#returnType}}{{{returnType}}}{{/returnType}} + {{/allParams}}/// {{#returnType}}{{returnType}}{{/returnType}} {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{nickname}} ({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); {{/operation}} } @@ -71,7 +74,7 @@ namespace {{packageName}}.Api /// /// Gets or sets the API client. /// - /// An instance of the ApiClient + /// An instance of the ApiClient public ApiClient ApiClient {get; set;} {{#operation}} @@ -79,7 +82,7 @@ namespace {{packageName}}.Api /// {{summary}} {{notes}} /// {{#allParams}}/// {{description}} - {{/allParams}}/// {{#returnType}}{{{returnType}}}{{/returnType}} + {{/allParams}}/// {{#returnType}}{{returnType}}{{/returnType}} public {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{nickname}} ({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { {{#allParams}}{{#required}} diff --git a/modules/swagger-codegen/src/main/resources/CsharpDotNet2/compile-mono.sh.mustache b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/compile-mono.sh.mustache index 73add75a69a..1e4e12b4aee 100644 --- a/modules/swagger-codegen/src/main/resources/CsharpDotNet2/compile-mono.sh.mustache +++ b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/compile-mono.sh.mustache @@ -7,6 +7,6 @@ vendor/RestSharp.Net2.1.1.11/lib/net20/RestSharp.Net2.dll,\ System.Runtime.Serialization.dll \ -target:library \ -out:bin/{{packageName}}.dll \ --recurse:src/*.cs \ +-recurse:'src/*.cs' \ -doc:bin/{{packageName}}.xml \ --platform:anycpu \ No newline at end of file +-platform:anycpu diff --git a/modules/swagger-codegen/src/main/resources/csharp/ApiResponse.mustache b/modules/swagger-codegen/src/main/resources/csharp/ApiResponse.mustache index 32816110a1b..c4317c35b65 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/ApiResponse.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/ApiResponse.mustache @@ -27,10 +27,10 @@ namespace {{packageName}}.Client public T Data { get; private set; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// HTTP status code. - /// Error message. + /// HTTP headers. /// Data (parsed HTTP body) public ApiResponse(int statusCode, IDictionary headers, T data) { diff --git a/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache b/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache index 7062a73c1e1..d3ef0c6f731 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/Configuration.mustache @@ -24,6 +24,7 @@ namespace {{packageName}}.Client /// Dictionary of API key prefix /// Temp folder path /// DateTime format string + /// HTTP connection timeout (in milliseconds) public Configuration(ApiClient apiClient = null, Dictionary defaultHeader = null, string username = null, diff --git a/modules/swagger-codegen/src/main/resources/csharp/compile-mono.sh.mustache b/modules/swagger-codegen/src/main/resources/csharp/compile-mono.sh.mustache new file mode 100644 index 00000000000..9472dcc8d3d --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/csharp/compile-mono.sh.mustache @@ -0,0 +1,12 @@ +wget -nc https://nuget.org/nuget.exe; +mozroots --import --sync +mono nuget.exe install vendor/packages.config -o vendor; +mkdir -p bin; +mcs -sdk:45 -r:vendor/Newtonsoft.Json.8.0.2/lib/net45/Newtonsoft.Json.dll,\ +vendor/RestSharp.105.2.3/lib/net45/RestSharp.dll,\ +System.Runtime.Serialization.dll \ +-target:library \ +-out:bin/{{packageName}}.dll \ +-recurse:'src/*.cs' \ +-doc:bin/{{packageName}}.xml \ +-platform:anycpu diff --git a/modules/swagger-codegen/src/main/resources/csharp/model.mustache b/modules/swagger-codegen/src/main/resources/csharp/model.mustache index ad942039677..6db39b046a2 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/model.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/model.mustache @@ -74,7 +74,7 @@ namespace {{packageName}}.Model /// /// Returns true if {{classname}} instances are equal /// - /// Instance of {{classname}} to be compared + /// Instance of {{classname}} to be compared /// Boolean public bool Equals({{classname}} other) { diff --git a/modules/swagger-codegen/src/main/resources/csharp/packages.config.mustache b/modules/swagger-codegen/src/main/resources/csharp/packages.config.mustache new file mode 100644 index 00000000000..c87bbb79fa6 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/csharp/packages.config.mustache @@ -0,0 +1,5 @@ + + + + + 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/main/csharp/IO/Swagger/Client/ApiClient.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs index 7e6807f16a4..ee2e1b8b8f0 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiClient.cs @@ -194,6 +194,12 @@ namespace IO.Swagger.Client // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return ((DateTime)obj).ToString (Configuration.DateTimeFormat); + else if (obj is DateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return ((DateTimeOffset)obj).ToString (Configuration.DateTimeFormat); else if (obj is IList) { var flattenedString = new StringBuilder(); diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiResponse.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiResponse.cs index 15735711656..651d3609c22 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiResponse.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/ApiResponse.cs @@ -27,10 +27,10 @@ namespace IO.Swagger.Client public T Data { get; private set; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// HTTP status code. - /// Error message. + /// HTTP headers. /// Data (parsed HTTP body) public ApiResponse(int statusCode, IDictionary headers, T data) { diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs index 000b8893cdf..7ea30009c9c 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Client/Configuration.cs @@ -24,6 +24,7 @@ namespace IO.Swagger.Client /// Dictionary of API key prefix /// Temp folder path /// DateTime format string + /// HTTP connection timeout (in milliseconds) public Configuration(ApiClient apiClient = null, Dictionary defaultHeader = null, string username = null, diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs index 6ad53e05257..85694bc93c8 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Category.cs @@ -78,7 +78,7 @@ namespace IO.Swagger.Model /// /// Returns true if Category instances are equal /// - /// Instance of Category to be compared + /// Instance of Category to be compared /// Boolean public bool Equals(Category other) { diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs index eb649ccf587..5a110929b20 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs @@ -111,7 +111,7 @@ namespace IO.Swagger.Model /// /// Returns true if Order instances are equal /// - /// Instance of Order to be compared + /// Instance of Order to be compared /// Boolean public bool Equals(Order other) { diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs index 202a171c219..ec3b3d5ca13 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Pet.cs @@ -111,7 +111,7 @@ namespace IO.Swagger.Model /// /// Returns true if Pet instances are equal /// - /// Instance of Pet to be compared + /// Instance of Pet to be compared /// Boolean public bool Equals(Pet other) { diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs index 4aa4a9c97f0..078a53ad1ea 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Tag.cs @@ -78,7 +78,7 @@ namespace IO.Swagger.Model /// /// Returns true if Tag instances are equal /// - /// Instance of Tag to be compared + /// Instance of Tag to be compared /// Boolean public bool Equals(Tag other) { diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs index 5785a3d3509..7f0b3b858aa 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/User.cs @@ -127,7 +127,7 @@ namespace IO.Swagger.Model /// /// Returns true if User instances are equal /// - /// Instance of User to be compared + /// Instance of User to be compared /// Boolean public bool Equals(User other) {