diff --git a/samples/WithoutMiddleware/Sample.AspNetCore20/nswag_project_swagger.json b/samples/WithoutMiddleware/Sample.AspNetCore20/nswag_project_swagger.json index 4de346af3d..4fc4af3a02 100644 --- a/samples/WithoutMiddleware/Sample.AspNetCore20/nswag_project_swagger.json +++ b/samples/WithoutMiddleware/Sample.AspNetCore20/nswag_project_swagger.json @@ -1,5 +1,5 @@ { - "x-generator": "NSwag v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v10.0.0.0))", + "x-generator": "NSwag v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v10.0.0.0))", "swagger": "2.0", "info": { "title": "My Title", diff --git a/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_assembly_swagger.json b/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_assembly_swagger.json index 4bffe9059f..854740ba09 100644 --- a/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_assembly_swagger.json +++ b/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_assembly_swagger.json @@ -1,5 +1,5 @@ { - "x-generator": "NSwag v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", + "x-generator": "NSwag v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", "swagger": "2.0", "info": { "title": "My Title", diff --git a/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_project_swagger.json b/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_project_swagger.json index 4bffe9059f..854740ba09 100644 --- a/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_project_swagger.json +++ b/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_project_swagger.json @@ -1,5 +1,5 @@ { - "x-generator": "NSwag v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", + "x-generator": "NSwag v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", "swagger": "2.0", "info": { "title": "My Title", diff --git a/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_reflection_swagger.json b/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_reflection_swagger.json index 6915f772fb..1a5951a1b7 100644 --- a/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_reflection_swagger.json +++ b/samples/WithoutMiddleware/Sample.AspNetCore21/nswag_reflection_swagger.json @@ -1,5 +1,5 @@ { - "x-generator": "NSwag v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", + "x-generator": "NSwag v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", "swagger": "2.0", "info": { "title": "My Title", diff --git a/src/NSwag.Annotations/NSwag.Annotations.csproj b/src/NSwag.Annotations/NSwag.Annotations.csproj index c89b55adb0..cb8b4c7599 100644 --- a/src/NSwag.Annotations/NSwag.Annotations.csproj +++ b/src/NSwag.Annotations/NSwag.Annotations.csproj @@ -2,7 +2,7 @@ netstandard1.0;net45;netstandard2.0 NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript - 13.6.2 + 13.7.0 OpenAPI Swagger AspNetCore Documentation CodeGen TypeScript WebApi AspNet Copyright © Rico Suter, 2020 MIT diff --git a/src/NSwag.ApiDescription.Client/NSwag.ApiDescription.Client.nuspec b/src/NSwag.ApiDescription.Client/NSwag.ApiDescription.Client.nuspec index 14512014e5..20ba0cf5d1 100644 --- a/src/NSwag.ApiDescription.Client/NSwag.ApiDescription.Client.nuspec +++ b/src/NSwag.ApiDescription.Client/NSwag.ApiDescription.Client.nuspec @@ -2,7 +2,7 @@ NSwag.ApiDescription.Client - 13.6.2 + 13.7.0 Rico Suter Rico Suter false @@ -16,7 +16,7 @@ true - + diff --git a/src/NSwag.AspNet.Owin/NSwag.AspNet.Owin.csproj b/src/NSwag.AspNet.Owin/NSwag.AspNet.Owin.csproj index d4e82e91f8..a306198836 100644 --- a/src/NSwag.AspNet.Owin/NSwag.AspNet.Owin.csproj +++ b/src/NSwag.AspNet.Owin/NSwag.AspNet.Owin.csproj @@ -2,7 +2,7 @@ net45 NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript - 13.6.2 + 13.7.0 OpenAPI Swagger AspNetCore Documentation CodeGen TypeScript WebApi AspNet Copyright © Rico Suter, 2020 MIT @@ -49,7 +49,7 @@ - + diff --git a/src/NSwag.AspNet.WebApi/NSwag.AspNet.WebApi.csproj b/src/NSwag.AspNet.WebApi/NSwag.AspNet.WebApi.csproj index d5827aa6cb..8e354280a9 100644 --- a/src/NSwag.AspNet.WebApi/NSwag.AspNet.WebApi.csproj +++ b/src/NSwag.AspNet.WebApi/NSwag.AspNet.WebApi.csproj @@ -2,7 +2,7 @@ net45 NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript - 13.6.2 + 13.7.0 OpenAPI Swagger AspNetCore Documentation CodeGen TypeScript WebApi AspNet Copyright © Rico Suter, 2020 MIT @@ -25,7 +25,7 @@ - + diff --git a/src/NSwag.AspNetCore.Launcher.x86/NSwag.AspNetCore.Launcher.x86.csproj b/src/NSwag.AspNetCore.Launcher.x86/NSwag.AspNetCore.Launcher.x86.csproj index 617a09880b..d4e8da6192 100644 --- a/src/NSwag.AspNetCore.Launcher.x86/NSwag.AspNetCore.Launcher.x86.csproj +++ b/src/NSwag.AspNetCore.Launcher.x86/NSwag.AspNetCore.Launcher.x86.csproj @@ -4,7 +4,7 @@ x86 Exe false - 13.6.2 + 13.7.0 Rico Suter Rico Suter NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript diff --git a/src/NSwag.AspNetCore.Launcher/NSwag.AspNetCore.Launcher.csproj b/src/NSwag.AspNetCore.Launcher/NSwag.AspNetCore.Launcher.csproj index 0c5698f79f..6166f2134e 100644 --- a/src/NSwag.AspNetCore.Launcher/NSwag.AspNetCore.Launcher.csproj +++ b/src/NSwag.AspNetCore.Launcher/NSwag.AspNetCore.Launcher.csproj @@ -4,7 +4,7 @@ x64 Exe false - 13.6.2 + 13.7.0 Rico Suter Rico Suter NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript diff --git a/src/NSwag.AspNetCore/ApiverseUiSettings.cs b/src/NSwag.AspNetCore/ApiverseUiSettings.cs index ad8ce760bc..ec546dc26b 100644 --- a/src/NSwag.AspNetCore/ApiverseUiSettings.cs +++ b/src/NSwag.AspNetCore/ApiverseUiSettings.cs @@ -1,5 +1,5 @@ //----------------------------------------------------------------------- -// +// // Copyright (c) Rico Suter. All rights reserved. // // https://github.com/RicoSuter/NSwag/blob/master/LICENSE.md @@ -11,12 +11,12 @@ namespace NSwag.AspNetCore { /// - /// The Apiverse.io UI settings. + /// The Apimundo UI settings. /// - public class ApiverseUiSettings : SwaggerUiSettingsBase + public class ApimundoUiSettings : SwaggerUiSettingsBase { - /// Initializes a new instance of the class. - public ApiverseUiSettings() + /// Initializes a new instance of the class. + public ApimundoUiSettings() { DocumentPath = "swagger/v1/swagger.json"; } @@ -27,9 +27,9 @@ public ApiverseUiSettings() public string CompareWith { get; set; } /// - /// Gets or sets the Apiverse.io instance URL. + /// Gets or sets the Apimundo instance URL. /// - public string ApiverseUrl { get; set; } = "https://apiverse.io"; + public string ApimundoUrl { get; set; } = "https://apimundo.com"; internal override string TransformHtml(string html, HttpRequest request) { diff --git a/src/NSwag.AspNetCore/Extensions/NSwagApplicationBuilderExtensions.cs b/src/NSwag.AspNetCore/Extensions/NSwagApplicationBuilderExtensions.cs index 2efe661118..82e88c8f4c 100644 --- a/src/NSwag.AspNetCore/Extensions/NSwagApplicationBuilderExtensions.cs +++ b/src/NSwag.AspNetCore/Extensions/NSwagApplicationBuilderExtensions.cs @@ -147,17 +147,17 @@ public static IApplicationBuilder UseSwaggerUi( return app; } - /// Adds a redirect to the Apiverse.io user interface to the pipeline (default route: /apiverse). + /// Adds a redirect to the Apimundo.com user interface to the pipeline (default route: /apimundo). /// The settings.GeneratorSettings property does not have any effect. /// The app. /// Configure the UI settings. /// The app builder. - public static IApplicationBuilder UseApiverse( + public static IApplicationBuilder UseApimundo( this IApplicationBuilder app, - Action configure = null) + Action configure = null) { - var settings = configure == null ? app.ApplicationServices.GetService>()?.Value : null ?? new ApiverseUiSettings(); - settings.Path = "/apiverse"; + var settings = configure == null ? app.ApplicationServices.GetService>()?.Value : null ?? new ApimundoUiSettings(); + settings.Path = "/apimundo"; configure?.Invoke(settings); var path = settings.Path; @@ -175,10 +175,10 @@ await context.Response.WriteAsync(@" - NSwag to Apiverse.to + NSwag to Apimundo -
net451;netstandard1.6;netstandard2.0 NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript - 13.6.2 + 13.7.0 Swagger Documentation AspNetCore NetCore TypeScript CodeGen Copyright © Rico Suter, 2020 https://github.com/RicoSuter/NSwag/blob/master/LICENSE.md diff --git a/src/NSwag.AssemblyLoader/NSwag.AssemblyLoader.csproj b/src/NSwag.AssemblyLoader/NSwag.AssemblyLoader.csproj index bfb75f79e4..1b59ed72e5 100644 --- a/src/NSwag.AssemblyLoader/NSwag.AssemblyLoader.csproj +++ b/src/NSwag.AssemblyLoader/NSwag.AssemblyLoader.csproj @@ -2,7 +2,7 @@ netstandard1.6;net451;netstandard2.0 NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript - 13.6.2 + 13.7.0 OpenAPI Swagger AspNetCore Documentation CodeGen TypeScript WebApi AspNet Copyright © Rico Suter, 2020 MIT @@ -26,7 +26,7 @@ TRACE;RELEASE;FullNet;NET451 - + diff --git a/src/NSwag.CodeGeneration.CSharp.Tests/ArrayParameterTests.cs b/src/NSwag.CodeGeneration.CSharp.Tests/ArrayParameterTests.cs index fef2df92af..72854278d7 100644 --- a/src/NSwag.CodeGeneration.CSharp.Tests/ArrayParameterTests.cs +++ b/src/NSwag.CodeGeneration.CSharp.Tests/ArrayParameterTests.cs @@ -66,7 +66,7 @@ public async Task When_parameter_is_array_then_CSharp_is_correct() var code = generator.GenerateFile(); //// Assert - Assert.Contains(@"foreach (var item_ in elementId) { urlBuilder_.Append(System.Uri.EscapeDataString(""elementId"") + ""="").Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append(""&""); }", code); + Assert.Contains(@"foreach (var item_ in elementId) { urlBuilder_.Append(System.Uri.EscapeDataString(""elementId"") + ""="").Append((item_ == null) ? """" : System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append(""&""); }", code); } } } diff --git a/src/NSwag.CodeGeneration.CSharp.Tests/FileUploadTests.cs b/src/NSwag.CodeGeneration.CSharp.Tests/FileUploadTests.cs index 42b07a082d..e25858515c 100644 --- a/src/NSwag.CodeGeneration.CSharp.Tests/FileUploadTests.cs +++ b/src/NSwag.CodeGeneration.CSharp.Tests/FileUploadTests.cs @@ -14,7 +14,7 @@ public async Task When_openapi3_contains_octet_stream_response_then_FileResponse ""x-generator"": ""NSwag v13.0.6.0 (NJsonSchema v10.0.23.0 (Newtonsoft.Json v12.0.0.0))"", ""openapi"": ""3.0.0"", ""info"": { - ""title"": ""Apiverse API"", + ""title"": ""Apimundo API"", ""version"": ""1.0.0"" }, ""paths"": { diff --git a/src/NSwag.CodeGeneration.CSharp/NSwag.CodeGeneration.CSharp.csproj b/src/NSwag.CodeGeneration.CSharp/NSwag.CodeGeneration.CSharp.csproj index c93624f645..9fac7056bb 100644 --- a/src/NSwag.CodeGeneration.CSharp/NSwag.CodeGeneration.CSharp.csproj +++ b/src/NSwag.CodeGeneration.CSharp/NSwag.CodeGeneration.CSharp.csproj @@ -2,7 +2,7 @@ netstandard1.3;net451;netstandard2.0 NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript - 13.6.2 + 13.7.0 OpenAPI Swagger AspNetCore Documentation CodeGen TypeScript WebApi AspNet Copyright © Rico Suter, 2020 MIT @@ -67,6 +67,6 @@ - + \ No newline at end of file diff --git a/src/NSwag.CodeGeneration.TypeScript/NSwag.CodeGeneration.TypeScript.csproj b/src/NSwag.CodeGeneration.TypeScript/NSwag.CodeGeneration.TypeScript.csproj index 8d2ada16a9..3203672055 100644 --- a/src/NSwag.CodeGeneration.TypeScript/NSwag.CodeGeneration.TypeScript.csproj +++ b/src/NSwag.CodeGeneration.TypeScript/NSwag.CodeGeneration.TypeScript.csproj @@ -2,7 +2,7 @@ netstandard1.3;net451;netstandard2.0 NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript - 13.6.2 + 13.7.0 OpenAPI Swagger AspNetCore Documentation CodeGen TypeScript WebApi AspNet Copyright © Rico Suter, 2020 MIT @@ -51,6 +51,6 @@ - + \ No newline at end of file diff --git a/src/NSwag.CodeGeneration/NSwag.CodeGeneration.csproj b/src/NSwag.CodeGeneration/NSwag.CodeGeneration.csproj index 663803d1c9..fee92f055d 100644 --- a/src/NSwag.CodeGeneration/NSwag.CodeGeneration.csproj +++ b/src/NSwag.CodeGeneration/NSwag.CodeGeneration.csproj @@ -2,7 +2,7 @@ netstandard1.3;net451;netstandard2.0 NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript - 13.6.2 + 13.7.0 OpenAPI Swagger AspNetCore Documentation CodeGen TypeScript WebApi AspNet Copyright © Rico Suter, 2020 MIT @@ -21,8 +21,8 @@ - - + + diff --git a/src/NSwag.Commands/NSwag.Commands.csproj b/src/NSwag.Commands/NSwag.Commands.csproj index 53d7d11184..53c4dda375 100644 --- a/src/NSwag.Commands/NSwag.Commands.csproj +++ b/src/NSwag.Commands/NSwag.Commands.csproj @@ -2,7 +2,7 @@ netcoreapp1.0;netcoreapp1.1;netcoreapp2.0;netcoreapp2.1;netcoreapp2.2;netcoreapp3.0;net461 NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript - 13.6.2 + 13.7.0 OpenAPI Swagger AspNetCore Documentation CodeGen TypeScript WebApi AspNet Copyright © Rico Suter, 2020 MIT @@ -74,11 +74,11 @@ - - - - - + + + + + diff --git a/src/NSwag.Console.x86/NSwag.Console.x86.csproj b/src/NSwag.Console.x86/NSwag.Console.x86.csproj index c40daaf14e..0483298b62 100644 --- a/src/NSwag.Console.x86/NSwag.Console.x86.csproj +++ b/src/NSwag.Console.x86/NSwag.Console.x86.csproj @@ -5,7 +5,7 @@ net461 NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript - 13.6.2 + 13.7.0 OpenAPI Swagger AspNetCore Documentation CodeGen TypeScript WebApi AspNet Copyright © Rico Suter, 2020 https://github.com/RicoSuter/NSwag/blob/master/LICENSE.md diff --git a/src/NSwag.Console/NSwag.Console.csproj b/src/NSwag.Console/NSwag.Console.csproj index 4dc8403732..a68fd08e15 100644 --- a/src/NSwag.Console/NSwag.Console.csproj +++ b/src/NSwag.Console/NSwag.Console.csproj @@ -5,7 +5,7 @@ net461 NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript - 13.6.2 + 13.7.0 OpenAPI Swagger AspNetCore Documentation CodeGen TypeScript WebApi AspNet Copyright © Rico Suter, 2020 https://github.com/RicoSuter/NSwag/blob/master/LICENSE.md diff --git a/src/NSwag.ConsoleCore/NSwag.ConsoleCore.csproj b/src/NSwag.ConsoleCore/NSwag.ConsoleCore.csproj index 080c10d665..085b9266cb 100644 --- a/src/NSwag.ConsoleCore/NSwag.ConsoleCore.csproj +++ b/src/NSwag.ConsoleCore/NSwag.ConsoleCore.csproj @@ -3,7 +3,7 @@ netcoreapp2.1;netcoreapp2.2;netcoreapp3.0;netcoreapp3.1 Exe NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript - 13.6.2 + 13.7.0 OpenAPI Swagger AspNetCore Documentation CodeGen TypeScript WebApi AspNet Copyright © Rico Suter, 2020 MIT diff --git a/src/NSwag.Core.Yaml/NSwag.Core.Yaml.csproj b/src/NSwag.Core.Yaml/NSwag.Core.Yaml.csproj index b084c7d019..c7a238c517 100644 --- a/src/NSwag.Core.Yaml/NSwag.Core.Yaml.csproj +++ b/src/NSwag.Core.Yaml/NSwag.Core.Yaml.csproj @@ -2,7 +2,7 @@ netstandard1.3;net45;netstandard2.0 NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript - 13.6.2 + 13.7.0 OpenAPI Swagger AspNetCore Documentation CodeGen TypeScript WebApi AspNet Copyright © Rico Suter, 2020 MIT @@ -18,7 +18,7 @@ NSwag - + diff --git a/src/NSwag.Core/NSwag.Core.csproj b/src/NSwag.Core/NSwag.Core.csproj index 72fde56fae..54a0a4838a 100644 --- a/src/NSwag.Core/NSwag.Core.csproj +++ b/src/NSwag.Core/NSwag.Core.csproj @@ -2,7 +2,7 @@ netstandard1.0;net45;netstandard2.0 NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript - 13.6.2 + 13.7.0 OpenAPI Swagger AspNetCore Documentation CodeGen TypeScript WebApi AspNet Copyright © Rico Suter, 2020 MIT @@ -25,7 +25,7 @@ - + diff --git a/src/NSwag.Demo.Web/NSwag.Demo.Web.csproj b/src/NSwag.Demo.Web/NSwag.Demo.Web.csproj index 1a8f54be97..5fbe5f6148 100644 --- a/src/NSwag.Demo.Web/NSwag.Demo.Web.csproj +++ b/src/NSwag.Demo.Web/NSwag.Demo.Web.csproj @@ -70,8 +70,8 @@ ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll True - - ..\packages\NJsonSchema.10.1.23\lib\net45\NJsonSchema.dll + + ..\packages\NJsonSchema.10.1.24\lib\net45\NJsonSchema.dll ..\packages\Owin.1.0\lib\net40\Owin.dll diff --git a/src/NSwag.Generation.AspNetCore/NSwag.Generation.AspNetCore.csproj b/src/NSwag.Generation.AspNetCore/NSwag.Generation.AspNetCore.csproj index d005837394..82bd6b5740 100644 --- a/src/NSwag.Generation.AspNetCore/NSwag.Generation.AspNetCore.csproj +++ b/src/NSwag.Generation.AspNetCore/NSwag.Generation.AspNetCore.csproj @@ -2,7 +2,7 @@ netstandard1.6;net451;netstandard2.0 NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript - 13.6.2 + 13.7.0 Swagger Documentation AspNetCore Copyright © Rico Suter, 2020 MIT @@ -24,7 +24,7 @@ $(DefineConstants);TRACE;DEBUG - + diff --git a/src/NSwag.Generation.WebApi.Tests/NSwag.Generation.WebApi.Tests.csproj b/src/NSwag.Generation.WebApi.Tests/NSwag.Generation.WebApi.Tests.csproj index a50ca59dbc..33c36b180e 100644 --- a/src/NSwag.Generation.WebApi.Tests/NSwag.Generation.WebApi.Tests.csproj +++ b/src/NSwag.Generation.WebApi.Tests/NSwag.Generation.WebApi.Tests.csproj @@ -53,14 +53,14 @@ ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll True - - ..\packages\NJsonSchema.10.1.23\lib\net45\NJsonSchema.dll + + ..\packages\NJsonSchema.10.1.24\lib\net45\NJsonSchema.dll - - ..\packages\NJsonSchema.CodeGeneration.10.1.23\lib\net451\NJsonSchema.CodeGeneration.dll + + ..\packages\NJsonSchema.CodeGeneration.10.1.24\lib\net451\NJsonSchema.CodeGeneration.dll - - ..\packages\NJsonSchema.CodeGeneration.TypeScript.10.1.23\lib\net451\NJsonSchema.CodeGeneration.TypeScript.dll + + ..\packages\NJsonSchema.CodeGeneration.TypeScript.10.1.24\lib\net451\NJsonSchema.CodeGeneration.TypeScript.dll ..\packages\Swashbuckle.Core.5.5.3\lib\net40\Swashbuckle.Core.dll diff --git a/src/NSwag.Generation.WebApi/NSwag.Generation.WebApi.csproj b/src/NSwag.Generation.WebApi/NSwag.Generation.WebApi.csproj index 41346326c4..b502ff58b7 100644 --- a/src/NSwag.Generation.WebApi/NSwag.Generation.WebApi.csproj +++ b/src/NSwag.Generation.WebApi/NSwag.Generation.WebApi.csproj @@ -2,7 +2,7 @@ netstandard1.0;net45;netstandard2.0 NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript - 13.6.2 + 13.7.0 OpenAPI Swagger AspNetCore Documentation CodeGen TypeScript WebApi AspNet Copyright © Rico Suter, 2020 MIT @@ -24,7 +24,7 @@ - + diff --git a/src/NSwag.Generation/NSwag.Generation.csproj b/src/NSwag.Generation/NSwag.Generation.csproj index 78a03f3899..d177882aba 100644 --- a/src/NSwag.Generation/NSwag.Generation.csproj +++ b/src/NSwag.Generation/NSwag.Generation.csproj @@ -2,7 +2,7 @@ netstandard1.0;net45;netstandard2.0 NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript - 13.6.2 + 13.7.0 OpenAPI Swagger AspNetCore Documentation CodeGen TypeScript WebApi AspNet Copyright © Rico Suter, 2020 MIT @@ -24,7 +24,7 @@ - + diff --git a/src/NSwag.Integration.ClientPCL/PetStoreClient.cs b/src/NSwag.Integration.ClientPCL/PetStoreClient.cs index 1594af1f6b..c546727266 100644 --- a/src/NSwag.Integration.ClientPCL/PetStoreClient.cs +++ b/src/NSwag.Integration.ClientPCL/PetStoreClient.cs @@ -1,6 +1,6 @@ //---------------------- // -// Generated using the NSwag toolchain v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) // //---------------------- @@ -14,7 +14,7 @@ namespace PetStore { using System = global::System; - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial interface IPetStoreClient { /// uploads an image @@ -264,7 +264,7 @@ public partial interface IPetStoreClient } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class PetStoreClient : IPetStoreClient { private string _baseUrl = "https://petstore.swagger.io/v2"; @@ -363,20 +363,21 @@ public async System.Threading.Tasks.Task UploadFileAsync(long petId ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } return objectResponse_.Object; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(ApiResponse); } finally { @@ -439,17 +440,21 @@ protected async System.Threading.Tasks.Task AddPetCoreAsync(Pet body, System.Thr ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "405") + var status_ = (int)response_.StatusCode; + if (status_ == 405) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("Invalid input", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("Invalid input", status_, responseText_, headers_, null); + } + else + if (status_ == 200 || status_ == 204) + { + return; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -513,29 +518,33 @@ public async System.Threading.Tasks.Task UpdatePetAsync(Pet body, System.Threadi ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "400") + var status_ = (int)response_.StatusCode; + if (status_ == 400) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("Invalid ID supplied", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("Invalid ID supplied", status_, responseText_, headers_, null); } else - if (status_ == "404") + if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("Pet not found", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("Pet not found", status_, responseText_, headers_, null); } else - if (status_ == "405") + if (status_ == 405) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("Validation exception", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("Validation exception", status_, responseText_, headers_, null); + } + else + if (status_ == 200 || status_ == 204) + { + return; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -573,7 +582,7 @@ public async System.Threading.Tasks.Task UpdatePetAsync(Pet body, System.Threadi var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/pet/findByStatus?"); - foreach (var item_ in status) { urlBuilder_.Append(System.Uri.EscapeDataString("status") + "=").Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } + foreach (var item_ in status) { urlBuilder_.Append(System.Uri.EscapeDataString("status") + "=").Append((item_ == null) ? "" : System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = new System.Net.Http.HttpClient(); @@ -601,26 +610,27 @@ public async System.Threading.Tasks.Task UpdatePetAsync(Pet body, System.Threadi ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } return objectResponse_.Object; } else - if (status_ == "400") + if (status_ == 400) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("Invalid status value", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("Invalid status value", status_, responseText_, headers_, null); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(System.Collections.Generic.ICollection); } finally { @@ -659,7 +669,7 @@ public async System.Threading.Tasks.Task UpdatePetAsync(Pet body, System.Threadi var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/pet/findByTags?"); - foreach (var item_ in tags) { urlBuilder_.Append(System.Uri.EscapeDataString("tags") + "=").Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } + foreach (var item_ in tags) { urlBuilder_.Append(System.Uri.EscapeDataString("tags") + "=").Append((item_ == null) ? "" : System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = new System.Net.Http.HttpClient(); @@ -687,26 +697,27 @@ public async System.Threading.Tasks.Task UpdatePetAsync(Pet body, System.Threadi ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } return objectResponse_.Object; } else - if (status_ == "400") + if (status_ == 400) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("Invalid tag value", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("Invalid tag value", status_, responseText_, headers_, null); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(System.Collections.Generic.ICollection); } finally { @@ -770,32 +781,33 @@ public async System.Threading.Tasks.Task GetPetByIdAsync(long petId, System ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } return objectResponse_.Object; } else - if (status_ == "400") + if (status_ == 400) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("Invalid ID supplied", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("Invalid ID supplied", status_, responseText_, headers_, null); } else - if (status_ == "404") + if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("Pet not found", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("Pet not found", status_, responseText_, headers_, null); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(Pet); } finally { @@ -866,17 +878,21 @@ public async System.Threading.Tasks.Task UpdatePetWithFormAsync(long petId, stri ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "405") + var status_ = (int)response_.StatusCode; + if (status_ == 405) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("Invalid input", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("Invalid input", status_, responseText_, headers_, null); + } + else + if (status_ == 200 || status_ == 204) + { + return; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -940,23 +956,27 @@ public async System.Threading.Tasks.Task DeletePetAsync(string api_key, long pet ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "400") + var status_ = (int)response_.StatusCode; + if (status_ == 400) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("Invalid ID supplied", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("Invalid ID supplied", status_, responseText_, headers_, null); } else - if (status_ == "404") + if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("Pet not found", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("Pet not found", status_, responseText_, headers_, null); + } + else + if (status_ == 200 || status_ == 204) + { + return; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -1023,26 +1043,27 @@ public async System.Threading.Tasks.Task PlaceOrderAsync(Order body, Syst ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } return objectResponse_.Object; } else - if (status_ == "400") + if (status_ == 400) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("Invalid Order", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("Invalid Order", status_, responseText_, headers_, null); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(Order); } finally { @@ -1106,32 +1127,33 @@ public async System.Threading.Tasks.Task GetOrderByIdAsync(long orderId, ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } return objectResponse_.Object; } else - if (status_ == "400") + if (status_ == 400) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("Invalid ID supplied", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("Invalid ID supplied", status_, responseText_, headers_, null); } else - if (status_ == "404") + if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("Order not found", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("Order not found", status_, responseText_, headers_, null); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(Order); } finally { @@ -1192,23 +1214,27 @@ public async System.Threading.Tasks.Task DeleteOrderAsync(long orderId, System.T ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "400") + var status_ = (int)response_.StatusCode; + if (status_ == 400) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("Invalid ID supplied", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("Invalid ID supplied", status_, responseText_, headers_, null); } else - if (status_ == "404") + if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("Order not found", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("Order not found", status_, responseText_, headers_, null); + } + else + if (status_ == 200 || status_ == 204) + { + return; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -1267,20 +1293,21 @@ public async System.Threading.Tasks.Task DeleteOrderAsync(long orderId, System.T ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } return objectResponse_.Object; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(System.Collections.Generic.IDictionary); } finally { @@ -1345,7 +1372,7 @@ public async System.Threading.Tasks.Task CreateUsersWithArrayInputAsync(System.C ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); + var status_ = (int)response_.StatusCode; } finally { @@ -1410,7 +1437,7 @@ public async System.Threading.Tasks.Task CreateUsersWithListInputAsync(System.Co ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); + var status_ = (int)response_.StatusCode; } finally { @@ -1474,32 +1501,33 @@ public async System.Threading.Tasks.Task GetUserByNameAsync(string usernam ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } return objectResponse_.Object; } else - if (status_ == "400") + if (status_ == 400) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("Invalid username supplied", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("Invalid username supplied", status_, responseText_, headers_, null); } else - if (status_ == "404") + if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("User not found", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("User not found", status_, responseText_, headers_, null); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(User); } finally { @@ -1568,23 +1596,27 @@ public async System.Threading.Tasks.Task UpdateUserAsync(string username, User b ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "400") + var status_ = (int)response_.StatusCode; + if (status_ == 400) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("Invalid user supplied", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("Invalid user supplied", status_, responseText_, headers_, null); } else - if (status_ == "404") + if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("User not found", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("User not found", status_, responseText_, headers_, null); + } + else + if (status_ == 200 || status_ == 204) + { + return; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -1646,23 +1678,27 @@ public async System.Threading.Tasks.Task DeleteUserAsync(string username, System ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "400") + var status_ = (int)response_.StatusCode; + if (status_ == 400) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("Invalid username supplied", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("Invalid username supplied", status_, responseText_, headers_, null); } else - if (status_ == "404") + if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("User not found", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("User not found", status_, responseText_, headers_, null); + } + else + if (status_ == 200 || status_ == 204) + { + return; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -1734,26 +1770,27 @@ public async System.Threading.Tasks.Task LoginUserAsync(string username, ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } return objectResponse_.Object; } else - if (status_ == "400") + if (status_ == 400) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("Invalid username/password supplied", (int)response_.StatusCode, responseText_, headers_, null); + throw new SwaggerException("Invalid username/password supplied", status_, responseText_, headers_, null); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(string); } finally { @@ -1810,7 +1847,7 @@ public async System.Threading.Tasks.Task LogoutUserAsync(System.Threading.Cancel ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); + var status_ = (int)response_.StatusCode; } finally { @@ -1875,7 +1912,7 @@ public async System.Threading.Tasks.Task CreateUserAsync(User body, System.Threa ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); + var status_ = (int)response_.StatusCode; } finally { @@ -1950,6 +1987,11 @@ protected virtual async System.Threading.Tasks.Task> Rea private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { + if (value == null) + { + return null; + } + if (value is System.Enum) { var name = System.Enum.GetName(value.GetType(), value); @@ -1971,19 +2013,20 @@ private string ConvertToString(object value, System.Globalization.CultureInfo cu } else if (value is bool) { - return System.Convert.ToString(value, cultureInfo)?.ToLowerInvariant(); + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } - else if (value != null && value.GetType().IsArray) + else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } - return System.Convert.ToString(value, cultureInfo); + var result = System.Convert.ToString(value, cultureInfo); + return (result is null) ? string.Empty : result; } } @@ -2537,11 +2580,11 @@ public enum OrderStatus } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class FileParameter { public FileParameter(System.IO.Stream data) - : this (data, null) + : this (data, null, null) { } @@ -2564,7 +2607,7 @@ public FileParameter(System.IO.Stream data, string fileName, string contentType) public string ContentType { get; private set; } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class SwaggerException : System.Exception { public int StatusCode { get; private set; } @@ -2587,7 +2630,7 @@ public override string ToString() } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class SwaggerException : SwaggerException { public TResult Result { get; private set; } diff --git a/src/NSwag.Integration.ClientPCL/ServiceClients.cs b/src/NSwag.Integration.ClientPCL/ServiceClients.cs index 6ae3d02612..cafba48c09 100644 --- a/src/NSwag.Integration.ClientPCL/ServiceClients.cs +++ b/src/NSwag.Integration.ClientPCL/ServiceClients.cs @@ -1,6 +1,6 @@ //---------------------- // -// Generated using the NSwag toolchain v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) // //---------------------- @@ -16,7 +16,7 @@ namespace NSwag.Integration.ClientPCL { using System = global::System; - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class GeoClient : ClientBase { private string _baseUrl = "http://localhost:13452"; @@ -91,19 +91,16 @@ public async System.Threading.Tasks.Task FromBodyTestAsync(GeoP ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "204") + var status_ = (int)response_.StatusCode; + if (status_ == 204) { - return new SwaggerResponse((int)response_.StatusCode, headers_); + return new SwaggerResponse(status_, headers_); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GeoClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new GeoClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse((int)response_.StatusCode, headers_); } finally { @@ -164,19 +161,16 @@ public async System.Threading.Tasks.Task FromUriTestAsync(doubl ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "204") + var status_ = (int)response_.StatusCode; + if (status_ == 204) { - return new SwaggerResponse((int)response_.StatusCode, headers_); + return new SwaggerResponse(status_, headers_); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GeoClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new GeoClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse((int)response_.StatusCode, headers_); } finally { @@ -233,19 +227,16 @@ public async System.Threading.Tasks.Task AddPolygonAsync(System ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "204") + var status_ = (int)response_.StatusCode; + if (status_ == 204) { - return new SwaggerResponse((int)response_.StatusCode, headers_); + return new SwaggerResponse(status_, headers_); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GeoClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new GeoClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse((int)response_.StatusCode, headers_); } finally { @@ -273,7 +264,7 @@ public async System.Threading.Tasks.Task FilterAsync(System.Col urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Geo/Filter?"); if (currentStates != null) { - foreach (var item_ in currentStates) { urlBuilder_.Append(System.Uri.EscapeDataString("currentStates") + "=").Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } + foreach (var item_ in currentStates) { urlBuilder_.Append(System.Uri.EscapeDataString("currentStates") + "=").Append((item_ == null) ? "" : System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } } urlBuilder_.Length--; @@ -302,19 +293,16 @@ public async System.Threading.Tasks.Task FilterAsync(System.Col ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "204") + var status_ = (int)response_.StatusCode; + if (status_ == 204) { - return new SwaggerResponse((int)response_.StatusCode, headers_); + return new SwaggerResponse(status_, headers_); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GeoClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new GeoClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse((int)response_.StatusCode, headers_); } finally { @@ -342,7 +330,7 @@ public async System.Threading.Tasks.Task FilterAsync(System.Col urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Geo/Reverse?"); if (values != null) { - foreach (var item_ in values) { urlBuilder_.Append(System.Uri.EscapeDataString("values") + "=").Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } + foreach (var item_ in values) { urlBuilder_.Append(System.Uri.EscapeDataString("values") + "=").Append((item_ == null) ? "" : System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } } urlBuilder_.Length--; @@ -372,20 +360,17 @@ public async System.Threading.Tasks.Task FilterAsync(System.Col ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_).ConfigureAwait(false); - return new SwaggerResponse>((int)response_.StatusCode, headers_, objectResponse_.Object); + return new SwaggerResponse>(status_, headers_, objectResponse_.Object); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GeoClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new GeoClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse>((int)response_.StatusCode, headers_, default(System.Collections.Generic.ICollection)); } finally { @@ -437,19 +422,16 @@ public async System.Threading.Tasks.Task RefreshAsync(System.Th ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "204") + var status_ = (int)response_.StatusCode; + if (status_ == 204) { - return new SwaggerResponse((int)response_.StatusCode, headers_); + return new SwaggerResponse(status_, headers_); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GeoClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new GeoClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse((int)response_.StatusCode, headers_); } finally { @@ -513,20 +495,21 @@ public async System.Threading.Tasks.Task> UploadFileAsync( ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); - return new SwaggerResponse((int)response_.StatusCode, headers_, objectResponse_.Object); + if (objectResponse_.Object == null) + { + throw new GeoClientException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return new SwaggerResponse(status_, headers_, objectResponse_.Object); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GeoClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new GeoClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse((int)response_.StatusCode, headers_, default(bool)); } finally { @@ -592,19 +575,16 @@ public async System.Threading.Tasks.Task UploadFilesAsync(Syste ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "204") + var status_ = (int)response_.StatusCode; + if (status_ == 204) { - return new SwaggerResponse((int)response_.StatusCode, headers_); + return new SwaggerResponse(status_, headers_); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GeoClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new GeoClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse((int)response_.StatusCode, headers_); } finally { @@ -663,29 +643,30 @@ public async System.Threading.Tasks.Task SaveItemsAsync(Generic ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "204") + var status_ = (int)response_.StatusCode; + if (status_ == 204) { - return new SwaggerResponse((int)response_.StatusCode, headers_); + return new SwaggerResponse(status_, headers_); } else - if (status_ == "450") + if (status_ == 450) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new GeoClientException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } var responseObject_ = objectResponse_.Object != null ? objectResponse_.Object : new System.Exception(); - responseObject_.Data.Add("HttpStatus", status_); + responseObject_.Data.Add("HttpStatus", status_.ToString()); responseObject_.Data.Add("HttpHeaders", headers_); responseObject_.Data.Add("HttpResponse", objectResponse_.Text); - throw new GeoClientException("A custom error occured.", (int)response_.StatusCode, objectResponse_.Text, headers_, responseObject_); + throw new GeoClientException("A custom error occured.", status_, objectResponse_.Text, headers_, responseObject_); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GeoClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new GeoClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse((int)response_.StatusCode, headers_); } finally { @@ -746,22 +727,19 @@ public async System.Threading.Tasks.Task GetUploadedFileAsync(int ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200" || status_ == "206") + var status_ = (int)response_.StatusCode; + if (status_ == 200 || status_ == 206) { var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); - var fileResponse_ = new FileResponse((int)response_.StatusCode, headers_, responseStream_, null, response_); + var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_); client_ = null; response_ = null; // response and client are disposed by FileResponse return fileResponse_; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GeoClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new GeoClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(FileResponse); } finally { @@ -819,20 +797,17 @@ public async System.Threading.Tasks.Task GetUploadedFileAsync(int ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); - return new SwaggerResponse((int)response_.StatusCode, headers_, objectResponse_.Object); + return new SwaggerResponse(status_, headers_, objectResponse_.Object); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new GeoClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new GeoClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse((int)response_.StatusCode, headers_, default(double?)); } finally { @@ -905,6 +880,11 @@ protected virtual async System.Threading.Tasks.Task> Rea private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { + if (value == null) + { + return null; + } + if (value is System.Enum) { var name = System.Enum.GetName(value.GetType(), value); @@ -926,23 +906,24 @@ private string ConvertToString(object value, System.Globalization.CultureInfo cu } else if (value is bool) { - return System.Convert.ToString(value, cultureInfo)?.ToLowerInvariant(); + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } - else if (value != null && value.GetType().IsArray) + else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } - return System.Convert.ToString(value, cultureInfo); + var result = System.Convert.ToString(value, cultureInfo); + return (result is null) ? string.Empty : result; } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class PersonsClient : ClientBase { private string _baseUrl = "http://localhost:13452"; @@ -1012,20 +993,17 @@ public string BaseUrl ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_).ConfigureAwait(false); - return new SwaggerResponse>((int)response_.StatusCode, headers_, objectResponse_.Object); + return new SwaggerResponse>(status_, headers_, objectResponse_.Object); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new PersonsClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new PersonsClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse>((int)response_.StatusCode, headers_, default(System.Collections.Generic.ICollection)); } finally { @@ -1082,19 +1060,16 @@ public async System.Threading.Tasks.Task AddAsync(Person person ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "204") + var status_ = (int)response_.StatusCode; + if (status_ == 204) { - return new SwaggerResponse((int)response_.StatusCode, headers_); + return new SwaggerResponse(status_, headers_); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new PersonsClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new PersonsClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse((int)response_.StatusCode, headers_); } finally { @@ -1151,20 +1126,17 @@ public async System.Threading.Tasks.Task AddAsync(Person person ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_).ConfigureAwait(false); - return new SwaggerResponse>((int)response_.StatusCode, headers_, objectResponse_.Object); + return new SwaggerResponse>(status_, headers_, objectResponse_.Object); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new PersonsClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new PersonsClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse>((int)response_.StatusCode, headers_, default(System.Collections.Generic.ICollection)); } finally { @@ -1219,20 +1191,17 @@ public async System.Threading.Tasks.Task AddAsync(Person person ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_).ConfigureAwait(false); - return new SwaggerResponse>((int)response_.StatusCode, headers_, objectResponse_.Object); + return new SwaggerResponse>(status_, headers_, objectResponse_.Object); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new PersonsClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new PersonsClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse>((int)response_.StatusCode, headers_, default(System.Collections.Generic.ICollection)); } finally { @@ -1290,30 +1259,31 @@ public async System.Threading.Tasks.Task> GetAsync(Syste ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "500") + var status_ = (int)response_.StatusCode; + if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new PersonsClientException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } var responseObject_ = objectResponse_.Object != null ? objectResponse_.Object : new PersonNotFoundException(); - responseObject_.Data.Add("HttpStatus", status_); + responseObject_.Data.Add("HttpStatus", status_.ToString()); responseObject_.Data.Add("HttpHeaders", headers_); responseObject_.Data.Add("HttpResponse", objectResponse_.Text); - throw new PersonsClientException("A server side error occurred.", (int)response_.StatusCode, objectResponse_.Text, headers_, responseObject_); + throw new PersonsClientException("A server side error occurred.", status_, objectResponse_.Text, headers_, responseObject_); } else - if (status_ == "200") + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); - return new SwaggerResponse((int)response_.StatusCode, headers_, objectResponse_.Object); + return new SwaggerResponse(status_, headers_, objectResponse_.Object); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new PersonsClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new PersonsClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse((int)response_.StatusCode, headers_, default(Person)); } finally { @@ -1368,19 +1338,16 @@ public async System.Threading.Tasks.Task DeleteAsync(System.Gui ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "204") + var status_ = (int)response_.StatusCode; + if (status_ == 204) { - return new SwaggerResponse((int)response_.StatusCode, headers_); + return new SwaggerResponse(status_, headers_); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new PersonsClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new PersonsClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse((int)response_.StatusCode, headers_); } finally { @@ -1438,20 +1405,17 @@ public async System.Threading.Tasks.Task> TransformAsync ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); - return new SwaggerResponse((int)response_.StatusCode, headers_, objectResponse_.Object); + return new SwaggerResponse(status_, headers_, objectResponse_.Object); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new PersonsClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new PersonsClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse((int)response_.StatusCode, headers_, default(Person)); } finally { @@ -1511,30 +1475,35 @@ public async System.Threading.Tasks.Task> ThrowAsync(Sys ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); - return new SwaggerResponse((int)response_.StatusCode, headers_, objectResponse_.Object); + if (objectResponse_.Object == null) + { + throw new PersonsClientException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return new SwaggerResponse(status_, headers_, objectResponse_.Object); } else - if (status_ == "500") + if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new PersonsClientException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } var responseObject_ = objectResponse_.Object != null ? objectResponse_.Object : new PersonNotFoundException(); - responseObject_.Data.Add("HttpStatus", status_); + responseObject_.Data.Add("HttpStatus", status_.ToString()); responseObject_.Data.Add("HttpHeaders", headers_); responseObject_.Data.Add("HttpResponse", objectResponse_.Text); - throw new PersonsClientException("A server side error occurred.", (int)response_.StatusCode, objectResponse_.Text, headers_, responseObject_); + throw new PersonsClientException("A server side error occurred.", status_, objectResponse_.Text, headers_, responseObject_); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new PersonsClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new PersonsClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse((int)response_.StatusCode, headers_, default(Person)); } finally { @@ -1598,30 +1567,35 @@ public async System.Threading.Tasks.Task> GetNameAsync(S ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); - return new SwaggerResponse((int)response_.StatusCode, headers_, objectResponse_.Object); + if (objectResponse_.Object == null) + { + throw new PersonsClientException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + return new SwaggerResponse(status_, headers_, objectResponse_.Object); } else - if (status_ == "500") + if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new PersonsClientException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } var responseObject_ = objectResponse_.Object != null ? objectResponse_.Object : new PersonNotFoundException(); - responseObject_.Data.Add("HttpStatus", status_); + responseObject_.Data.Add("HttpStatus", status_.ToString()); responseObject_.Data.Add("HttpHeaders", headers_); responseObject_.Data.Add("HttpResponse", objectResponse_.Text); - throw new PersonsClientException("A server side error occurred.", (int)response_.StatusCode, objectResponse_.Text, headers_, responseObject_); + throw new PersonsClientException("A server side error occurred.", status_, objectResponse_.Text, headers_, responseObject_); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new PersonsClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new PersonsClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse((int)response_.StatusCode, headers_, default(string)); } finally { @@ -1679,20 +1653,17 @@ public async System.Threading.Tasks.Task> AddXmlAsync(st ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); - return new SwaggerResponse((int)response_.StatusCode, headers_, objectResponse_.Object); + return new SwaggerResponse(status_, headers_, objectResponse_.Object); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new PersonsClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new PersonsClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse((int)response_.StatusCode, headers_, default(string)); } finally { @@ -1750,20 +1721,17 @@ public async System.Threading.Tasks.Task> UploadAsync(Sy ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); - return new SwaggerResponse((int)response_.StatusCode, headers_, objectResponse_.Object); + return new SwaggerResponse(status_, headers_, objectResponse_.Object); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new PersonsClientException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new PersonsClientException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return new SwaggerResponse((int)response_.StatusCode, headers_, default(byte[])); } finally { @@ -1836,6 +1804,11 @@ protected virtual async System.Threading.Tasks.Task> Rea private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { + if (value == null) + { + return null; + } + if (value is System.Enum) { var name = System.Enum.GetName(value.GetType(), value); @@ -1857,23 +1830,24 @@ private string ConvertToString(object value, System.Globalization.CultureInfo cu } else if (value is bool) { - return System.Convert.ToString(value, cultureInfo)?.ToLowerInvariant(); + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } - else if (value != null && value.GetType().IsArray) + else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } - return System.Convert.ToString(value, cultureInfo); + var result = System.Convert.ToString(value, cultureInfo); + return (result is null) ? string.Empty : result; } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] internal class JsonExceptionConverter : Newtonsoft.Json.JsonConverter { private readonly Newtonsoft.Json.Serialization.DefaultContractResolver _defaultContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver(); diff --git a/src/NSwag.Integration.ClientPCL/ServiceClientsContracts.cs b/src/NSwag.Integration.ClientPCL/ServiceClientsContracts.cs index 4f03c0a212..d254e5de7c 100644 --- a/src/NSwag.Integration.ClientPCL/ServiceClientsContracts.cs +++ b/src/NSwag.Integration.ClientPCL/ServiceClientsContracts.cs @@ -1,6 +1,6 @@ //---------------------- // -// Generated using the NSwag toolchain v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) // //---------------------- @@ -288,11 +288,11 @@ private string GetSubtypeDiscriminator(System.Type objectType) } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class FileParameter { public FileParameter(System.IO.Stream data) - : this (data, null) + : this (data, null, null) { } @@ -315,11 +315,11 @@ public FileParameter(System.IO.Stream data, string fileName, string contentType) public string ContentType { get; private set; } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class FileResponse : System.IDisposable { - private System.IDisposable _client; - private System.IDisposable _response; + private System.IDisposable _client; + private System.IDisposable _response; public int StatusCode { get; private set; } @@ -343,8 +343,7 @@ public FileResponse(int statusCode, System.Collections.Generic.IReadOnlyDictiona public void Dispose() { - if (Stream != null) - Stream.Dispose(); + Stream.Dispose(); if (_response != null) _response.Dispose(); if (_client != null) @@ -352,7 +351,7 @@ public void Dispose() } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class SwaggerResponse { public int StatusCode { get; private set; } @@ -366,7 +365,7 @@ public SwaggerResponse(int statusCode, System.Collections.Generic.IReadOnlyDicti } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class SwaggerResponse : SwaggerResponse { public TResult Result { get; private set; } @@ -378,7 +377,7 @@ public SwaggerResponse(int statusCode, System.Collections.Generic.IReadOnlyDicti } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class GeoClientException : System.Exception { public int StatusCode { get; private set; } @@ -401,7 +400,7 @@ public override string ToString() } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class GeoClientException : GeoClientException { public TResult Result { get; private set; } @@ -413,7 +412,7 @@ public GeoClientException(string message, int statusCode, string response, Syste } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class PersonsClientException : System.Exception { public int StatusCode { get; private set; } @@ -436,7 +435,7 @@ public override string ToString() } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class PersonsClientException : PersonsClientException { public TResult Result { get; private set; } diff --git a/src/NSwag.Integration.ClientPCL/UberClient.cs b/src/NSwag.Integration.ClientPCL/UberClient.cs index 2bbb2b4d84..ead1ccc279 100644 --- a/src/NSwag.Integration.ClientPCL/UberClient.cs +++ b/src/NSwag.Integration.ClientPCL/UberClient.cs @@ -1,6 +1,6 @@ //---------------------- // -// Generated using the NSwag toolchain v13.6.1.0 (NJsonSchema v10.1.21.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) // //---------------------- @@ -14,7 +14,7 @@ namespace Uber { using System = global::System; - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.1.0 (NJsonSchema v10.1.21.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class Client { private string _baseUrl = "https://api.uber.com/v1"; @@ -102,16 +102,24 @@ public string BaseUrl ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } return objectResponse_.Object; } else { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); - throw new SwaggerException("Unexpected error", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new SwaggerException("Unexpected error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } } finally @@ -193,16 +201,24 @@ public string BaseUrl ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } return objectResponse_.Object; } else { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); - throw new SwaggerException("Unexpected error", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new SwaggerException("Unexpected error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } } finally @@ -284,16 +300,24 @@ public string BaseUrl ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } return objectResponse_.Object; } else { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); - throw new SwaggerException("Unexpected error", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new SwaggerException("Unexpected error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } } finally @@ -350,16 +374,24 @@ public async System.Threading.Tasks.Task MeAsync(System.Threading.Cance ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } return objectResponse_.Object; } else { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); - throw new SwaggerException("Unexpected error", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new SwaggerException("Unexpected error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } } finally @@ -429,16 +461,24 @@ public async System.Threading.Tasks.Task HistoryAsync(int? offset, i ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } return objectResponse_.Object; } else { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); - throw new SwaggerException("Unexpected error", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } + throw new SwaggerException("Unexpected error", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } } finally @@ -512,9 +552,14 @@ protected virtual async System.Threading.Tasks.Task> Rea private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { + if (value == null) + { + return null; + } + if (value is System.Enum) { - string name = System.Enum.GetName(value.GetType(), value); + var name = System.Enum.GetName(value.GetType(), value); if (name != null) { var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); @@ -533,23 +578,24 @@ private string ConvertToString(object value, System.Globalization.CultureInfo cu } else if (value is bool) { - return System.Convert.ToString(value, cultureInfo).ToLowerInvariant(); + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } - else if (value != null && value.GetType().IsArray) + else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } - return System.Convert.ToString(value, cultureInfo); + var result = System.Convert.ToString(value, cultureInfo); + return (result is null) ? string.Empty : result; } } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v11.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Product : System.ComponentModel.INotifyPropertyChanged { private string _product_id; @@ -645,7 +691,7 @@ protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.Cal } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v11.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")] public partial class PriceEstimate : System.ComponentModel.INotifyPropertyChanged { private string _product_id; @@ -773,7 +819,7 @@ protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.Cal } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v11.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Profile : System.ComponentModel.INotifyPropertyChanged { private string _first_name; @@ -869,7 +915,7 @@ protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.Cal } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v11.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Activity : System.ComponentModel.INotifyPropertyChanged { private string _uuid; @@ -901,7 +947,7 @@ protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.Cal } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v11.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Activities : System.ComponentModel.INotifyPropertyChanged { private int? _offset; @@ -980,7 +1026,7 @@ protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.Cal } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v11.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Error : System.ComponentModel.INotifyPropertyChanged { private int? _code; @@ -1041,7 +1087,7 @@ protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.Cal } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.1.0 (NJsonSchema v10.1.21.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class SwaggerException : System.Exception { public int StatusCode { get; private set; } @@ -1050,8 +1096,8 @@ public partial class SwaggerException : System.Exception public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } - public SwaggerException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Exception innerException) - : base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + response.Substring(0, response.Length >= 512 ? 512 : response.Length), innerException) + public SwaggerException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Exception innerException) + : base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + ((response == null) ? "(null)" : response.Substring(0, response.Length >= 512 ? 512 : response.Length)), innerException) { StatusCode = statusCode; Response = response; @@ -1064,12 +1110,12 @@ public override string ToString() } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.1.0 (NJsonSchema v10.1.21.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class SwaggerException : SwaggerException { public TResult Result { get; private set; } - public SwaggerException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, TResult result, System.Exception innerException) + public SwaggerException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, TResult result, System.Exception innerException) : base(message, statusCode, response, headers, innerException) { Result = result; diff --git a/src/NSwag.Integration.ClientPCL/swagger.json b/src/NSwag.Integration.ClientPCL/swagger.json index 3d66b7689c..e075ce63b7 100644 --- a/src/NSwag.Integration.ClientPCL/swagger.json +++ b/src/NSwag.Integration.ClientPCL/swagger.json @@ -1,5 +1,5 @@ { - "x-generator": "NSwag v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", + "x-generator": "NSwag v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", "info": { "title": "Swagger specification", "version": "1.0.0" diff --git a/src/NSwag.Integration.Console/Controllers.cs b/src/NSwag.Integration.Console/Controllers.cs index 8a1b28d121..0fe9e5706d 100644 --- a/src/NSwag.Integration.Console/Controllers.cs +++ b/src/NSwag.Integration.Console/Controllers.cs @@ -1,6 +1,6 @@ //---------------------- // -// Generated using the NSwag toolchain v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) // //---------------------- @@ -16,7 +16,7 @@ namespace MyNamespace { using System = global::System; - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public interface IGeoController { System.Threading.Tasks.Task FromBodyTestAsync(GeoPoint location); @@ -43,7 +43,7 @@ public interface IGeoController } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class GeoController : System.Web.Http.ApiController { private IGeoController _implementation; @@ -121,7 +121,7 @@ public System.Threading.Tasks.Task GetUploadedFile(int id, [System } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public interface IPersonsController { System.Threading.Tasks.Task> GetAllAsync(); @@ -151,7 +151,7 @@ public interface IPersonsController } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class PersonsController : System.Web.Http.ApiController { private IPersonsController _implementation; @@ -816,11 +816,11 @@ private string GetSubtypeDiscriminator(System.Type objectType) } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class FileParameter { public FileParameter(System.IO.Stream data) - : this (data, null) + : this (data, null, null) { } @@ -843,11 +843,11 @@ public FileParameter(System.IO.Stream data, string fileName, string contentType) public string ContentType { get; private set; } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class FileResponse : System.IDisposable { - private System.IDisposable _client; - private System.IDisposable _response; + private System.IDisposable _client; + private System.IDisposable _response; public int StatusCode { get; private set; } @@ -871,8 +871,7 @@ public FileResponse(int statusCode, System.Collections.Generic.IReadOnlyDictiona public void Dispose() { - if (Stream != null) - Stream.Dispose(); + Stream.Dispose(); if (_response != null) _response.Dispose(); if (_client != null) @@ -880,7 +879,7 @@ public void Dispose() } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] internal class JsonExceptionConverter : Newtonsoft.Json.JsonConverter { private readonly Newtonsoft.Json.Serialization.DefaultContractResolver _defaultContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver(); diff --git a/src/NSwag.Integration.Console/ServiceClients.cs b/src/NSwag.Integration.Console/ServiceClients.cs index 71eab516c9..1d9cb664a4 100644 --- a/src/NSwag.Integration.Console/ServiceClients.cs +++ b/src/NSwag.Integration.Console/ServiceClients.cs @@ -1,6 +1,6 @@ //---------------------- // -// Generated using the NSwag toolchain v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) // //---------------------- @@ -16,7 +16,7 @@ namespace NSwag.Integration.Console { using System = global::System; - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class GeoClient { private System.Lazy _settings; @@ -83,16 +83,15 @@ public async System.Threading.Tasks.Task FromBodyTestAsync(GeoPoint location, Sy ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "204") + var status_ = (int)response_.StatusCode; + if (status_ == 204) { return; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -156,16 +155,15 @@ public async System.Threading.Tasks.Task FromUriTestAsync(double? latitude, doub ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "204") + var status_ = (int)response_.StatusCode; + if (status_ == 204) { return; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -225,16 +223,15 @@ public async System.Threading.Tasks.Task AddPolygonAsync(System.Collections.Gene ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "204") + var status_ = (int)response_.StatusCode; + if (status_ == 204) { return; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -265,7 +262,7 @@ public async System.Threading.Tasks.Task FilterAsync(System.Collections.Generic. urlBuilder_.Append("api/Geo/Filter?"); if (currentStates != null) { - foreach (var item_ in currentStates) { urlBuilder_.Append(System.Uri.EscapeDataString("currentStates") + "=").Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } + foreach (var item_ in currentStates) { urlBuilder_.Append(System.Uri.EscapeDataString("currentStates") + "=").Append((item_ == null) ? "" : System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } } urlBuilder_.Length--; @@ -294,16 +291,15 @@ public async System.Threading.Tasks.Task FilterAsync(System.Collections.Generic. ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "204") + var status_ = (int)response_.StatusCode; + if (status_ == 204) { return; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -334,7 +330,7 @@ public async System.Threading.Tasks.Task FilterAsync(System.Collections.Generic. urlBuilder_.Append("api/Geo/Reverse?"); if (values != null) { - foreach (var item_ in values) { urlBuilder_.Append(System.Uri.EscapeDataString("values") + "=").Append(System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } + foreach (var item_ in values) { urlBuilder_.Append(System.Uri.EscapeDataString("values") + "=").Append((item_ == null) ? "" : System.Uri.EscapeDataString(ConvertToString(item_, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } } urlBuilder_.Length--; @@ -364,20 +360,17 @@ public async System.Threading.Tasks.Task FilterAsync(System.Collections.Generic. ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(System.Collections.Generic.ICollection); } finally { @@ -431,16 +424,15 @@ public async System.Threading.Tasks.Task RefreshAsync(System.Threading.Cancellat ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "204") + var status_ = (int)response_.StatusCode; + if (status_ == 204) { return; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -507,20 +499,21 @@ public async System.Threading.Tasks.Task UploadFileAsync(FileParameter fil ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } return objectResponse_.Object; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(bool); } finally { @@ -588,16 +581,15 @@ public async System.Threading.Tasks.Task UploadFilesAsync(System.Collections.Gen ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "204") + var status_ = (int)response_.StatusCode; + if (status_ == 204) { return; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -659,26 +651,29 @@ public async System.Threading.Tasks.Task SaveItemsAsync(GenericRequestOfAddressA ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "204") + var status_ = (int)response_.StatusCode; + if (status_ == 204) { return; } else - if (status_ == "450") + if (status_ == 450) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } var responseObject_ = objectResponse_.Object != null ? objectResponse_.Object : new System.Exception(); - responseObject_.Data.Add("HttpStatus", status_); + responseObject_.Data.Add("HttpStatus", status_.ToString()); responseObject_.Data.Add("HttpHeaders", headers_); responseObject_.Data.Add("HttpResponse", objectResponse_.Text); - throw new SwaggerException("A custom error occured.", (int)response_.StatusCode, objectResponse_.Text, headers_, responseObject_); + throw new SwaggerException("A custom error occured.", status_, objectResponse_.Text, headers_, responseObject_); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -742,22 +737,19 @@ public async System.Threading.Tasks.Task GetUploadedFileAsync(int ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200" || status_ == "206") + var status_ = (int)response_.StatusCode; + if (status_ == 200 || status_ == 206) { var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); - var fileResponse_ = new FileResponse((int)response_.StatusCode, headers_, responseStream_, client_, response_); + var fileResponse_ = new FileResponse(status_, headers_, responseStream_, client_, response_); client_ = null; response_ = null; // response and client are disposed by FileResponse return fileResponse_; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(FileResponse); } finally { @@ -817,20 +809,17 @@ public async System.Threading.Tasks.Task GetUploadedFileAsync(int ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(double?); } finally { @@ -905,6 +894,11 @@ protected virtual async System.Threading.Tasks.Task> Rea private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { + if (value == null) + { + return null; + } + if (value is System.Enum) { var name = System.Enum.GetName(value.GetType(), value); @@ -926,23 +920,24 @@ private string ConvertToString(object value, System.Globalization.CultureInfo cu } else if (value is bool) { - return System.Convert.ToString(value, cultureInfo)?.ToLowerInvariant(); + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } - else if (value != null && value.GetType().IsArray) + else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } - return System.Convert.ToString(value, cultureInfo); + var result = System.Convert.ToString(value, cultureInfo); + return (result is null) ? string.Empty : result; } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class PersonsClient { private System.Lazy _settings; @@ -1004,20 +999,17 @@ private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(System.Collections.Generic.ICollection); } finally { @@ -1076,16 +1068,15 @@ public async System.Threading.Tasks.Task AddAsync(Person person, System.Threadin ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "204") + var status_ = (int)response_.StatusCode; + if (status_ == 204) { return; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -1145,20 +1136,17 @@ public async System.Threading.Tasks.Task AddAsync(Person person, System.Threadin ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(System.Collections.Generic.ICollection); } finally { @@ -1215,20 +1203,17 @@ public async System.Threading.Tasks.Task AddAsync(Person person, System.Threadin ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(System.Collections.Generic.ICollection); } finally { @@ -1288,30 +1273,31 @@ public async System.Threading.Tasks.Task GetAsync(System.Guid id, System ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "500") + var status_ = (int)response_.StatusCode; + if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } var responseObject_ = objectResponse_.Object != null ? objectResponse_.Object : new PersonNotFoundException(); - responseObject_.Data.Add("HttpStatus", status_); + responseObject_.Data.Add("HttpStatus", status_.ToString()); responseObject_.Data.Add("HttpHeaders", headers_); responseObject_.Data.Add("HttpResponse", objectResponse_.Text); - throw new SwaggerException("A server side error occurred.", (int)response_.StatusCode, objectResponse_.Text, headers_, responseObject_); + throw new SwaggerException("A server side error occurred.", status_, objectResponse_.Text, headers_, responseObject_); } else - if (status_ == "200") + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(Person); } finally { @@ -1368,16 +1354,15 @@ public async System.Threading.Tasks.Task DeleteAsync(System.Guid id, System.Thre ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "204") + var status_ = (int)response_.StatusCode; + if (status_ == 204) { return; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally @@ -1438,20 +1423,17 @@ public async System.Threading.Tasks.Task TransformAsync(Person person, S ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(Person); } finally { @@ -1513,30 +1495,35 @@ public async System.Threading.Tasks.Task ThrowAsync(System.Guid id, Syst ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } return objectResponse_.Object; } else - if (status_ == "500") + if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } var responseObject_ = objectResponse_.Object != null ? objectResponse_.Object : new PersonNotFoundException(); - responseObject_.Data.Add("HttpStatus", status_); + responseObject_.Data.Add("HttpStatus", status_.ToString()); responseObject_.Data.Add("HttpHeaders", headers_); responseObject_.Data.Add("HttpResponse", objectResponse_.Text); - throw new SwaggerException("A server side error occurred.", (int)response_.StatusCode, objectResponse_.Text, headers_, responseObject_); + throw new SwaggerException("A server side error occurred.", status_, objectResponse_.Text, headers_, responseObject_); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(Person); } finally { @@ -1602,30 +1589,35 @@ public async System.Threading.Tasks.Task GetNameAsync(System.Guid id, Sy ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } return objectResponse_.Object; } else - if (status_ == "500") + if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); + if (objectResponse_.Object == null) + { + throw new SwaggerException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); + } var responseObject_ = objectResponse_.Object != null ? objectResponse_.Object : new PersonNotFoundException(); - responseObject_.Data.Add("HttpStatus", status_); + responseObject_.Data.Add("HttpStatus", status_.ToString()); responseObject_.Data.Add("HttpHeaders", headers_); responseObject_.Data.Add("HttpResponse", objectResponse_.Text); - throw new SwaggerException("A server side error occurred.", (int)response_.StatusCode, objectResponse_.Text, headers_, responseObject_); + throw new SwaggerException("A server side error occurred.", status_, objectResponse_.Text, headers_, responseObject_); } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(string); } finally { @@ -1685,20 +1677,17 @@ public async System.Threading.Tasks.Task AddXmlAsync(string person, Syst ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(string); } finally { @@ -1758,20 +1747,17 @@ public async System.Threading.Tasks.Task UploadAsync(System.IO.Stream da ProcessResponse(client_, response_); - var status_ = ((int)response_.StatusCode).ToString(); - if (status_ == "200") + var status_ = (int)response_.StatusCode; + if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else - if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); + throw new SwaggerException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } - - return default(byte[]); } finally { @@ -1846,6 +1832,11 @@ protected virtual async System.Threading.Tasks.Task> Rea private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { + if (value == null) + { + return null; + } + if (value is System.Enum) { var name = System.Enum.GetName(value.GetType(), value); @@ -1867,23 +1858,24 @@ private string ConvertToString(object value, System.Globalization.CultureInfo cu } else if (value is bool) { - return System.Convert.ToString(value, cultureInfo)?.ToLowerInvariant(); + return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } - else if (value != null && value.GetType().IsArray) + else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } - return System.Convert.ToString(value, cultureInfo); + var result = System.Convert.ToString(value, cultureInfo); + return (result is null) ? string.Empty : result; } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] internal class JsonExceptionConverter : Newtonsoft.Json.JsonConverter { private readonly Newtonsoft.Json.Serialization.DefaultContractResolver _defaultContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver(); diff --git a/src/NSwag.Integration.Console/ServiceClientsContracts.cs b/src/NSwag.Integration.Console/ServiceClientsContracts.cs index 910530c3b3..9c6ea90a8c 100644 --- a/src/NSwag.Integration.Console/ServiceClientsContracts.cs +++ b/src/NSwag.Integration.Console/ServiceClientsContracts.cs @@ -1,6 +1,6 @@ //---------------------- // -// Generated using the NSwag toolchain v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) // //---------------------- @@ -288,11 +288,11 @@ private string GetSubtypeDiscriminator(System.Type objectType) } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class FileParameter { public FileParameter(System.IO.Stream data) - : this (data, null) + : this (data, null, null) { } @@ -315,11 +315,11 @@ public FileParameter(System.IO.Stream data, string fileName, string contentType) public string ContentType { get; private set; } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class FileResponse : System.IDisposable { - private System.IDisposable _client; - private System.IDisposable _response; + private System.IDisposable _client; + private System.IDisposable _response; public int StatusCode { get; private set; } @@ -343,8 +343,7 @@ public FileResponse(int statusCode, System.Collections.Generic.IReadOnlyDictiona public void Dispose() { - if (Stream != null) - Stream.Dispose(); + Stream.Dispose(); if (_response != null) _response.Dispose(); if (_client != null) @@ -352,7 +351,7 @@ public void Dispose() } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class SwaggerException : System.Exception { public int StatusCode { get; private set; } @@ -375,7 +374,7 @@ public override string ToString() } } - [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] + [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))")] public partial class SwaggerException : SwaggerException { public TResult Result { get; private set; } diff --git a/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsAngular.ts b/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsAngular.ts index ac4d2cdebb..d15447d6e5 100644 --- a/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsAngular.ts +++ b/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsAngular.ts @@ -2,7 +2,7 @@ /* eslint-disable */ //---------------------- // -// Generated using the NSwag toolchain v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) // //---------------------- // ReSharper disable InconsistentNaming diff --git a/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsAngularJS.ts b/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsAngularJS.ts index 4a2604ac91..9a728dadf3 100644 --- a/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsAngularJS.ts +++ b/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsAngularJS.ts @@ -2,7 +2,7 @@ /* eslint-disable */ //---------------------- // -// Generated using the NSwag toolchain v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) // //---------------------- // ReSharper disable InconsistentNaming diff --git a/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsAurelia.ts b/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsAurelia.ts index 3e28a12ecf..8a00856054 100644 --- a/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsAurelia.ts +++ b/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsAurelia.ts @@ -2,7 +2,7 @@ /* eslint-disable */ //---------------------- // -// Generated using the NSwag toolchain v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) // //---------------------- // ReSharper disable InconsistentNaming diff --git a/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsFetch.ts b/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsFetch.ts index ffcb342248..b42fc703bf 100644 --- a/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsFetch.ts +++ b/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsFetch.ts @@ -2,7 +2,7 @@ /* eslint-disable */ //---------------------- // -// Generated using the NSwag toolchain v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) // //---------------------- // ReSharper disable InconsistentNaming diff --git a/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsJQueryCallbacks.ts b/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsJQueryCallbacks.ts index f33136e582..f3bd78f703 100644 --- a/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsJQueryCallbacks.ts +++ b/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsJQueryCallbacks.ts @@ -2,7 +2,7 @@ /* eslint-disable */ //---------------------- // -// Generated using the NSwag toolchain v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) // //---------------------- // ReSharper disable InconsistentNaming diff --git a/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsJQueryPromises.ts b/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsJQueryPromises.ts index 5c5c1a6369..b692da4402 100644 --- a/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsJQueryPromises.ts +++ b/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsJQueryPromises.ts @@ -2,7 +2,7 @@ /* eslint-disable */ //---------------------- // -// Generated using the NSwag toolchain v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) // //---------------------- // ReSharper disable InconsistentNaming diff --git a/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsJQueryPromisesKO.ts b/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsJQueryPromisesKO.ts index 940a386acd..6e0dc2834b 100644 --- a/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsJQueryPromisesKO.ts +++ b/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsJQueryPromisesKO.ts @@ -2,7 +2,7 @@ /* eslint-disable */ //---------------------- // -// Generated using the NSwag toolchain v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) // //---------------------- // ReSharper disable InconsistentNaming diff --git a/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsPetStoreFetch.ts b/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsPetStoreFetch.ts index 2ef0636cc6..a78c4e5818 100644 --- a/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsPetStoreFetch.ts +++ b/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsPetStoreFetch.ts @@ -2,7 +2,7 @@ /* eslint-disable */ //---------------------- // -// Generated using the NSwag toolchain v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) // //---------------------- // ReSharper disable InconsistentNaming diff --git a/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsUberFetch.ts b/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsUberFetch.ts index a9bac5acae..4fa976a397 100644 --- a/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsUberFetch.ts +++ b/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsUberFetch.ts @@ -2,7 +2,7 @@ /* eslint-disable */ //---------------------- // -// Generated using the NSwag toolchain v13.6.1.0 (NJsonSchema v10.1.21.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) +// Generated using the NSwag toolchain v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) // //---------------------- // ReSharper disable InconsistentNaming diff --git a/src/NSwag.Integration.WebAPI/NSwag.Integration.WebAPI.csproj b/src/NSwag.Integration.WebAPI/NSwag.Integration.WebAPI.csproj index 1f52bb80e0..cefddf632a 100644 --- a/src/NSwag.Integration.WebAPI/NSwag.Integration.WebAPI.csproj +++ b/src/NSwag.Integration.WebAPI/NSwag.Integration.WebAPI.csproj @@ -65,8 +65,8 @@ ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll True - - ..\packages\NJsonSchema.10.1.23\lib\net45\NJsonSchema.dll + + ..\packages\NJsonSchema.10.1.24\lib\net45\NJsonSchema.dll ..\packages\Owin.1.0\lib\net40\Owin.dll diff --git a/src/NSwag.MSBuild/NSwag.MSBuild.nuspec b/src/NSwag.MSBuild/NSwag.MSBuild.nuspec index 38ee64e74a..1310d26b64 100644 --- a/src/NSwag.MSBuild/NSwag.MSBuild.nuspec +++ b/src/NSwag.MSBuild/NSwag.MSBuild.nuspec @@ -2,7 +2,7 @@ NSwag.MSBuild - 13.6.2 + 13.7.0 Rico Suter Rico Suter false diff --git a/src/NSwag.Npm/package.json b/src/NSwag.Npm/package.json index 1e4151a1d4..e68fdb3a82 100644 --- a/src/NSwag.Npm/package.json +++ b/src/NSwag.Npm/package.json @@ -1,6 +1,6 @@ { "name": "nswag", - "version": "13.6.2", + "version": "13.7.0", "optionalDependencies": {}, "repository": { "type": "git", diff --git a/src/NSwag.Sample.NETCore11/swagger.json b/src/NSwag.Sample.NETCore11/swagger.json index 5f70d08ac6..715b6f6ba1 100644 --- a/src/NSwag.Sample.NETCore11/swagger.json +++ b/src/NSwag.Sample.NETCore11/swagger.json @@ -1,5 +1,5 @@ { - "x-generator": "NSwag v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", + "x-generator": "NSwag v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", "swagger": "2.0", "info": { "title": "My Title", diff --git a/src/NSwag.Sample.NETCore20/swagger.json b/src/NSwag.Sample.NETCore20/swagger.json index b4d14932aa..c59b7d7c5b 100644 --- a/src/NSwag.Sample.NETCore20/swagger.json +++ b/src/NSwag.Sample.NETCore20/swagger.json @@ -1,5 +1,5 @@ { - "x-generator": "NSwag v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", + "x-generator": "NSwag v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", "swagger": "2.0", "info": { "title": "Hello world!", diff --git a/src/NSwag.Sample.NETCore21/swagger_assembly_cli.json b/src/NSwag.Sample.NETCore21/swagger_assembly_cli.json index fc93fe1017..be573ff595 100644 --- a/src/NSwag.Sample.NETCore21/swagger_assembly_cli.json +++ b/src/NSwag.Sample.NETCore21/swagger_assembly_cli.json @@ -1,5 +1,5 @@ { - "x-generator": "NSwag v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", + "x-generator": "NSwag v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", "swagger": "2.0", "info": { "title": "ljlkjlkj", diff --git a/src/NSwag.Sample.NETCore21/swagger_project_cli.json b/src/NSwag.Sample.NETCore21/swagger_project_cli.json index 4c61d04897..83b0c38637 100644 --- a/src/NSwag.Sample.NETCore21/swagger_project_cli.json +++ b/src/NSwag.Sample.NETCore21/swagger_project_cli.json @@ -1,5 +1,5 @@ { - "x-generator": "NSwag v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", + "x-generator": "NSwag v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", "swagger": "2.0", "info": { "title": "My Title", diff --git a/src/NSwag.Sample.NETCore22/openapi_project_cli.json b/src/NSwag.Sample.NETCore22/openapi_project_cli.json index 6a7af61517..03c534482d 100644 --- a/src/NSwag.Sample.NETCore22/openapi_project_cli.json +++ b/src/NSwag.Sample.NETCore22/openapi_project_cli.json @@ -1,5 +1,5 @@ { - "x-generator": "NSwag v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", + "x-generator": "NSwag v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", "openapi": "3.0.0", "info": { "title": "My Title", @@ -371,6 +371,7 @@ "content": { "multipart/form-data": { "schema": { + "type": "object", "properties": { "file": { "type": "string", diff --git a/src/NSwag.Sample.NETCore22/swagger_assembly_cli.json b/src/NSwag.Sample.NETCore22/swagger_assembly_cli.json index 35500d29fe..b726bfc478 100644 --- a/src/NSwag.Sample.NETCore22/swagger_assembly_cli.json +++ b/src/NSwag.Sample.NETCore22/swagger_assembly_cli.json @@ -1,5 +1,5 @@ { - "x-generator": "NSwag v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", + "x-generator": "NSwag v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", "swagger": "2.0", "info": { "title": "ljlkjlkj", diff --git a/src/NSwag.Sample.NETCore22/swagger_project_cli.json b/src/NSwag.Sample.NETCore22/swagger_project_cli.json index e2722bf89f..d9cd2f14fb 100644 --- a/src/NSwag.Sample.NETCore22/swagger_project_cli.json +++ b/src/NSwag.Sample.NETCore22/swagger_project_cli.json @@ -1,5 +1,5 @@ { - "x-generator": "NSwag v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", + "x-generator": "NSwag v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", "swagger": "2.0", "info": { "title": "My Title", diff --git a/src/NSwag.Sample.NETCore30/Properties/launchSettings.json b/src/NSwag.Sample.NETCore30/Properties/launchSettings.json index 0e16f751c3..e8251c1328 100644 --- a/src/NSwag.Sample.NETCore30/Properties/launchSettings.json +++ b/src/NSwag.Sample.NETCore30/Properties/launchSettings.json @@ -20,7 +20,7 @@ "NSwag.Sample.NETCore30": { "commandName": "Project", "launchBrowser": true, - "launchUrl": "apiverse", + "launchUrl": "apimundo", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, diff --git a/src/NSwag.Sample.NETCore30/Startup.cs b/src/NSwag.Sample.NETCore30/Startup.cs index 3be7e1ddb0..479c5d05a0 100644 --- a/src/NSwag.Sample.NETCore30/Startup.cs +++ b/src/NSwag.Sample.NETCore30/Startup.cs @@ -44,11 +44,11 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseOpenApi(); app.UseSwaggerUi3(); - //app.UseApiverse(); - app.UseApiverse(settings => + //app.UseApimundo(); + app.UseApimundo(settings => { //settings.CompareTo = "a:a:27:25:15:latest"; - settings.ApiverseUrl = "https://localhost:5001"; + settings.ApimundoUrl = "https://localhost:5001"; }); } } diff --git a/src/NSwag.Sample.NETCore30/openapi.json b/src/NSwag.Sample.NETCore30/openapi.json index eaf97a4e92..e3477e0abd 100644 --- a/src/NSwag.Sample.NETCore30/openapi.json +++ b/src/NSwag.Sample.NETCore30/openapi.json @@ -1,5 +1,5 @@ { - "x-generator": "NSwag v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v9.0.0.0))", + "x-generator": "NSwag v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v9.0.0.0))", "openapi": "3.0.0", "info": { "title": "My Title", diff --git a/src/NSwag.Sample.NETCore31/Properties/launchSettings.json b/src/NSwag.Sample.NETCore31/Properties/launchSettings.json index 73be131372..51a0293a3c 100644 --- a/src/NSwag.Sample.NETCore31/Properties/launchSettings.json +++ b/src/NSwag.Sample.NETCore31/Properties/launchSettings.json @@ -20,7 +20,7 @@ "NSwag.Sample.NETCore31": { "commandName": "Project", "launchBrowser": true, - "launchUrl": "apiverse", + "launchUrl": "apimundo", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, diff --git a/src/NSwag.Sample.NETCore31/Startup.cs b/src/NSwag.Sample.NETCore31/Startup.cs index c2e7a06a7d..db396e7764 100644 --- a/src/NSwag.Sample.NETCore31/Startup.cs +++ b/src/NSwag.Sample.NETCore31/Startup.cs @@ -49,11 +49,11 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseOpenApi(); app.UseSwaggerUi3(); - //app.UseApiverse(); - app.UseApiverse(settings => + //app.UseApimundo(); + app.UseApimundo(settings => { //settings.CompareTo = "a:a:27:25:15:latest"; - settings.ApiverseUrl = "https://localhost:5001"; + settings.ApimundoUrl = "https://localhost:5001"; }); } } diff --git a/src/NSwag.Sample.NetGlobalAsax/NSwag.Sample.NetGlobalAsax.csproj b/src/NSwag.Sample.NetGlobalAsax/NSwag.Sample.NetGlobalAsax.csproj index 36dc2d2527..6c76f27945 100644 --- a/src/NSwag.Sample.NetGlobalAsax/NSwag.Sample.NetGlobalAsax.csproj +++ b/src/NSwag.Sample.NetGlobalAsax/NSwag.Sample.NetGlobalAsax.csproj @@ -62,8 +62,8 @@ ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - - ..\packages\NJsonSchema.10.1.23\lib\net45\NJsonSchema.dll + + ..\packages\NJsonSchema.10.1.24\lib\net45\NJsonSchema.dll ..\packages\Owin.1.0\lib\net40\Owin.dll diff --git a/src/NSwag.Sample.NetGlobalAsax/swagger.json b/src/NSwag.Sample.NetGlobalAsax/swagger.json index 768b67fdaa..2d10a93bf8 100644 --- a/src/NSwag.Sample.NetGlobalAsax/swagger.json +++ b/src/NSwag.Sample.NetGlobalAsax/swagger.json @@ -1,5 +1,5 @@ { - "x-generator": "NSwag v13.6.2.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", + "x-generator": "NSwag v13.7.0.0 (NJsonSchema v10.1.23.0 (Newtonsoft.Json v11.0.0.0))", "swagger": "2.0", "info": { "title": "My Title", diff --git a/src/NSwagStudio.Chocolatey/NSwagStudio.nuspec b/src/NSwagStudio.Chocolatey/NSwagStudio.nuspec index 8046576f6b..015146170c 100644 --- a/src/NSwagStudio.Chocolatey/NSwagStudio.nuspec +++ b/src/NSwagStudio.Chocolatey/NSwagStudio.nuspec @@ -3,7 +3,7 @@ NSwagStudio NSwagStudio - 13.6.2 + 13.7.0 Rico Suter Rico Suter false diff --git a/src/NSwagStudio/NSwagStudio.csproj b/src/NSwagStudio/NSwagStudio.csproj index 29f9c1eb89..bdd42c1ef0 100644 --- a/src/NSwagStudio/NSwagStudio.csproj +++ b/src/NSwagStudio/NSwagStudio.csproj @@ -96,17 +96,17 @@ ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - - ..\packages\NJsonSchema.10.1.23\lib\net45\NJsonSchema.dll + + ..\packages\NJsonSchema.10.1.24\lib\net45\NJsonSchema.dll - - ..\packages\NJsonSchema.CodeGeneration.10.1.23\lib\net451\NJsonSchema.CodeGeneration.dll + + ..\packages\NJsonSchema.CodeGeneration.10.1.24\lib\net451\NJsonSchema.CodeGeneration.dll - - ..\packages\NJsonSchema.CodeGeneration.CSharp.10.1.23\lib\net451\NJsonSchema.CodeGeneration.CSharp.dll + + ..\packages\NJsonSchema.CodeGeneration.CSharp.10.1.24\lib\net451\NJsonSchema.CodeGeneration.CSharp.dll - - ..\packages\NJsonSchema.CodeGeneration.TypeScript.10.1.23\lib\net451\NJsonSchema.CodeGeneration.TypeScript.dll + + ..\packages\NJsonSchema.CodeGeneration.TypeScript.10.1.24\lib\net451\NJsonSchema.CodeGeneration.TypeScript.dll diff --git a/src/NSwagStudio/Properties/AssemblyInfo.cs b/src/NSwagStudio/Properties/AssemblyInfo.cs index 441caa01aa..f56a42aa30 100644 --- a/src/NSwagStudio/Properties/AssemblyInfo.cs +++ b/src/NSwagStudio/Properties/AssemblyInfo.cs @@ -5,4 +5,4 @@ [assembly: AssemblyCompany("Rico Suter")] [assembly: AssemblyProduct("NSwagStudio")] [assembly: AssemblyCopyright("Copyright © Rico Suter, 2016")] -[assembly: AssemblyVersion("13.6.2")] +[assembly: AssemblyVersion("13.7.0")]