diff --git a/appveyor.yml b/appveyor.yml index d9a420159e36..ce0c0b8d2e9d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,5 @@ version: '{branch}-{build}' -image: Visual Studio 2017 +image: Visual Studio 2019 hosts: petstore.swagger.io: 127.0.0.1 install: @@ -53,8 +53,8 @@ build_script: - gradle -b modules\openapi-generator-gradle-plugin\samples\local-spec\build.gradle buildGoSdk --stacktrace test_script: # test c# API client (netcore) - - dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj - dotnet test samples\client\petstore\csharp-netcore\OpenAPIClientCore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj + - dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj # test c# API client - nunit3-console samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor # test c# API client (with PropertyChanged) diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/ApiClient.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/ApiClient.mustache index 10190bb241dc..0755845f52bc 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/ApiClient.mustache @@ -383,14 +383,27 @@ namespace {{packageName}}.Client var existingDeserializer = req.JsonSerializer as IDeserializer; if (existingDeserializer != null) { - client.AddHandler(() => existingDeserializer, "application/json", "text/json", "text/x-json", "text/javascript", "*+json"); + client.AddHandler("application/json", () => existingDeserializer); + client.AddHandler("text/json", () => existingDeserializer); + client.AddHandler("text/x-json", () => existingDeserializer); + client.AddHandler("text/javascript", () => existingDeserializer); + client.AddHandler("*+json", () => existingDeserializer); } else { - client.AddHandler(() => new CustomJsonCodec(configuration), "application/json", "text/json", "text/x-json", "text/javascript", "*+json"); + var customDeserializer = new CustomJsonCodec(configuration); + client.AddHandler("application/json", () => customDeserializer); + client.AddHandler("text/json", () => customDeserializer); + client.AddHandler("text/x-json", () => customDeserializer); + client.AddHandler("text/javascript", () => customDeserializer); + client.AddHandler("*+json", () => customDeserializer); } - client.AddHandler(() => new XmlDeserializer(), "application/xml", "text/xml", "*+xml", "*"); + var xmlDeserializer = new XmlDeserializer(); + client.AddHandler("application/xml", () => xmlDeserializer); + client.AddHandler("text/xml", () => xmlDeserializer); + client.AddHandler("*+xml", () => xmlDeserializer); + client.AddHandler("*", () => xmlDeserializer); client.Timeout = configuration.Timeout; @@ -454,14 +467,27 @@ namespace {{packageName}}.Client var existingDeserializer = req.JsonSerializer as IDeserializer; if (existingDeserializer != null) { - client.AddHandler(() => existingDeserializer, "application/json", "text/json", "text/x-json", "text/javascript", "*+json"); + client.AddHandler("application/json", () => existingDeserializer); + client.AddHandler("text/json", () => existingDeserializer); + client.AddHandler("text/x-json", () => existingDeserializer); + client.AddHandler("text/javascript", () => existingDeserializer); + client.AddHandler("*+json", () => existingDeserializer); } else { - client.AddHandler(() => new CustomJsonCodec(configuration), "application/json", "text/json", "text/x-json", "text/javascript", "*+json"); + var customDeserializer = new CustomJsonCodec(configuration); + client.AddHandler("application/json", () => customDeserializer); + client.AddHandler("text/json", () => customDeserializer); + client.AddHandler("text/x-json", () => customDeserializer); + client.AddHandler("text/javascript", () => customDeserializer); + client.AddHandler("*+json", () => customDeserializer); } - client.AddHandler(() => new XmlDeserializer(), "application/xml", "text/xml", "*+xml", "*"); + var xmlDeserializer = new XmlDeserializer(); + client.AddHandler("application/xml", () => xmlDeserializer); + client.AddHandler("text/xml", () => xmlDeserializer); + client.AddHandler("*+xml", () => xmlDeserializer); + client.AddHandler("*", () => xmlDeserializer); client.Timeout = configuration.Timeout; diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/README.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/README.mustache index b0f7b5cc2247..c86f32641de6 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/README.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/README.mustache @@ -27,14 +27,14 @@ This C# SDK is automatically generated by the [OpenAPI Generator](https://openap ## Dependencies -- [RestSharp](https://www.nuget.org/packages/RestSharp) - 106.10.1 or later -- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 12.0.1 or later -- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.5.2 or later +- [RestSharp](https://www.nuget.org/packages/RestSharp) - 106.11.4 or later +- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 12.0.3 or later +- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.7.0 or later {{#useCompareNetObjects}} -- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.57.0 or later +- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.61.0 or later {{/useCompareNetObjects}} {{#validatable}} -- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.5.0 or later +- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.7.0 or later {{/validatable}} The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/TestProject.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/TestProject.mustache index 8be9bfd8620b..bab424f90f81 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/TestProject.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/TestProject.mustache @@ -22,7 +22,7 @@ 512 - + diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/netcore_project.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/netcore_project.mustache index 61427915ad97..e9570eda4446 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/netcore_project.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/netcore_project.mustache @@ -23,13 +23,13 @@ {{#useCompareNetObjects}} - + {{/useCompareNetObjects}} - - - + + + {{#validatable}} - + {{/validatable}} diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/netcore_testproject.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/netcore_testproject.mustache index e75195ffea2b..48eaf5a20cc4 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/netcore_testproject.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/netcore_testproject.mustache @@ -8,7 +8,7 @@ - + diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/nuspec.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/nuspec.mustache index 9753c1cbd559..b6a4a2f3647a 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/nuspec.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/nuspec.mustache @@ -30,14 +30,14 @@ - - + + {{#useCompareNetObjects}} - + {{/useCompareNetObjects}} - + {{#validatable}} - + {{/validatable}} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md index 395d72b2dd67..e883fd658780 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md @@ -17,11 +17,11 @@ This C# SDK is automatically generated by the [OpenAPI Generator](https://openap ## Dependencies -- [RestSharp](https://www.nuget.org/packages/RestSharp) - 106.10.1 or later -- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 12.0.1 or later -- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.5.2 or later -- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.57.0 or later -- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.5.0 or later +- [RestSharp](https://www.nuget.org/packages/RestSharp) - 106.11.4 or later +- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 12.0.3 or later +- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.7.0 or later +- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.61.0 or later +- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.7.0 or later The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: ``` diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 4893f78082ae..3ebd3e4a840f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -17,14 +17,13 @@ OpenAPI spec version: 1.0.0 - Org.OpenAPITools - + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs index 82b6c6c2bbcf..67a5f9bd6d67 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Client/ApiClient.cs @@ -387,14 +387,27 @@ private ApiResponse Exec(RestRequest req, IReadableConfiguration configura var existingDeserializer = req.JsonSerializer as IDeserializer; if (existingDeserializer != null) { - client.AddHandler(() => existingDeserializer, "application/json", "text/json", "text/x-json", "text/javascript", "*+json"); + client.AddHandler("application/json", () => existingDeserializer); + client.AddHandler("text/json", () => existingDeserializer); + client.AddHandler("text/x-json", () => existingDeserializer); + client.AddHandler("text/javascript", () => existingDeserializer); + client.AddHandler("*+json", () => existingDeserializer); } else { - client.AddHandler(() => new CustomJsonCodec(configuration), "application/json", "text/json", "text/x-json", "text/javascript", "*+json"); + var customDeserializer = new CustomJsonCodec(configuration); + client.AddHandler("application/json", () => customDeserializer); + client.AddHandler("text/json", () => customDeserializer); + client.AddHandler("text/x-json", () => customDeserializer); + client.AddHandler("text/javascript", () => customDeserializer); + client.AddHandler("*+json", () => customDeserializer); } - client.AddHandler(() => new XmlDeserializer(), "application/xml", "text/xml", "*+xml", "*"); + var xmlDeserializer = new XmlDeserializer(); + client.AddHandler("application/xml", () => xmlDeserializer); + client.AddHandler("text/xml", () => xmlDeserializer); + client.AddHandler("*+xml", () => xmlDeserializer); + client.AddHandler("*", () => xmlDeserializer); client.Timeout = configuration.Timeout; @@ -457,14 +470,27 @@ private ApiResponse Exec(RestRequest req, IReadableConfiguration configura var existingDeserializer = req.JsonSerializer as IDeserializer; if (existingDeserializer != null) { - client.AddHandler(() => existingDeserializer, "application/json", "text/json", "text/x-json", "text/javascript", "*+json"); + client.AddHandler("application/json", () => existingDeserializer); + client.AddHandler("text/json", () => existingDeserializer); + client.AddHandler("text/x-json", () => existingDeserializer); + client.AddHandler("text/javascript", () => existingDeserializer); + client.AddHandler("*+json", () => existingDeserializer); } else { - client.AddHandler(() => new CustomJsonCodec(configuration), "application/json", "text/json", "text/x-json", "text/javascript", "*+json"); + var customDeserializer = new CustomJsonCodec(configuration); + client.AddHandler("application/json", () => customDeserializer); + client.AddHandler("text/json", () => customDeserializer); + client.AddHandler("text/x-json", () => customDeserializer); + client.AddHandler("text/javascript", () => customDeserializer); + client.AddHandler("*+json", () => customDeserializer); } - client.AddHandler(() => new XmlDeserializer(), "application/xml", "text/xml", "*+xml", "*"); + var xmlDeserializer = new XmlDeserializer(); + client.AddHandler("application/xml", () => xmlDeserializer); + client.AddHandler("text/xml", () => xmlDeserializer); + client.AddHandler("*+xml", () => xmlDeserializer); + client.AddHandler("*", () => xmlDeserializer); client.Timeout = configuration.Timeout; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 69a832d2224e..aeeb5c097c96 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -20,11 +20,11 @@ - - - - - + + + + + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md index ecb6db71253d..c72c6ccedd99 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md @@ -14,11 +14,11 @@ This C# SDK is automatically generated by the [OpenAPI Generator](https://openap ## Dependencies -- [RestSharp](https://www.nuget.org/packages/RestSharp) - 106.10.1 or later -- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 12.0.1 or later -- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.5.2 or later -- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.57.0 or later -- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.5.0 or later +- [RestSharp](https://www.nuget.org/packages/RestSharp) - 106.11.4 or later +- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 12.0.3 or later +- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.7.0 or later +- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.61.0 or later +- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.7.0 or later The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: ``` diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 4893f78082ae..d1694dcffd1d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -24,7 +24,7 @@ OpenAPI spec version: 1.0.0 - + diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiClient.cs index c1533a0ae4ac..54ee6c970518 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -388,14 +388,27 @@ private ApiResponse Exec(RestRequest req, IReadableConfiguration configura var existingDeserializer = req.JsonSerializer as IDeserializer; if (existingDeserializer != null) { - client.AddHandler(() => existingDeserializer, "application/json", "text/json", "text/x-json", "text/javascript", "*+json"); + client.AddHandler("application/json", () => existingDeserializer); + client.AddHandler("text/json", () => existingDeserializer); + client.AddHandler("text/x-json", () => existingDeserializer); + client.AddHandler("text/javascript", () => existingDeserializer); + client.AddHandler("*+json", () => existingDeserializer); } else { - client.AddHandler(() => new CustomJsonCodec(configuration), "application/json", "text/json", "text/x-json", "text/javascript", "*+json"); + var customDeserializer = new CustomJsonCodec(configuration); + client.AddHandler("application/json", () => customDeserializer); + client.AddHandler("text/json", () => customDeserializer); + client.AddHandler("text/x-json", () => customDeserializer); + client.AddHandler("text/javascript", () => customDeserializer); + client.AddHandler("*+json", () => customDeserializer); } - client.AddHandler(() => new XmlDeserializer(), "application/xml", "text/xml", "*+xml", "*"); + var xmlDeserializer = new XmlDeserializer(); + client.AddHandler("application/xml", () => xmlDeserializer); + client.AddHandler("text/xml", () => xmlDeserializer); + client.AddHandler("*+xml", () => xmlDeserializer); + client.AddHandler("*", () => xmlDeserializer); client.Timeout = configuration.Timeout; @@ -458,14 +471,27 @@ private ApiResponse Exec(RestRequest req, IReadableConfiguration configura var existingDeserializer = req.JsonSerializer as IDeserializer; if (existingDeserializer != null) { - client.AddHandler(() => existingDeserializer, "application/json", "text/json", "text/x-json", "text/javascript", "*+json"); + client.AddHandler("application/json", () => existingDeserializer); + client.AddHandler("text/json", () => existingDeserializer); + client.AddHandler("text/x-json", () => existingDeserializer); + client.AddHandler("text/javascript", () => existingDeserializer); + client.AddHandler("*+json", () => existingDeserializer); } else { - client.AddHandler(() => new CustomJsonCodec(configuration), "application/json", "text/json", "text/x-json", "text/javascript", "*+json"); + var customDeserializer = new CustomJsonCodec(configuration); + client.AddHandler("application/json", () => customDeserializer); + client.AddHandler("text/json", () => customDeserializer); + client.AddHandler("text/x-json", () => customDeserializer); + client.AddHandler("text/javascript", () => customDeserializer); + client.AddHandler("*+json", () => customDeserializer); } - client.AddHandler(() => new XmlDeserializer(), "application/xml", "text/xml", "*+xml", "*"); + var xmlDeserializer = new XmlDeserializer(); + client.AddHandler("application/xml", () => xmlDeserializer); + client.AddHandler("text/xml", () => xmlDeserializer); + client.AddHandler("*+xml", () => xmlDeserializer); + client.AddHandler("*", () => xmlDeserializer); client.Timeout = configuration.Timeout; diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 13e44d29d9f3..2a7da9dc2ca5 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -20,11 +20,11 @@ - - - - - + + + + +