From b6d16eae54d69fbb8125138fb273a9875b816190 Mon Sep 17 00:00:00 2001 From: Bryan Aldrich Date: Tue, 3 Dec 2024 15:22:11 -0500 Subject: [PATCH 1/4] alter the c# templates to allow net core and net framework targets to exist in the same output. (uses defines in the c# instead of directives in the mustache processor). --- .../main/resources/csharp/ApiClient.mustache | 4 +-- .../resources/csharp/ApiClient.v790.mustache | 4 +-- .../resources/csharp/ClientUtils.mustache | 4 +-- .../csharp/HttpSigningConfiguration.mustache | 8 +++--- .../generichost/ApiResponse`1.mustache | 6 +++- .../libraries/generichost/AsModel.mustache | 7 ++++- .../generichost/ClientUtils.mustache | 24 +++++++++++++--- .../generichost/HostConfiguration.mustache | 2 +- .../HttpSigningConfiguration.mustache | 8 +++--- .../csharp/libraries/generichost/api.mustache | 28 +++++++++++++------ 10 files changed, 65 insertions(+), 30 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache b/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache index 91ea70055b06..eb4b63f578f9 100644 --- a/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache @@ -14,9 +14,9 @@ using System.Text; using System.Threading; using System.Text.RegularExpressions; using System.Threading.Tasks; -{{^net60OrLater}} +#if !NET6_0_OR_GREATER using System.Web; -{{/net60OrLater}} +#endif using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using RestSharp; diff --git a/modules/openapi-generator/src/main/resources/csharp/ApiClient.v790.mustache b/modules/openapi-generator/src/main/resources/csharp/ApiClient.v790.mustache index a63d1c2be9c1..f47705a8b7f1 100644 --- a/modules/openapi-generator/src/main/resources/csharp/ApiClient.v790.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/ApiClient.v790.mustache @@ -14,9 +14,9 @@ using System.Text; using System.Threading; using System.Text.RegularExpressions; using System.Threading.Tasks; -{{^net60OrLater}} +#if !NET6_0_OR_GREATER using System.Web; -{{/net60OrLater}} +#endif using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using RestSharp; diff --git a/modules/openapi-generator/src/main/resources/csharp/ClientUtils.mustache b/modules/openapi-generator/src/main/resources/csharp/ClientUtils.mustache index 5c42d2e4fe33..84e8177e219c 100644 --- a/modules/openapi-generator/src/main/resources/csharp/ClientUtils.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/ClientUtils.mustache @@ -114,14 +114,14 @@ namespace {{packageName}}.Client // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); -{{#net60OrLater}} +#if NET6_0_OR_GREATER if (obj is DateOnly dateOnly) // Return a formatted date string - Can be customized with Configuration.DateTimeFormat // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15 return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); -{{/net60OrLater}} +#endif if (obj is bool boolean) return boolean ? "true" : "false"; if (obj is ICollection collection) { diff --git a/modules/openapi-generator/src/main/resources/csharp/HttpSigningConfiguration.mustache b/modules/openapi-generator/src/main/resources/csharp/HttpSigningConfiguration.mustache index faca675944a3..823d9849a698 100644 --- a/modules/openapi-generator/src/main/resources/csharp/HttpSigningConfiguration.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/HttpSigningConfiguration.mustache @@ -344,7 +344,7 @@ namespace {{packageName}}.Client /// ECDSA signature private string GetECDSASignature(byte[] dataToSign) { - {{#net60OrLater}} +#if NET6_0_OR_GREATER if (!File.Exists(KeyFilePath) && string.IsNullOrEmpty(KeyString)) { throw new Exception("No API key has been provided."); @@ -382,10 +382,10 @@ namespace {{packageName}}.Client var signedString = System.Convert.ToBase64String(derBytes); return signedString; - {{/net60OrLater}} - {{^net60OrLater}} +#endif +#if !NET6_0_OR_GREATER throw new Exception("ECDSA signing is supported only on NETCOREAPP3_0 and above"); - {{/net60OrLater}} +#endif } /// diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiResponse`1.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiResponse`1.mustache index 1b12e4173931..634af2d43e7c 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiResponse`1.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiResponse`1.mustache @@ -164,7 +164,11 @@ namespace {{packageName}}.{{clientPackage}} /// /// /// - bool Try{{.}}({{#net60OrLater}}[NotNullWhen(true)]{{/net60OrLater}}out TType{{nrt?}} result); + bool Try{{.}}( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType{{nrt?}} result); } {{/x-http-statuses-with-return}} } diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/AsModel.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/AsModel.mustache index 96bedfa464ec..dd7ce036f3ff 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/AsModel.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/AsModel.mustache @@ -1,4 +1,9 @@ // This logic may be modified with the AsModel.mustache template return Is{{vendorExtensions.x-http-status}} ? System.Text.Json.JsonSerializer.Deserialize<{{#isModel}}{{^containerType}}{{packageName}}.{{modelPackage}}.{{/containerType}}{{/isModel}}{{{dataType}}}>(RawContent, _jsonSerializerOptions) - : {{#net60OrLater}}null{{/net60OrLater}}{{^net60OrLater}}default{{/net60OrLater}}; + : +#if NET6_0_OR_GREATER + null +#else + default +#endif; diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ClientUtils.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ClientUtils.mustache index 03d0daf81986..a1f072de3f06 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ClientUtils.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ClientUtils.mustache @@ -107,7 +107,15 @@ using System.Runtime.CompilerServices; /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, {{#net60OrLater}}[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] {{/net60OrLater}}out T{{#nrt}}{{#net60OrLater}}?{{/net60OrLater}}{{/nrt}} result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T{{#nrt}} +#if NET6_0_OR_GREATER + ? +#endif + {{/nrt}} result) { try { @@ -129,7 +137,15 @@ using System.Runtime.CompilerServices; /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, {{#net60OrLater}}[global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] {{/net60OrLater}}out T{{#nrt}}{{#net60OrLater}}?{{/net60OrLater}}{{/nrt}} result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T{{#nrt}} +#if NET6_0_OR_GREATER + ? +#endif + {{/nrt}} result) { try { @@ -176,10 +192,10 @@ using System.Runtime.CompilerServices; // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); - {{#net60OrLater}} +#if NET6_0_OR_GREATER if (obj is DateOnly dateOnly) return dateOnly.ToString(format); - {{/net60OrLater}} +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HostConfiguration.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HostConfiguration.mustache index 1333f0e67ea2..cd8f3ce98d31 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HostConfiguration.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HostConfiguration.mustache @@ -54,7 +54,7 @@ namespace {{packageName}}.{{clientPackage}} {{/isEnum}} {{/model}} {{/models}} - JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new{{^net60OrLater}} JsonSerializerOptionsProvider{{/net60OrLater}}(_jsonOptions); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new JsonSerializerOptionsProvider(_jsonOptions); _services.AddSingleton(jsonSerializerOptionsProvider); {{#useSourceGeneration}} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HttpSigningConfiguration.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HttpSigningConfiguration.mustache index 5e0f7739df06..273b70a379be 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HttpSigningConfiguration.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HttpSigningConfiguration.mustache @@ -272,7 +272,7 @@ namespace {{packageName}}.{{clientPackage}} /// private string GetECDSASignature(byte[] dataToSign) { - {{#net60OrLater}} +#if NET6_0_OR_GREATER if (!File.Exists(KeyFilePath)) throw new Exception("key file path does not exist."); @@ -310,10 +310,10 @@ namespace {{packageName}}.{{clientPackage}} var signedString = System.Convert.ToBase64String(derBytes); return signedString; - {{/net60OrLater}} - {{^net60OrLater}} +#endif +#if !NET6_0_OR_GREATER throw new Exception("ECDSA signing is supported only on NETCOREAPP3_0 and above"); - {{/net60OrLater}} +#endif } private byte[] ConvertToECDSAANS1Format(byte[] signedBytes) diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api.mustache index b33115f0a5e1..25abe72ca737 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api.mustache @@ -562,7 +562,11 @@ namespace {{packageName}}.{{apiPackage}} tokenBaseLocalVars.Add(httpSignatureTokenLocalVar{{-index}}); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync({{#net60OrLater}}cancellationToken{{/net60OrLater}}).ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar{{-index}}.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -607,23 +611,25 @@ namespace {{packageName}}.{{apiPackage}} httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); {{/-first}} {{/produces}} - {{#net60OrLater}} - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.{{#lambda.titlecase}}{{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}{{/lambda.titlecase}}; - {{/net60OrLater}} - {{^net60OrLater}} +#else httpRequestMessageLocalVar.Method = new HttpMethod("{{#lambda.uppercase}}{{httpMethod}}{{/lambda.uppercase}}"); - {{/net60OrLater}} +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync({{#net60OrLater}}cancellationToken{{/net60OrLater}}).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger<{{#vendorExtensions.x-duplicates}}{{.}}.{{/vendorExtensions.x-duplicates}}{{operationId}}ApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<{{#vendorExtensions.x-duplicates}}{{.}}.{{/vendorExtensions.x-duplicates}}{{operationId}}ApiResponse>(); - {{#vendorExtensions.x-duplicates}}{{.}}.{{/vendorExtensions.x-duplicates}}{{operationId}}ApiResponse apiResponseLocalVar = new{{^net60OrLater}} {{operationId}}ApiResponse{{/net60OrLater}}(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "{{{path}}}", requestedAtLocalVar, _jsonSerializerOptions); + {{#vendorExtensions.x-duplicates}}{{.}}.{{/vendorExtensions.x-duplicates}}{{operationId}}ApiResponse apiResponseLocalVar = new {{operationId}}ApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "{{{path}}}", requestedAtLocalVar, _jsonSerializerOptions); After{{operationId}}DefaultImplementation({{#lambda.joinWithComma}}apiResponseLocalVar {{#allParams}}{{paramName}} {{/allParams}}{{/lambda.joinWithComma}}); @@ -761,7 +767,11 @@ namespace {{packageName}}.{{apiPackage}} /// /// /// - public bool Try{{vendorExtensions.x-http-status}}({{#net60OrLater}}[NotNullWhen(true)]{{/net60OrLater}}out {{#isModel}}{{^containerType}}{{packageName}}.{{modelPackage}}.{{/containerType}}{{/isModel}}{{{dataType}}}{{#nrt}}?{{/nrt}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} result) + public bool Try{{vendorExtensions.x-http-status}}( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out {{#isModel}}{{^containerType}}{{packageName}}.{{modelPackage}}.{{/containerType}}{{/isModel}}{{{dataType}}}{{#nrt}}?{{/nrt}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} result) { result = null; From f0e2898eb331685ddfe399233ae50a71849dd066 Mon Sep 17 00:00:00 2001 From: Bryan Aldrich Date: Tue, 3 Dec 2024 19:27:27 -0500 Subject: [PATCH 2/4] samples update --- .../src/Org.OpenAPITools.Test/CustomTest.cs | 2 +- .../EchoServerResponseParser.cs | 2 +- .../src/Org.OpenAPITools/Client/ApiClient.cs | 3 + .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../src/Org.OpenAPITools/Client/ApiClient.cs | 2 + .../Org.OpenAPITools/Client/ClientUtils.cs | 8 + .../src/Org.OpenAPITools/Api/APIKEYSApi.cs | 13 +- .../src/Org.OpenAPITools/Api/APIKeys0Api.cs | 13 +- .../src/Org.OpenAPITools/Api/ApiKeys1Api.cs | 13 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 22 +- .../Client/HostConfiguration.cs | 2 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 23 +- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 6 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 16 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 23 +- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 6 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 16 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 23 +- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 6 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 16 +- .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 23 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 102 ++++- .../src/Org.OpenAPITools/Api/FakeApi.cs | 317 +++++++++++++-- .../Api/FakeClassnameTags123Api.cs | 23 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 179 +++++++-- .../src/Org.OpenAPITools/Api/StoreApi.cs | 79 +++- .../src/Org.OpenAPITools/Api/UserApi.cs | 119 +++++- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 18 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 16 +- .../Client/HttpSigningConfiguration.cs | 41 ++ .../src/Org.OpenAPITools/Api/DefaultApi.cs | 23 +- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 6 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 16 +- .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 23 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 102 ++++- .../src/Org.OpenAPITools/Api/FakeApi.cs | 317 +++++++++++++-- .../Api/FakeClassnameTags123Api.cs | 23 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 179 +++++++-- .../src/Org.OpenAPITools/Api/StoreApi.cs | 79 +++- .../src/Org.OpenAPITools/Api/UserApi.cs | 119 +++++- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 18 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 16 +- .../Client/HttpSigningConfiguration.cs | 41 ++ .../src/Org.OpenAPITools/Api/DefaultApi.cs | 23 +- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 6 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 16 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 23 +- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 6 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 16 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 23 +- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 6 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 16 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 23 +- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 6 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 16 +- .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 23 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 102 ++++- .../src/Org.OpenAPITools/Api/FakeApi.cs | 317 +++++++++++++-- .../Api/FakeClassnameTags123Api.cs | 23 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 179 +++++++-- .../src/Org.OpenAPITools/Api/StoreApi.cs | 79 +++- .../src/Org.OpenAPITools/Api/UserApi.cs | 119 +++++- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 18 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 16 +- .../Client/HttpSigningConfiguration.cs | 41 ++ .../src/Org.OpenAPITools/Api/DefaultApi.cs | 23 +- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 6 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 16 +- .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 23 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 102 ++++- .../src/Org.OpenAPITools/Api/FakeApi.cs | 317 +++++++++++++-- .../Api/FakeClassnameTags123Api.cs | 23 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 179 +++++++-- .../src/Org.OpenAPITools/Api/StoreApi.cs | 79 +++- .../src/Org.OpenAPITools/Api/UserApi.cs | 119 +++++- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 18 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 16 +- .../Client/HttpSigningConfiguration.cs | 41 ++ .../src/Org.OpenAPITools/Api/DefaultApi.cs | 23 +- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 6 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 16 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 26 +- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 6 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 22 +- .../Client/HostConfiguration.cs | 2 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 26 +- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 6 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 22 +- .../Client/HostConfiguration.cs | 2 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 26 +- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 6 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 22 +- .../Client/HostConfiguration.cs | 2 +- .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 26 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 116 ++++-- .../src/Org.OpenAPITools/Api/FakeApi.cs | 368 ++++++++++++++---- .../Api/FakeClassnameTags123Api.cs | 26 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 203 ++++++++-- .../src/Org.OpenAPITools/Api/StoreApi.cs | 91 ++++- .../src/Org.OpenAPITools/Api/UserApi.cs | 139 +++++-- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 18 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 14 +- .../Client/HostConfiguration.cs | 2 +- .../Client/HttpSigningConfiguration.cs | 5 + .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 26 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 116 ++++-- .../src/Org.OpenAPITools/Api/FakeApi.cs | 368 ++++++++++++++---- .../Api/FakeClassnameTags123Api.cs | 26 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 203 ++++++++-- .../src/Org.OpenAPITools/Api/StoreApi.cs | 91 ++++- .../src/Org.OpenAPITools/Api/UserApi.cs | 139 +++++-- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 18 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 22 +- .../Client/HostConfiguration.cs | 2 +- .../Client/HttpSigningConfiguration.cs | 5 + .../src/Org.OpenAPITools/Api/DefaultApi.cs | 26 +- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 6 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 22 +- .../Client/HostConfiguration.cs | 2 +- .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 26 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 116 ++++-- .../src/Org.OpenAPITools/Api/FakeApi.cs | 368 ++++++++++++++---- .../Api/FakeClassnameTags123Api.cs | 26 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 203 ++++++++-- .../src/Org.OpenAPITools/Api/StoreApi.cs | 91 ++++- .../src/Org.OpenAPITools/Api/UserApi.cs | 139 +++++-- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 18 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 14 +- .../Client/HostConfiguration.cs | 2 +- .../Client/HttpSigningConfiguration.cs | 5 + .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 26 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 116 ++++-- .../src/Org.OpenAPITools/Api/FakeApi.cs | 368 ++++++++++++++---- .../Api/FakeClassnameTags123Api.cs | 26 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 203 ++++++++-- .../src/Org.OpenAPITools/Api/StoreApi.cs | 91 ++++- .../src/Org.OpenAPITools/Api/UserApi.cs | 139 +++++-- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 18 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 22 +- .../Client/HostConfiguration.cs | 2 +- .../Client/HttpSigningConfiguration.cs | 5 + .../src/Org.OpenAPITools/Api/DefaultApi.cs | 26 +- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 6 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 22 +- .../Client/HostConfiguration.cs | 2 +- .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 23 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 102 ++++- .../src/Org.OpenAPITools/Api/FakeApi.cs | 317 +++++++++++++-- .../Api/FakeClassnameTags123Api.cs | 23 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 179 +++++++-- .../src/Org.OpenAPITools/Api/StoreApi.cs | 79 +++- .../src/Org.OpenAPITools/Api/UserApi.cs | 119 +++++- .../Org.OpenAPITools/Client/ApiResponse`1.cs | 18 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 16 +- .../Client/HttpSigningConfiguration.cs | 41 ++ .../Org.OpenAPITools/Client/ClientUtils.cs | 8 + .../Client/HttpSigningConfiguration.cs | 41 ++ .../src/Org.OpenAPITools/Client/ApiClient.cs | 2 + .../Org.OpenAPITools/Client/ClientUtils.cs | 8 + .../src/Org.OpenAPITools/Client/ApiClient.cs | 2 + .../Org.OpenAPITools/Client/ClientUtils.cs | 8 + .../Client/HttpSigningConfiguration.cs | 41 ++ .../src/Org.OpenAPITools/Client/ApiClient.cs | 2 + .../Org.OpenAPITools/Client/ClientUtils.cs | 8 + .../Client/HttpSigningConfiguration.cs | 41 ++ .../src/Org.OpenAPITools/Client/ApiClient.cs | 3 + .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../src/Org.OpenAPITools/Client/ApiClient.cs | 3 + .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../Client/HttpSigningConfiguration.cs | 5 + .../src/Org.OpenAPITools/Client/ApiClient.cs | 3 + .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../Client/HttpSigningConfiguration.cs | 5 + .../src/Org.OpenAPITools/Client/ApiClient.cs | 3 + .../Org.OpenAPITools/Client/ClientUtils.cs | 2 + .../src/Org.OpenAPITools/Client/ApiClient.cs | 2 + .../Org.OpenAPITools/Client/ClientUtils.cs | 8 + .../Client/HttpSigningConfiguration.cs | 41 ++ .../src/Org.OpenAPITools/Client/ApiClient.cs | 2 + .../Org.OpenAPITools/Client/ClientUtils.cs | 8 + .../Client/HttpSigningConfiguration.cs | 41 ++ .../Org.OpenAPITools/Client/ClientUtils.cs | 8 + .../Client/HttpSigningConfiguration.cs | 41 ++ 183 files changed, 8367 insertions(+), 1420 deletions(-) diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/CustomTest.cs b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/CustomTest.cs index 06b930205b5c..433a84504410 100644 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/CustomTest.cs +++ b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/CustomTest.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json.Linq; +using Newtonsoft.Json.Linq; using Org.OpenAPITools.Api; using Org.OpenAPITools.Model; using System; diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/EchoServerResponseParser.cs b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/EchoServerResponseParser.cs index f87dae4ed12e..0f5beeded3c2 100644 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/EchoServerResponseParser.cs +++ b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/EchoServerResponseParser.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ApiClient.cs index 655b101ecf78..362f3002dd53 100644 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ApiClient.cs @@ -23,6 +23,9 @@ using System.Threading; using System.Text.RegularExpressions; using System.Threading.Tasks; +#if !NET6_0_OR_GREATER +using System.Web; +#endif using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using RestSharp; diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ClientUtils.cs index 116c891b4646..ac4a12b746dc 100644 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -101,12 +101,14 @@ public static string ParameterToString(object obj, IReadableConfiguration config // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#if NET6_0_OR_GREATER if (obj is DateOnly dateOnly) // Return a formatted date string - Can be customized with Configuration.DateTimeFormat // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15 return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#endif if (obj is bool boolean) return boolean ? "true" : "false"; if (obj is ICollection collection) { diff --git a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/ApiClient.cs index 91b7422b713e..7a7b6ef2098d 100644 --- a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/ApiClient.cs @@ -22,7 +22,9 @@ using System.Threading; using System.Text.RegularExpressions; using System.Threading.Tasks; +#if !NET6_0_OR_GREATER using System.Web; +#endif using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using RestSharp; diff --git a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/ClientUtils.cs index 510c80551eb5..407da685293f 100644 --- a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -116,6 +116,14 @@ public static string ParameterToString(object obj, IReadableConfiguration config // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15 + return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#endif if (obj is bool boolean) return boolean ? "true" : "false"; if (obj is ICollection collection) { diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKEYSApi.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKEYSApi.cs index a69943340cfd..394f121b3ce2 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKEYSApi.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKEYSApi.cs @@ -234,18 +234,25 @@ public async Task GetApiKeysIdAsync(int id, System.Thr uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Bid%7D", Uri.EscapeDataString(id.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetApiKeysIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions); + GetApiKeysIdApiResponse apiResponseLocalVar = new GetApiKeysIdApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions); AfterGetApiKeysIdDefaultImplementation(apiResponseLocalVar, id); diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs index cfa1ca9243d7..460d35e8eada 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs @@ -222,18 +222,25 @@ public async Task GetApiKeysIdAsync(int id, System.Thr uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Bid%7D", Uri.EscapeDataString(id.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - APIKEYSApi.GetApiKeysIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions); + APIKEYSApi.GetApiKeysIdApiResponse apiResponseLocalVar = new GetApiKeysIdApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions); AfterGetApiKeysIdDefaultImplementation(apiResponseLocalVar, id); diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs index ffce7ebc04e0..aea1a62eff64 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs @@ -222,18 +222,25 @@ public async Task GetApiKeysIdAsync(int id, System.Thr uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Bid%7D", Uri.EscapeDataString(id.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - APIKEYSApi.GetApiKeysIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions); + APIKEYSApi.GetApiKeysIdApiResponse apiResponseLocalVar = new GetApiKeysIdApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions); AfterGetApiKeysIdDefaultImplementation(apiResponseLocalVar, id); diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs index a312a586bfa5..93a27a5b6fa5 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -73,7 +73,15 @@ public static string ApiKeyHeaderToString(ApiKeyHeader value) /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T +#if NET6_0_OR_GREATER + ? +#endif + result) { try { @@ -95,7 +103,15 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T +#if NET6_0_OR_GREATER + ? +#endif + result) { try { @@ -142,8 +158,10 @@ public static string SanitizeFilename(string filename) // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER if (obj is DateOnly dateOnly) return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs index c1f92ea60d77..b8a1daa558d9 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -43,7 +43,7 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new DateTimeNullableJsonConverter()); _jsonOptions.Converters.Add(new DateOnlyJsonConverter()); _jsonOptions.Converters.Add(new DateOnlyNullableJsonConverter()); - JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new JsonSerializerOptionsProvider(_jsonOptions); _services.AddSingleton(jsonSerializerOptionsProvider); _services.AddSingleton(); _services.AddSingleton(); diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs index 4e25fbff5735..c1d9901db861 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -247,13 +247,21 @@ public async Task ListAsync(string personId, System.Threading. if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -318,7 +326,12 @@ public Org.OpenAPITools.Model.Person Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -326,7 +339,11 @@ public Org.OpenAPITools.Model.Person Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Person result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Person result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 0d99f099669a..bde9bce6add4 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -165,6 +165,10 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk(out TType result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } } diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs index 048a2ccaea85..e3d593f76e02 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -60,7 +60,11 @@ static ClientUtils() /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -82,7 +86,11 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -129,6 +137,10 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs index c2a2d862a621..74252a406259 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -221,13 +221,21 @@ public async Task RootGetAsync(System.Threading.Cancellatio if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -292,7 +300,12 @@ public Org.OpenAPITools.Model.Fruit Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -300,7 +313,11 @@ public Org.OpenAPITools.Model.Fruit Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Fruit result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Fruit result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 96bba8467893..0ce5f752eb85 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -165,6 +165,10 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk(out TType result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } } diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs index 00ce4324ade8..96a62f7df523 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -60,7 +60,11 @@ static ClientUtils() /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -82,7 +86,11 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -129,6 +137,10 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs index c2a2d862a621..74252a406259 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -221,13 +221,21 @@ public async Task RootGetAsync(System.Threading.Cancellatio if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -292,7 +300,12 @@ public Org.OpenAPITools.Model.Fruit Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -300,7 +313,11 @@ public Org.OpenAPITools.Model.Fruit Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Fruit result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Fruit result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 96bba8467893..0ce5f752eb85 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -165,6 +165,10 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk(out TType result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } } diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs index c0472474f383..0984861c0e2c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -45,7 +45,11 @@ public static class ClientUtils /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -67,7 +71,11 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -114,6 +122,10 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 1fd1ffef4feb..490d20d1a61a 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -294,13 +294,21 @@ public async Task Call123TestSpecialTagsAsyn if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -365,7 +373,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -373,7 +386,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs index 879c3ecdb9ad..db3d9888945c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -470,13 +470,21 @@ public async Task FooGetAsync(System.Threading.CancellationT if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -541,7 +549,12 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() // This logic may be modified with the AsModel.mustache template return IsDefault ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -549,7 +562,11 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() /// /// /// - public bool TryDefault(out Org.OpenAPITools.Model.FooGetDefaultResponse result) + public bool TryDefault( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.FooGetDefaultResponse result) { result = null; @@ -697,13 +714,21 @@ public async Task GetCountryAsync(string country, System if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -858,13 +883,21 @@ public async Task HelloAsync(System.Threading.CancellationTok if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -929,7 +962,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -937,7 +975,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1051,13 +1093,21 @@ public async Task RolesReportGetAsync(System.Threadi if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1122,7 +1172,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1130,7 +1185,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1244,13 +1303,21 @@ public async Task TestAsync(System.Threading.CancellationToken if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1315,7 +1382,12 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1323,7 +1395,11 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs index 38f936207662..144226daaa88 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1379,13 +1379,21 @@ public async Task FakeHealthGetAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1450,7 +1458,12 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1458,7 +1471,11 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.HealthCheckResult result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.HealthCheckResult result) { result = null; @@ -1596,13 +1613,21 @@ public async Task FakeOuterBooleanSeriali if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1667,7 +1692,12 @@ public FakeOuterBooleanSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1675,7 +1705,11 @@ public FakeOuterBooleanSerializeApiResponse(ILogger /// /// - public bool TryOk(out bool? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out bool? result) { result = null; @@ -1826,13 +1860,21 @@ public async Task FakeOuterCompositeSer if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1897,7 +1939,12 @@ public Org.OpenAPITools.Model.OuterComposite Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1905,7 +1952,11 @@ public Org.OpenAPITools.Model.OuterComposite Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.OuterComposite result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.OuterComposite result) { result = null; @@ -2043,13 +2094,21 @@ public async Task FakeOuterNumberSerialize if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2114,7 +2173,12 @@ public FakeOuterNumberSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2122,7 +2186,11 @@ public FakeOuterNumberSerializeApiResponse(ILogger /// /// - public bool TryOk(out decimal? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out decimal? result) { result = null; @@ -2285,13 +2353,21 @@ public async Task FakeOuterStringSerialize if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2356,7 +2432,12 @@ public string Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2364,7 +2445,11 @@ public string Ok() /// /// /// - public bool TryOk(out string result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out string result) { result = null; @@ -2478,13 +2563,21 @@ public async Task GetArrayOfEnumsAsync(System.Threa if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2549,7 +2642,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2557,7 +2655,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -2671,13 +2773,21 @@ public async Task GetMixedAnyOfAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2742,7 +2852,12 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2750,7 +2865,11 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.MixedAnyOf result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.MixedAnyOf result) { result = null; @@ -2864,13 +2983,21 @@ public async Task GetMixedOneOfAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2935,7 +3062,12 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2943,7 +3075,11 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.MixedOneOf result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.MixedOneOf result) { result = null; @@ -3085,13 +3221,21 @@ public async Task TestAdditionalP if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -3274,13 +3418,21 @@ public async Task TestBodyWithFileSchemaAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -3479,13 +3631,21 @@ public async Task TestBodyWithQueryParamsAs if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -3676,13 +3836,21 @@ public async Task TestClientModelAsync(ModelClient if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -3747,7 +3915,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -3755,7 +3928,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; @@ -4044,13 +4221,21 @@ public async Task TestEndpointParametersAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -4323,13 +4508,21 @@ public async Task TestEnumParametersAsync(Option if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -4546,13 +4739,21 @@ public async Task TestGroupParametersAsync(bool tokenBaseLocalVars.Add(bearerTokenLocalVar1); bearerTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -4739,13 +4940,21 @@ public async Task TestInlineAddition if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -4928,13 +5137,21 @@ public async Task TestInline if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -5135,13 +5352,21 @@ public async Task TestJsonFormDataAsync(string par if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -5400,13 +5625,21 @@ public async Task TestQueryParam uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -5589,13 +5822,21 @@ public async Task TestStringMapReferenceAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index 010a227c8b27..99add155ed62 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -303,13 +303,21 @@ public async Task TestClassnameAsync(ModelClient mode if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -378,7 +386,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -386,7 +399,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/PetApi.cs index 6f1add615397..a414c4420ddd 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/PetApi.cs @@ -793,7 +793,11 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -808,13 +812,21 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1004,13 +1016,21 @@ public async Task DeletePetAsync(long petId, Option apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1202,7 +1222,11 @@ public async Task FindPetsByStatusAsync(List FindPetsByStatusAsync(List apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1291,7 +1323,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1299,7 +1336,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1478,7 +1519,11 @@ public async Task FindPetsByTagsAsync(List t tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -1492,13 +1537,21 @@ public async Task FindPetsByTagsAsync(List t if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1567,7 +1620,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1575,7 +1633,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1720,13 +1782,21 @@ public async Task GetPetByIdAsync(long petId, System.Thr if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1795,7 +1865,12 @@ public Org.OpenAPITools.Model.Pet Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1803,7 +1878,11 @@ public Org.OpenAPITools.Model.Pet Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Pet result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Pet result) { result = null; @@ -1960,7 +2039,11 @@ public async Task UpdatePetAsync(Pet pet, System.Threadin tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -1975,13 +2058,21 @@ public async Task UpdatePetAsync(Pet pet, System.Threadin if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2212,13 +2303,21 @@ public async Task UpdatePetWithFormAsync(long pet if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2445,13 +2544,21 @@ public async Task UploadFileAsync(long petId, Option apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2520,7 +2627,12 @@ public Org.OpenAPITools.Model.ApiResponse Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2528,7 +2640,11 @@ public Org.OpenAPITools.Model.ApiResponse Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ApiResponse result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ApiResponse result) { result = null; @@ -2710,13 +2826,21 @@ public async Task UploadFileWithRequired if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2785,7 +2909,12 @@ public Org.OpenAPITools.Model.ApiResponse Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2793,7 +2922,11 @@ public Org.OpenAPITools.Model.ApiResponse Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ApiResponse result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ApiResponse result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs index 2cb0523731c5..d96b8f3f429f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs @@ -460,13 +460,21 @@ public async Task DeleteOrderAsync(string orderId, Syst uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Border_id%7D", Uri.EscapeDataString(orderId.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -632,13 +640,21 @@ public async Task GetInventoryAsync(System.Threading.C if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -707,7 +723,12 @@ public Dictionary Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -715,7 +736,11 @@ public Dictionary Ok() /// /// /// - public bool TryOk(out Dictionary result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Dictionary result) { result = null; @@ -841,13 +866,21 @@ public async Task GetOrderByIdAsync(long orderId, Syst if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -912,7 +945,12 @@ public Org.OpenAPITools.Model.Order Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -920,7 +958,11 @@ public Org.OpenAPITools.Model.Order Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Order result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Order result) { result = null; @@ -1083,13 +1125,21 @@ public async Task PlaceOrderAsync(Order order, System.Th if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1154,7 +1204,12 @@ public Org.OpenAPITools.Model.Order Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1162,7 +1217,11 @@ public Org.OpenAPITools.Model.Order Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Order result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Order result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/UserApi.cs index 46a87aed2c07..30d4f2f1aad1 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/UserApi.cs @@ -715,13 +715,21 @@ public async Task CreateUserAsync(User user, System.Thre if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -904,13 +912,21 @@ public async Task CreateUsersWithArrayInp if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1093,13 +1109,21 @@ public async Task CreateUsersWithListInput if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1269,13 +1293,21 @@ public async Task DeleteUserAsync(string username, Syste uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1461,13 +1493,21 @@ public async Task GetUserByNameAsync(string username, if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1532,7 +1572,12 @@ public Org.OpenAPITools.Model.User Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1540,7 +1585,11 @@ public Org.OpenAPITools.Model.User Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.User result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.User result) { result = null; @@ -1588,7 +1637,12 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() // This logic may be modified with the AsModel.mustache template return IsCustomHttpStatusCode599 ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1596,7 +1650,11 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() /// /// /// - public bool TryCustomHttpStatusCode599(out Org.OpenAPITools.Model.User result) + public bool TryCustomHttpStatusCode599( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.User result) { result = null; @@ -1751,13 +1809,21 @@ public async Task LoginUserAsync(string password, string if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1822,7 +1888,12 @@ public string Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1830,7 +1901,11 @@ public string Ok() /// /// /// - public bool TryOk(out string result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out string result) { result = null; @@ -1941,13 +2016,21 @@ public async Task LogoutUserAsync(System.Threading.Cance uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/logout"; httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2141,13 +2224,21 @@ public async Task UpdateUserAsync(User user, string user if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 416f7a04e3d6..bd5767856501 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -165,7 +165,11 @@ public interface ICustomHttpStatusCode599 : IApiResponse /// /// /// - bool TryCustomHttpStatusCode599(out TType result); + bool TryCustomHttpStatusCode599( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } /// @@ -185,7 +189,11 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk(out TType result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } /// @@ -205,6 +213,10 @@ public interface IDefault : IApiResponse /// /// /// - bool TryDefault(out TType result); + bool TryDefault( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } } diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs index 599ba401258a..a4c5c4a44168 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -94,7 +94,11 @@ public static string ApiKeyHeaderToString(ApiKeyHeader value) /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -116,7 +120,11 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -163,6 +171,10 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index 5c4159491eec..cbcebbca1085 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -276,7 +276,48 @@ private string GetRSASignature(byte[] stringToSign) /// private string GetECDSASignature(byte[] dataToSign) { +#if NET6_0_OR_GREATER + if (!File.Exists(KeyFilePath)) + throw new Exception("key file path does not exist."); + + var ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----"; + var ecKeyFooter = "-----END EC PRIVATE KEY-----"; + var keyStr = File.ReadAllText(KeyFilePath); + var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim(); + var keyBytes = System.Convert.FromBase64String(ecKeyBase64String); + var ecdsa = ECDsa.Create(); + + var byteCount = 0; + if (KeyPassPhrase != null) + { + IntPtr unmanagedString = IntPtr.Zero; + try + { + // convert secure string to byte array + unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(KeyPassPhrase); + + string ptrToStringUni = Marshal.PtrToStringUni(unmanagedString) ?? throw new NullReferenceException(); + + ecdsa.ImportEncryptedPkcs8PrivateKey(Encoding.UTF8.GetBytes(ptrToStringUni), keyBytes, out byteCount); + } + finally + { + if (unmanagedString != IntPtr.Zero) + Marshal.ZeroFreeBSTR(unmanagedString); + } + } + else + ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount); + + var signedBytes = ecdsa.SignHash(dataToSign); + var derBytes = ConvertToECDSAANS1Format(signedBytes); + var signedString = System.Convert.ToBase64String(derBytes); + + return signedString; +#endif +#if !NET6_0_OR_GREATER throw new Exception("ECDSA signing is supported only on NETCOREAPP3_0 and above"); +#endif } private byte[] ConvertToECDSAANS1Format(byte[] signedBytes) diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs index c2a2d862a621..74252a406259 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -221,13 +221,21 @@ public async Task RootGetAsync(System.Threading.Cancellatio if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -292,7 +300,12 @@ public Org.OpenAPITools.Model.Fruit Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -300,7 +313,11 @@ public Org.OpenAPITools.Model.Fruit Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Fruit result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Fruit result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 96bba8467893..0ce5f752eb85 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -165,6 +165,10 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk(out TType result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } } diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs index 00ce4324ade8..96a62f7df523 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -60,7 +60,11 @@ static ClientUtils() /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -82,7 +86,11 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -129,6 +137,10 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 1fd1ffef4feb..490d20d1a61a 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -294,13 +294,21 @@ public async Task Call123TestSpecialTagsAsyn if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -365,7 +373,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -373,7 +386,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs index 879c3ecdb9ad..db3d9888945c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -470,13 +470,21 @@ public async Task FooGetAsync(System.Threading.CancellationT if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -541,7 +549,12 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() // This logic may be modified with the AsModel.mustache template return IsDefault ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -549,7 +562,11 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() /// /// /// - public bool TryDefault(out Org.OpenAPITools.Model.FooGetDefaultResponse result) + public bool TryDefault( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.FooGetDefaultResponse result) { result = null; @@ -697,13 +714,21 @@ public async Task GetCountryAsync(string country, System if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -858,13 +883,21 @@ public async Task HelloAsync(System.Threading.CancellationTok if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -929,7 +962,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -937,7 +975,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1051,13 +1093,21 @@ public async Task RolesReportGetAsync(System.Threadi if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1122,7 +1172,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1130,7 +1185,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1244,13 +1303,21 @@ public async Task TestAsync(System.Threading.CancellationToken if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1315,7 +1382,12 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1323,7 +1395,11 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs index b3b0cf5352ff..882649ce655c 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1379,13 +1379,21 @@ public async Task FakeHealthGetAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1450,7 +1458,12 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1458,7 +1471,11 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.HealthCheckResult result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.HealthCheckResult result) { result = null; @@ -1596,13 +1613,21 @@ public async Task FakeOuterBooleanSeriali if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1667,7 +1692,12 @@ public FakeOuterBooleanSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1675,7 +1705,11 @@ public FakeOuterBooleanSerializeApiResponse(ILogger /// /// - public bool TryOk(out bool? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out bool? result) { result = null; @@ -1826,13 +1860,21 @@ public async Task FakeOuterCompositeSer if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1897,7 +1939,12 @@ public Org.OpenAPITools.Model.OuterComposite Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1905,7 +1952,11 @@ public Org.OpenAPITools.Model.OuterComposite Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.OuterComposite result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.OuterComposite result) { result = null; @@ -2043,13 +2094,21 @@ public async Task FakeOuterNumberSerialize if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2114,7 +2173,12 @@ public FakeOuterNumberSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2122,7 +2186,11 @@ public FakeOuterNumberSerializeApiResponse(ILogger /// /// - public bool TryOk(out decimal? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out decimal? result) { result = null; @@ -2285,13 +2353,21 @@ public async Task FakeOuterStringSerialize if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2356,7 +2432,12 @@ public string Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2364,7 +2445,11 @@ public string Ok() /// /// /// - public bool TryOk(out string result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out string result) { result = null; @@ -2478,13 +2563,21 @@ public async Task GetArrayOfEnumsAsync(System.Threa if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2549,7 +2642,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2557,7 +2655,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -2671,13 +2773,21 @@ public async Task GetMixedAnyOfAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2742,7 +2852,12 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2750,7 +2865,11 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.MixedAnyOf result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.MixedAnyOf result) { result = null; @@ -2864,13 +2983,21 @@ public async Task GetMixedOneOfAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2935,7 +3062,12 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2943,7 +3075,11 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.MixedOneOf result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.MixedOneOf result) { result = null; @@ -3085,13 +3221,21 @@ public async Task TestAdditionalP if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -3274,13 +3418,21 @@ public async Task TestBodyWithFileSchemaAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -3479,13 +3631,21 @@ public async Task TestBodyWithQueryParamsAs if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -3676,13 +3836,21 @@ public async Task TestClientModelAsync(ModelClient if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -3747,7 +3915,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -3755,7 +3928,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; @@ -4044,13 +4221,21 @@ public async Task TestEndpointParametersAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -4335,13 +4520,21 @@ public async Task TestEnumParametersAsync(Option if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -4558,13 +4751,21 @@ public async Task TestGroupParametersAsync(bool tokenBaseLocalVars.Add(bearerTokenLocalVar1); bearerTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -4751,13 +4952,21 @@ public async Task TestInlineAddition if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -4940,13 +5149,21 @@ public async Task TestInline if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -5147,13 +5364,21 @@ public async Task TestJsonFormDataAsync(string par if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -5412,13 +5637,21 @@ public async Task TestQueryParam uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -5601,13 +5834,21 @@ public async Task TestStringMapReferenceAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index 010a227c8b27..99add155ed62 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -303,13 +303,21 @@ public async Task TestClassnameAsync(ModelClient mode if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -378,7 +386,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -386,7 +399,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index e86b55647135..0f1ebce15075 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -793,7 +793,11 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -808,13 +812,21 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1004,13 +1016,21 @@ public async Task DeletePetAsync(long petId, Option apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1202,7 +1222,11 @@ public async Task FindPetsByStatusAsync(List FindPetsByStatusAsync(List apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1291,7 +1323,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1299,7 +1336,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1478,7 +1519,11 @@ public async Task FindPetsByTagsAsync(List t tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -1492,13 +1537,21 @@ public async Task FindPetsByTagsAsync(List t if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1567,7 +1620,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1575,7 +1633,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1720,13 +1782,21 @@ public async Task GetPetByIdAsync(long petId, System.Thr if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1795,7 +1865,12 @@ public Org.OpenAPITools.Model.Pet Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1803,7 +1878,11 @@ public Org.OpenAPITools.Model.Pet Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Pet result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Pet result) { result = null; @@ -1960,7 +2039,11 @@ public async Task UpdatePetAsync(Pet pet, System.Threadin tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -1975,13 +2058,21 @@ public async Task UpdatePetAsync(Pet pet, System.Threadin if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2212,13 +2303,21 @@ public async Task UpdatePetWithFormAsync(long pet if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2445,13 +2544,21 @@ public async Task UploadFileAsync(long petId, Option apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2520,7 +2627,12 @@ public Org.OpenAPITools.Model.ApiResponse Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2528,7 +2640,11 @@ public Org.OpenAPITools.Model.ApiResponse Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ApiResponse result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ApiResponse result) { result = null; @@ -2710,13 +2826,21 @@ public async Task UploadFileWithRequired if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2785,7 +2909,12 @@ public Org.OpenAPITools.Model.ApiResponse Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2793,7 +2922,11 @@ public Org.OpenAPITools.Model.ApiResponse Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ApiResponse result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ApiResponse result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs index 2cb0523731c5..d96b8f3f429f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs @@ -460,13 +460,21 @@ public async Task DeleteOrderAsync(string orderId, Syst uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Border_id%7D", Uri.EscapeDataString(orderId.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -632,13 +640,21 @@ public async Task GetInventoryAsync(System.Threading.C if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -707,7 +723,12 @@ public Dictionary Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -715,7 +736,11 @@ public Dictionary Ok() /// /// /// - public bool TryOk(out Dictionary result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Dictionary result) { result = null; @@ -841,13 +866,21 @@ public async Task GetOrderByIdAsync(long orderId, Syst if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -912,7 +945,12 @@ public Org.OpenAPITools.Model.Order Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -920,7 +958,11 @@ public Org.OpenAPITools.Model.Order Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Order result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Order result) { result = null; @@ -1083,13 +1125,21 @@ public async Task PlaceOrderAsync(Order order, System.Th if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1154,7 +1204,12 @@ public Org.OpenAPITools.Model.Order Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1162,7 +1217,11 @@ public Org.OpenAPITools.Model.Order Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Order result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Order result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/UserApi.cs index 46a87aed2c07..30d4f2f1aad1 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/UserApi.cs @@ -715,13 +715,21 @@ public async Task CreateUserAsync(User user, System.Thre if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -904,13 +912,21 @@ public async Task CreateUsersWithArrayInp if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1093,13 +1109,21 @@ public async Task CreateUsersWithListInput if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1269,13 +1293,21 @@ public async Task DeleteUserAsync(string username, Syste uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1461,13 +1493,21 @@ public async Task GetUserByNameAsync(string username, if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1532,7 +1572,12 @@ public Org.OpenAPITools.Model.User Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1540,7 +1585,11 @@ public Org.OpenAPITools.Model.User Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.User result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.User result) { result = null; @@ -1588,7 +1637,12 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() // This logic may be modified with the AsModel.mustache template return IsCustomHttpStatusCode599 ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1596,7 +1650,11 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() /// /// /// - public bool TryCustomHttpStatusCode599(out Org.OpenAPITools.Model.User result) + public bool TryCustomHttpStatusCode599( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.User result) { result = null; @@ -1751,13 +1809,21 @@ public async Task LoginUserAsync(string password, string if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1822,7 +1888,12 @@ public string Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1830,7 +1901,11 @@ public string Ok() /// /// /// - public bool TryOk(out string result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out string result) { result = null; @@ -1941,13 +2016,21 @@ public async Task LogoutUserAsync(System.Threading.Cance uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/logout"; httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2141,13 +2224,21 @@ public async Task UpdateUserAsync(User user, string user if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 416f7a04e3d6..bd5767856501 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -165,7 +165,11 @@ public interface ICustomHttpStatusCode599 : IApiResponse /// /// /// - bool TryCustomHttpStatusCode599(out TType result); + bool TryCustomHttpStatusCode599( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } /// @@ -185,7 +189,11 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk(out TType result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } /// @@ -205,6 +213,10 @@ public interface IDefault : IApiResponse /// /// /// - bool TryDefault(out TType result); + bool TryDefault( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } } diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs index 231c516c999c..66f4eb2f50cf 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -94,7 +94,11 @@ public static string ApiKeyHeaderToString(ApiKeyHeader value) /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -116,7 +120,11 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -163,6 +171,10 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index 5c4159491eec..cbcebbca1085 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -276,7 +276,48 @@ private string GetRSASignature(byte[] stringToSign) /// private string GetECDSASignature(byte[] dataToSign) { +#if NET6_0_OR_GREATER + if (!File.Exists(KeyFilePath)) + throw new Exception("key file path does not exist."); + + var ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----"; + var ecKeyFooter = "-----END EC PRIVATE KEY-----"; + var keyStr = File.ReadAllText(KeyFilePath); + var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim(); + var keyBytes = System.Convert.FromBase64String(ecKeyBase64String); + var ecdsa = ECDsa.Create(); + + var byteCount = 0; + if (KeyPassPhrase != null) + { + IntPtr unmanagedString = IntPtr.Zero; + try + { + // convert secure string to byte array + unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(KeyPassPhrase); + + string ptrToStringUni = Marshal.PtrToStringUni(unmanagedString) ?? throw new NullReferenceException(); + + ecdsa.ImportEncryptedPkcs8PrivateKey(Encoding.UTF8.GetBytes(ptrToStringUni), keyBytes, out byteCount); + } + finally + { + if (unmanagedString != IntPtr.Zero) + Marshal.ZeroFreeBSTR(unmanagedString); + } + } + else + ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount); + + var signedBytes = ecdsa.SignHash(dataToSign); + var derBytes = ConvertToECDSAANS1Format(signedBytes); + var signedString = System.Convert.ToBase64String(derBytes); + + return signedString; +#endif +#if !NET6_0_OR_GREATER throw new Exception("ECDSA signing is supported only on NETCOREAPP3_0 and above"); +#endif } private byte[] ConvertToECDSAANS1Format(byte[] signedBytes) diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs index 1662385fe8f8..395d3f77aeea 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -221,13 +221,21 @@ public async Task NowGetAsync(System.Threading.CancellationT if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -292,7 +300,12 @@ public Org.OpenAPITools.Model.NowGet200Response Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -300,7 +313,11 @@ public Org.OpenAPITools.Model.NowGet200Response Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.NowGet200Response result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.NowGet200Response result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponse`1.cs index fe5b2fe67aa2..080ab124dd36 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -165,6 +165,10 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk(out TType result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } } diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs index a8adff38c919..7ce7e75d5381 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -45,7 +45,11 @@ public static class ClientUtils /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -67,7 +71,11 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -114,6 +122,10 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs index 4e25fbff5735..c1d9901db861 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -247,13 +247,21 @@ public async Task ListAsync(string personId, System.Threading. if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -318,7 +326,12 @@ public Org.OpenAPITools.Model.Person Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -326,7 +339,11 @@ public Org.OpenAPITools.Model.Person Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Person result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Person result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 0d99f099669a..bde9bce6add4 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -165,6 +165,10 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk(out TType result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } } diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs index 048a2ccaea85..e3d593f76e02 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -60,7 +60,11 @@ static ClientUtils() /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -82,7 +86,11 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -129,6 +137,10 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs index c2a2d862a621..74252a406259 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -221,13 +221,21 @@ public async Task RootGetAsync(System.Threading.Cancellatio if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -292,7 +300,12 @@ public Org.OpenAPITools.Model.Fruit Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -300,7 +313,11 @@ public Org.OpenAPITools.Model.Fruit Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Fruit result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Fruit result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 96bba8467893..0ce5f752eb85 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -165,6 +165,10 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk(out TType result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } } diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs index 00ce4324ade8..96a62f7df523 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -60,7 +60,11 @@ static ClientUtils() /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -82,7 +86,11 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -129,6 +137,10 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs index c2a2d862a621..74252a406259 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -221,13 +221,21 @@ public async Task RootGetAsync(System.Threading.Cancellatio if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -292,7 +300,12 @@ public Org.OpenAPITools.Model.Fruit Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -300,7 +313,11 @@ public Org.OpenAPITools.Model.Fruit Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Fruit result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Fruit result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 96bba8467893..0ce5f752eb85 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -165,6 +165,10 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk(out TType result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } } diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs index c0472474f383..0984861c0e2c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -45,7 +45,11 @@ public static class ClientUtils /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -67,7 +71,11 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -114,6 +122,10 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 1fd1ffef4feb..490d20d1a61a 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -294,13 +294,21 @@ public async Task Call123TestSpecialTagsAsyn if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -365,7 +373,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -373,7 +386,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs index 879c3ecdb9ad..db3d9888945c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -470,13 +470,21 @@ public async Task FooGetAsync(System.Threading.CancellationT if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -541,7 +549,12 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() // This logic may be modified with the AsModel.mustache template return IsDefault ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -549,7 +562,11 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() /// /// /// - public bool TryDefault(out Org.OpenAPITools.Model.FooGetDefaultResponse result) + public bool TryDefault( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.FooGetDefaultResponse result) { result = null; @@ -697,13 +714,21 @@ public async Task GetCountryAsync(string country, System if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -858,13 +883,21 @@ public async Task HelloAsync(System.Threading.CancellationTok if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -929,7 +962,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -937,7 +975,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1051,13 +1093,21 @@ public async Task RolesReportGetAsync(System.Threadi if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1122,7 +1172,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1130,7 +1185,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1244,13 +1303,21 @@ public async Task TestAsync(System.Threading.CancellationToken if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1315,7 +1382,12 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1323,7 +1395,11 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs index 38f936207662..144226daaa88 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1379,13 +1379,21 @@ public async Task FakeHealthGetAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1450,7 +1458,12 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1458,7 +1471,11 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.HealthCheckResult result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.HealthCheckResult result) { result = null; @@ -1596,13 +1613,21 @@ public async Task FakeOuterBooleanSeriali if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1667,7 +1692,12 @@ public FakeOuterBooleanSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1675,7 +1705,11 @@ public FakeOuterBooleanSerializeApiResponse(ILogger /// /// - public bool TryOk(out bool? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out bool? result) { result = null; @@ -1826,13 +1860,21 @@ public async Task FakeOuterCompositeSer if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1897,7 +1939,12 @@ public Org.OpenAPITools.Model.OuterComposite Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1905,7 +1952,11 @@ public Org.OpenAPITools.Model.OuterComposite Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.OuterComposite result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.OuterComposite result) { result = null; @@ -2043,13 +2094,21 @@ public async Task FakeOuterNumberSerialize if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2114,7 +2173,12 @@ public FakeOuterNumberSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2122,7 +2186,11 @@ public FakeOuterNumberSerializeApiResponse(ILogger /// /// - public bool TryOk(out decimal? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out decimal? result) { result = null; @@ -2285,13 +2353,21 @@ public async Task FakeOuterStringSerialize if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2356,7 +2432,12 @@ public string Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2364,7 +2445,11 @@ public string Ok() /// /// /// - public bool TryOk(out string result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out string result) { result = null; @@ -2478,13 +2563,21 @@ public async Task GetArrayOfEnumsAsync(System.Threa if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2549,7 +2642,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2557,7 +2655,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -2671,13 +2773,21 @@ public async Task GetMixedAnyOfAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2742,7 +2852,12 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2750,7 +2865,11 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.MixedAnyOf result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.MixedAnyOf result) { result = null; @@ -2864,13 +2983,21 @@ public async Task GetMixedOneOfAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2935,7 +3062,12 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2943,7 +3075,11 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.MixedOneOf result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.MixedOneOf result) { result = null; @@ -3085,13 +3221,21 @@ public async Task TestAdditionalP if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -3274,13 +3418,21 @@ public async Task TestBodyWithFileSchemaAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -3479,13 +3631,21 @@ public async Task TestBodyWithQueryParamsAs if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -3676,13 +3836,21 @@ public async Task TestClientModelAsync(ModelClient if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -3747,7 +3915,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -3755,7 +3928,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; @@ -4044,13 +4221,21 @@ public async Task TestEndpointParametersAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -4323,13 +4508,21 @@ public async Task TestEnumParametersAsync(Option if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -4546,13 +4739,21 @@ public async Task TestGroupParametersAsync(bool tokenBaseLocalVars.Add(bearerTokenLocalVar1); bearerTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -4739,13 +4940,21 @@ public async Task TestInlineAddition if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -4928,13 +5137,21 @@ public async Task TestInline if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -5135,13 +5352,21 @@ public async Task TestJsonFormDataAsync(string par if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -5400,13 +5625,21 @@ public async Task TestQueryParam uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -5589,13 +5822,21 @@ public async Task TestStringMapReferenceAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index 010a227c8b27..99add155ed62 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -303,13 +303,21 @@ public async Task TestClassnameAsync(ModelClient mode if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -378,7 +386,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -386,7 +399,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs index 6f1add615397..a414c4420ddd 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs @@ -793,7 +793,11 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -808,13 +812,21 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1004,13 +1016,21 @@ public async Task DeletePetAsync(long petId, Option apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1202,7 +1222,11 @@ public async Task FindPetsByStatusAsync(List FindPetsByStatusAsync(List apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1291,7 +1323,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1299,7 +1336,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1478,7 +1519,11 @@ public async Task FindPetsByTagsAsync(List t tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -1492,13 +1537,21 @@ public async Task FindPetsByTagsAsync(List t if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1567,7 +1620,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1575,7 +1633,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1720,13 +1782,21 @@ public async Task GetPetByIdAsync(long petId, System.Thr if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1795,7 +1865,12 @@ public Org.OpenAPITools.Model.Pet Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1803,7 +1878,11 @@ public Org.OpenAPITools.Model.Pet Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Pet result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Pet result) { result = null; @@ -1960,7 +2039,11 @@ public async Task UpdatePetAsync(Pet pet, System.Threadin tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -1975,13 +2058,21 @@ public async Task UpdatePetAsync(Pet pet, System.Threadin if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2212,13 +2303,21 @@ public async Task UpdatePetWithFormAsync(long pet if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2445,13 +2544,21 @@ public async Task UploadFileAsync(long petId, Option apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2520,7 +2627,12 @@ public Org.OpenAPITools.Model.ApiResponse Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2528,7 +2640,11 @@ public Org.OpenAPITools.Model.ApiResponse Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ApiResponse result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ApiResponse result) { result = null; @@ -2710,13 +2826,21 @@ public async Task UploadFileWithRequired if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2785,7 +2909,12 @@ public Org.OpenAPITools.Model.ApiResponse Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2793,7 +2922,11 @@ public Org.OpenAPITools.Model.ApiResponse Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ApiResponse result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ApiResponse result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs index 2cb0523731c5..d96b8f3f429f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs @@ -460,13 +460,21 @@ public async Task DeleteOrderAsync(string orderId, Syst uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Border_id%7D", Uri.EscapeDataString(orderId.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -632,13 +640,21 @@ public async Task GetInventoryAsync(System.Threading.C if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -707,7 +723,12 @@ public Dictionary Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -715,7 +736,11 @@ public Dictionary Ok() /// /// /// - public bool TryOk(out Dictionary result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Dictionary result) { result = null; @@ -841,13 +866,21 @@ public async Task GetOrderByIdAsync(long orderId, Syst if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -912,7 +945,12 @@ public Org.OpenAPITools.Model.Order Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -920,7 +958,11 @@ public Org.OpenAPITools.Model.Order Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Order result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Order result) { result = null; @@ -1083,13 +1125,21 @@ public async Task PlaceOrderAsync(Order order, System.Th if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1154,7 +1204,12 @@ public Org.OpenAPITools.Model.Order Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1162,7 +1217,11 @@ public Org.OpenAPITools.Model.Order Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Order result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Order result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/UserApi.cs index 46a87aed2c07..30d4f2f1aad1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/UserApi.cs @@ -715,13 +715,21 @@ public async Task CreateUserAsync(User user, System.Thre if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -904,13 +912,21 @@ public async Task CreateUsersWithArrayInp if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1093,13 +1109,21 @@ public async Task CreateUsersWithListInput if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1269,13 +1293,21 @@ public async Task DeleteUserAsync(string username, Syste uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1461,13 +1493,21 @@ public async Task GetUserByNameAsync(string username, if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1532,7 +1572,12 @@ public Org.OpenAPITools.Model.User Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1540,7 +1585,11 @@ public Org.OpenAPITools.Model.User Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.User result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.User result) { result = null; @@ -1588,7 +1637,12 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() // This logic may be modified with the AsModel.mustache template return IsCustomHttpStatusCode599 ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1596,7 +1650,11 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() /// /// /// - public bool TryCustomHttpStatusCode599(out Org.OpenAPITools.Model.User result) + public bool TryCustomHttpStatusCode599( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.User result) { result = null; @@ -1751,13 +1809,21 @@ public async Task LoginUserAsync(string password, string if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1822,7 +1888,12 @@ public string Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1830,7 +1901,11 @@ public string Ok() /// /// /// - public bool TryOk(out string result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out string result) { result = null; @@ -1941,13 +2016,21 @@ public async Task LogoutUserAsync(System.Threading.Cance uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/logout"; httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2141,13 +2224,21 @@ public async Task UpdateUserAsync(User user, string user if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 416f7a04e3d6..bd5767856501 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -165,7 +165,11 @@ public interface ICustomHttpStatusCode599 : IApiResponse /// /// /// - bool TryCustomHttpStatusCode599(out TType result); + bool TryCustomHttpStatusCode599( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } /// @@ -185,7 +189,11 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk(out TType result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } /// @@ -205,6 +213,10 @@ public interface IDefault : IApiResponse /// /// /// - bool TryDefault(out TType result); + bool TryDefault( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } } diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs index 599ba401258a..a4c5c4a44168 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -94,7 +94,11 @@ public static string ApiKeyHeaderToString(ApiKeyHeader value) /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -116,7 +120,11 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -163,6 +171,10 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index 5c4159491eec..cbcebbca1085 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -276,7 +276,48 @@ private string GetRSASignature(byte[] stringToSign) /// private string GetECDSASignature(byte[] dataToSign) { +#if NET6_0_OR_GREATER + if (!File.Exists(KeyFilePath)) + throw new Exception("key file path does not exist."); + + var ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----"; + var ecKeyFooter = "-----END EC PRIVATE KEY-----"; + var keyStr = File.ReadAllText(KeyFilePath); + var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim(); + var keyBytes = System.Convert.FromBase64String(ecKeyBase64String); + var ecdsa = ECDsa.Create(); + + var byteCount = 0; + if (KeyPassPhrase != null) + { + IntPtr unmanagedString = IntPtr.Zero; + try + { + // convert secure string to byte array + unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(KeyPassPhrase); + + string ptrToStringUni = Marshal.PtrToStringUni(unmanagedString) ?? throw new NullReferenceException(); + + ecdsa.ImportEncryptedPkcs8PrivateKey(Encoding.UTF8.GetBytes(ptrToStringUni), keyBytes, out byteCount); + } + finally + { + if (unmanagedString != IntPtr.Zero) + Marshal.ZeroFreeBSTR(unmanagedString); + } + } + else + ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount); + + var signedBytes = ecdsa.SignHash(dataToSign); + var derBytes = ConvertToECDSAANS1Format(signedBytes); + var signedString = System.Convert.ToBase64String(derBytes); + + return signedString; +#endif +#if !NET6_0_OR_GREATER throw new Exception("ECDSA signing is supported only on NETCOREAPP3_0 and above"); +#endif } private byte[] ConvertToECDSAANS1Format(byte[] signedBytes) diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs index c2a2d862a621..74252a406259 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -221,13 +221,21 @@ public async Task RootGetAsync(System.Threading.Cancellatio if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -292,7 +300,12 @@ public Org.OpenAPITools.Model.Fruit Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -300,7 +313,11 @@ public Org.OpenAPITools.Model.Fruit Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Fruit result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Fruit result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 96bba8467893..0ce5f752eb85 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -165,6 +165,10 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk(out TType result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } } diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs index 00ce4324ade8..96a62f7df523 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -60,7 +60,11 @@ static ClientUtils() /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -82,7 +86,11 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -129,6 +137,10 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 1fd1ffef4feb..490d20d1a61a 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -294,13 +294,21 @@ public async Task Call123TestSpecialTagsAsyn if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -365,7 +373,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -373,7 +386,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs index 879c3ecdb9ad..db3d9888945c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -470,13 +470,21 @@ public async Task FooGetAsync(System.Threading.CancellationT if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -541,7 +549,12 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() // This logic may be modified with the AsModel.mustache template return IsDefault ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -549,7 +562,11 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() /// /// /// - public bool TryDefault(out Org.OpenAPITools.Model.FooGetDefaultResponse result) + public bool TryDefault( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.FooGetDefaultResponse result) { result = null; @@ -697,13 +714,21 @@ public async Task GetCountryAsync(string country, System if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -858,13 +883,21 @@ public async Task HelloAsync(System.Threading.CancellationTok if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -929,7 +962,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -937,7 +975,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1051,13 +1093,21 @@ public async Task RolesReportGetAsync(System.Threadi if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1122,7 +1172,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1130,7 +1185,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1244,13 +1303,21 @@ public async Task TestAsync(System.Threading.CancellationToken if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1315,7 +1382,12 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1323,7 +1395,11 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs index b3b0cf5352ff..882649ce655c 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1379,13 +1379,21 @@ public async Task FakeHealthGetAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1450,7 +1458,12 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1458,7 +1471,11 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.HealthCheckResult result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.HealthCheckResult result) { result = null; @@ -1596,13 +1613,21 @@ public async Task FakeOuterBooleanSeriali if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1667,7 +1692,12 @@ public FakeOuterBooleanSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1675,7 +1705,11 @@ public FakeOuterBooleanSerializeApiResponse(ILogger /// /// - public bool TryOk(out bool? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out bool? result) { result = null; @@ -1826,13 +1860,21 @@ public async Task FakeOuterCompositeSer if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1897,7 +1939,12 @@ public Org.OpenAPITools.Model.OuterComposite Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1905,7 +1952,11 @@ public Org.OpenAPITools.Model.OuterComposite Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.OuterComposite result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.OuterComposite result) { result = null; @@ -2043,13 +2094,21 @@ public async Task FakeOuterNumberSerialize if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2114,7 +2173,12 @@ public FakeOuterNumberSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2122,7 +2186,11 @@ public FakeOuterNumberSerializeApiResponse(ILogger /// /// - public bool TryOk(out decimal? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out decimal? result) { result = null; @@ -2285,13 +2353,21 @@ public async Task FakeOuterStringSerialize if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2356,7 +2432,12 @@ public string Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2364,7 +2445,11 @@ public string Ok() /// /// /// - public bool TryOk(out string result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out string result) { result = null; @@ -2478,13 +2563,21 @@ public async Task GetArrayOfEnumsAsync(System.Threa if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2549,7 +2642,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2557,7 +2655,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -2671,13 +2773,21 @@ public async Task GetMixedAnyOfAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2742,7 +2852,12 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2750,7 +2865,11 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.MixedAnyOf result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.MixedAnyOf result) { result = null; @@ -2864,13 +2983,21 @@ public async Task GetMixedOneOfAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2935,7 +3062,12 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2943,7 +3075,11 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.MixedOneOf result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.MixedOneOf result) { result = null; @@ -3085,13 +3221,21 @@ public async Task TestAdditionalP if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -3274,13 +3418,21 @@ public async Task TestBodyWithFileSchemaAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -3479,13 +3631,21 @@ public async Task TestBodyWithQueryParamsAs if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -3676,13 +3836,21 @@ public async Task TestClientModelAsync(ModelClient if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -3747,7 +3915,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -3755,7 +3928,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; @@ -4044,13 +4221,21 @@ public async Task TestEndpointParametersAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -4335,13 +4520,21 @@ public async Task TestEnumParametersAsync(Option if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -4558,13 +4751,21 @@ public async Task TestGroupParametersAsync(bool tokenBaseLocalVars.Add(bearerTokenLocalVar1); bearerTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -4751,13 +4952,21 @@ public async Task TestInlineAddition if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -4940,13 +5149,21 @@ public async Task TestInline if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -5147,13 +5364,21 @@ public async Task TestJsonFormDataAsync(string par if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -5412,13 +5637,21 @@ public async Task TestQueryParam uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -5601,13 +5834,21 @@ public async Task TestStringMapReferenceAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index 010a227c8b27..99add155ed62 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -303,13 +303,21 @@ public async Task TestClassnameAsync(ModelClient mode if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -378,7 +386,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -386,7 +399,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index e86b55647135..0f1ebce15075 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -793,7 +793,11 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -808,13 +812,21 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1004,13 +1016,21 @@ public async Task DeletePetAsync(long petId, Option apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1202,7 +1222,11 @@ public async Task FindPetsByStatusAsync(List FindPetsByStatusAsync(List apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1291,7 +1323,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1299,7 +1336,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1478,7 +1519,11 @@ public async Task FindPetsByTagsAsync(List t tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -1492,13 +1537,21 @@ public async Task FindPetsByTagsAsync(List t if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1567,7 +1620,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1575,7 +1633,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1720,13 +1782,21 @@ public async Task GetPetByIdAsync(long petId, System.Thr if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1795,7 +1865,12 @@ public Org.OpenAPITools.Model.Pet Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1803,7 +1878,11 @@ public Org.OpenAPITools.Model.Pet Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Pet result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Pet result) { result = null; @@ -1960,7 +2039,11 @@ public async Task UpdatePetAsync(Pet pet, System.Threadin tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -1975,13 +2058,21 @@ public async Task UpdatePetAsync(Pet pet, System.Threadin if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2212,13 +2303,21 @@ public async Task UpdatePetWithFormAsync(long pet if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2445,13 +2544,21 @@ public async Task UploadFileAsync(long petId, Option apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2520,7 +2627,12 @@ public Org.OpenAPITools.Model.ApiResponse Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2528,7 +2640,11 @@ public Org.OpenAPITools.Model.ApiResponse Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ApiResponse result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ApiResponse result) { result = null; @@ -2710,13 +2826,21 @@ public async Task UploadFileWithRequired if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2785,7 +2909,12 @@ public Org.OpenAPITools.Model.ApiResponse Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2793,7 +2922,11 @@ public Org.OpenAPITools.Model.ApiResponse Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ApiResponse result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ApiResponse result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs index 2cb0523731c5..d96b8f3f429f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs @@ -460,13 +460,21 @@ public async Task DeleteOrderAsync(string orderId, Syst uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Border_id%7D", Uri.EscapeDataString(orderId.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -632,13 +640,21 @@ public async Task GetInventoryAsync(System.Threading.C if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -707,7 +723,12 @@ public Dictionary Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -715,7 +736,11 @@ public Dictionary Ok() /// /// /// - public bool TryOk(out Dictionary result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Dictionary result) { result = null; @@ -841,13 +866,21 @@ public async Task GetOrderByIdAsync(long orderId, Syst if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -912,7 +945,12 @@ public Org.OpenAPITools.Model.Order Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -920,7 +958,11 @@ public Org.OpenAPITools.Model.Order Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Order result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Order result) { result = null; @@ -1083,13 +1125,21 @@ public async Task PlaceOrderAsync(Order order, System.Th if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1154,7 +1204,12 @@ public Org.OpenAPITools.Model.Order Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1162,7 +1217,11 @@ public Org.OpenAPITools.Model.Order Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Order result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Order result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs index 46a87aed2c07..30d4f2f1aad1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs @@ -715,13 +715,21 @@ public async Task CreateUserAsync(User user, System.Thre if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -904,13 +912,21 @@ public async Task CreateUsersWithArrayInp if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1093,13 +1109,21 @@ public async Task CreateUsersWithListInput if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1269,13 +1293,21 @@ public async Task DeleteUserAsync(string username, Syste uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1461,13 +1493,21 @@ public async Task GetUserByNameAsync(string username, if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1532,7 +1572,12 @@ public Org.OpenAPITools.Model.User Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1540,7 +1585,11 @@ public Org.OpenAPITools.Model.User Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.User result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.User result) { result = null; @@ -1588,7 +1637,12 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() // This logic may be modified with the AsModel.mustache template return IsCustomHttpStatusCode599 ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1596,7 +1650,11 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() /// /// /// - public bool TryCustomHttpStatusCode599(out Org.OpenAPITools.Model.User result) + public bool TryCustomHttpStatusCode599( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.User result) { result = null; @@ -1751,13 +1809,21 @@ public async Task LoginUserAsync(string password, string if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1822,7 +1888,12 @@ public string Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1830,7 +1901,11 @@ public string Ok() /// /// /// - public bool TryOk(out string result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out string result) { result = null; @@ -1941,13 +2016,21 @@ public async Task LogoutUserAsync(System.Threading.Cance uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/logout"; httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2141,13 +2224,21 @@ public async Task UpdateUserAsync(User user, string user if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 416f7a04e3d6..bd5767856501 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -165,7 +165,11 @@ public interface ICustomHttpStatusCode599 : IApiResponse /// /// /// - bool TryCustomHttpStatusCode599(out TType result); + bool TryCustomHttpStatusCode599( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } /// @@ -185,7 +189,11 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk(out TType result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } /// @@ -205,6 +213,10 @@ public interface IDefault : IApiResponse /// /// /// - bool TryDefault(out TType result); + bool TryDefault( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } } diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs index 231c516c999c..66f4eb2f50cf 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -94,7 +94,11 @@ public static string ApiKeyHeaderToString(ApiKeyHeader value) /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -116,7 +120,11 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -163,6 +171,10 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index 5c4159491eec..cbcebbca1085 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -276,7 +276,48 @@ private string GetRSASignature(byte[] stringToSign) /// private string GetECDSASignature(byte[] dataToSign) { +#if NET6_0_OR_GREATER + if (!File.Exists(KeyFilePath)) + throw new Exception("key file path does not exist."); + + var ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----"; + var ecKeyFooter = "-----END EC PRIVATE KEY-----"; + var keyStr = File.ReadAllText(KeyFilePath); + var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim(); + var keyBytes = System.Convert.FromBase64String(ecKeyBase64String); + var ecdsa = ECDsa.Create(); + + var byteCount = 0; + if (KeyPassPhrase != null) + { + IntPtr unmanagedString = IntPtr.Zero; + try + { + // convert secure string to byte array + unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(KeyPassPhrase); + + string ptrToStringUni = Marshal.PtrToStringUni(unmanagedString) ?? throw new NullReferenceException(); + + ecdsa.ImportEncryptedPkcs8PrivateKey(Encoding.UTF8.GetBytes(ptrToStringUni), keyBytes, out byteCount); + } + finally + { + if (unmanagedString != IntPtr.Zero) + Marshal.ZeroFreeBSTR(unmanagedString); + } + } + else + ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount); + + var signedBytes = ecdsa.SignHash(dataToSign); + var derBytes = ConvertToECDSAANS1Format(signedBytes); + var signedString = System.Convert.ToBase64String(derBytes); + + return signedString; +#endif +#if !NET6_0_OR_GREATER throw new Exception("ECDSA signing is supported only on NETCOREAPP3_0 and above"); +#endif } private byte[] ConvertToECDSAANS1Format(byte[] signedBytes) diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs index 1662385fe8f8..395d3f77aeea 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -221,13 +221,21 @@ public async Task NowGetAsync(System.Threading.CancellationT if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -292,7 +300,12 @@ public Org.OpenAPITools.Model.NowGet200Response Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -300,7 +313,11 @@ public Org.OpenAPITools.Model.NowGet200Response Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.NowGet200Response result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.NowGet200Response result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponse`1.cs index fe5b2fe67aa2..080ab124dd36 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -165,6 +165,10 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk(out TType result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } } diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs index a8adff38c919..7ce7e75d5381 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -45,7 +45,11 @@ public static class ClientUtils /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -67,7 +71,11 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -114,6 +122,10 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs index 910c5c211fba..d9cc03e76599 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -249,18 +249,25 @@ public async Task ListAsync(string personId, System.Threading. if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - ListApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/person/display/{personId}", requestedAtLocalVar, _jsonSerializerOptions); + ListApiResponse apiResponseLocalVar = new ListApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/person/display/{personId}", requestedAtLocalVar, _jsonSerializerOptions); AfterListDefaultImplementation(apiResponseLocalVar, personId); @@ -321,7 +328,12 @@ public ListApiResponse(ILogger logger, System.Net.Http.HttpRequ // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -329,7 +341,11 @@ public ListApiResponse(ILogger logger, System.Net.Http.HttpRequ /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Person? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Person? result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 29ca5094b343..68fa10d5699f 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -167,6 +167,10 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk([NotNullWhen(true)]out TType? result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType? result); } } diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs index ce9f6af2b941..078e5d5ee0a1 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -62,7 +62,15 @@ static ClientUtils() /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T +#if NET6_0_OR_GREATER + ? +#endif + result) { try { @@ -84,7 +92,15 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T +#if NET6_0_OR_GREATER + ? +#endif + result) { try { @@ -131,8 +147,10 @@ public static string SanitizeFilename(string filename) // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER if (obj is DateOnly dateOnly) return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs index 89dc36db6665..5a4d0dc811f9 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -46,7 +46,7 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new AdultJsonConverter()); _jsonOptions.Converters.Add(new ChildJsonConverter()); _jsonOptions.Converters.Add(new PersonJsonConverter()); - JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new JsonSerializerOptionsProvider(_jsonOptions); _services.AddSingleton(jsonSerializerOptionsProvider); _services.AddSingleton(); _services.AddSingleton(); diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs index 030cc3bf12e0..b69e537e6efe 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -223,18 +223,25 @@ public async Task RootGetAsync(System.Threading.Cancellatio if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - RootGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/", requestedAtLocalVar, _jsonSerializerOptions); + RootGetApiResponse apiResponseLocalVar = new RootGetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/", requestedAtLocalVar, _jsonSerializerOptions); AfterRootGetDefaultImplementation(apiResponseLocalVar); @@ -295,7 +302,12 @@ public RootGetApiResponse(ILogger logger, System.Net.Http.Ht // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -303,7 +315,11 @@ public RootGetApiResponse(ILogger logger, System.Net.Http.Ht /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Fruit? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Fruit? result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 2675478b8b4f..f8b16165c3a2 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -167,6 +167,10 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk([NotNullWhen(true)]out TType? result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType? result); } } diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs index 17060612c0b4..809933a698b4 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -62,7 +62,15 @@ static ClientUtils() /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T +#if NET6_0_OR_GREATER + ? +#endif + result) { try { @@ -84,7 +92,15 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T +#if NET6_0_OR_GREATER + ? +#endif + result) { try { @@ -131,8 +147,10 @@ public static string SanitizeFilename(string filename) // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER if (obj is DateOnly dateOnly) return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs index 0cffc3195908..db879aa99f87 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -46,7 +46,7 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new AppleJsonConverter()); _jsonOptions.Converters.Add(new BananaJsonConverter()); _jsonOptions.Converters.Add(new FruitJsonConverter()); - JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new JsonSerializerOptionsProvider(_jsonOptions); _services.AddSingleton(jsonSerializerOptionsProvider); _services.AddSingleton(); _services.AddSingleton(); diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs index 030cc3bf12e0..b69e537e6efe 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -223,18 +223,25 @@ public async Task RootGetAsync(System.Threading.Cancellatio if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - RootGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/", requestedAtLocalVar, _jsonSerializerOptions); + RootGetApiResponse apiResponseLocalVar = new RootGetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/", requestedAtLocalVar, _jsonSerializerOptions); AfterRootGetDefaultImplementation(apiResponseLocalVar); @@ -295,7 +302,12 @@ public RootGetApiResponse(ILogger logger, System.Net.Http.Ht // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -303,7 +315,11 @@ public RootGetApiResponse(ILogger logger, System.Net.Http.Ht /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Fruit? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Fruit? result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 2675478b8b4f..f8b16165c3a2 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -167,6 +167,10 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk([NotNullWhen(true)]out TType? result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType? result); } } diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs index b19e837fb7e6..eb6bfa539d2f 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -47,7 +47,15 @@ public static class ClientUtils /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T +#if NET6_0_OR_GREATER + ? +#endif + result) { try { @@ -69,7 +77,15 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T +#if NET6_0_OR_GREATER + ? +#endif + result) { try { @@ -116,8 +132,10 @@ public static string SanitizeFilename(string filename) // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER if (obj is DateOnly dateOnly) return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs index 0cffc3195908..db879aa99f87 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -46,7 +46,7 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new AppleJsonConverter()); _jsonOptions.Converters.Add(new BananaJsonConverter()); _jsonOptions.Converters.Add(new FruitJsonConverter()); - JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new JsonSerializerOptionsProvider(_jsonOptions); _services.AddSingleton(jsonSerializerOptionsProvider); _services.AddSingleton(); _services.AddSingleton(); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 3d7d0c482339..490d20d1a61a 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -294,18 +294,25 @@ public async Task Call123TestSpecialTagsAsyn if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - Call123TestSpecialTagsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/another-fake/dummy", requestedAtLocalVar, _jsonSerializerOptions); + Call123TestSpecialTagsApiResponse apiResponseLocalVar = new Call123TestSpecialTagsApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/another-fake/dummy", requestedAtLocalVar, _jsonSerializerOptions); AfterCall123TestSpecialTagsDefaultImplementation(apiResponseLocalVar, modelClient); @@ -366,7 +373,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -374,7 +386,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs index 84ec2eff6bff..db3d9888945c 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -470,18 +470,25 @@ public async Task FooGetAsync(System.Threading.CancellationT if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FooGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/foo", requestedAtLocalVar, _jsonSerializerOptions); + FooGetApiResponse apiResponseLocalVar = new FooGetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/foo", requestedAtLocalVar, _jsonSerializerOptions); AfterFooGetDefaultImplementation(apiResponseLocalVar); @@ -542,7 +549,12 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() // This logic may be modified with the AsModel.mustache template return IsDefault ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -550,7 +562,11 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() /// /// /// - public bool TryDefault([NotNullWhen(true)]out Org.OpenAPITools.Model.FooGetDefaultResponse result) + public bool TryDefault( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.FooGetDefaultResponse result) { result = null; @@ -698,17 +714,25 @@ public async Task GetCountryAsync(string country, System if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetCountryApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/country", requestedAtLocalVar, _jsonSerializerOptions); + GetCountryApiResponse apiResponseLocalVar = new GetCountryApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/country", requestedAtLocalVar, _jsonSerializerOptions); AfterGetCountryDefaultImplementation(apiResponseLocalVar, country); @@ -859,18 +883,25 @@ public async Task HelloAsync(System.Threading.CancellationTok if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - HelloApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/hello", requestedAtLocalVar, _jsonSerializerOptions); + HelloApiResponse apiResponseLocalVar = new HelloApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/hello", requestedAtLocalVar, _jsonSerializerOptions); AfterHelloDefaultImplementation(apiResponseLocalVar); @@ -931,7 +962,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -939,7 +975,11 @@ public List Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1053,18 +1093,25 @@ public async Task RolesReportGetAsync(System.Threadi if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - RolesReportGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/roles/report", requestedAtLocalVar, _jsonSerializerOptions); + RolesReportGetApiResponse apiResponseLocalVar = new RolesReportGetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/roles/report", requestedAtLocalVar, _jsonSerializerOptions); AfterRolesReportGetDefaultImplementation(apiResponseLocalVar); @@ -1125,7 +1172,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1133,7 +1185,11 @@ public List Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1247,18 +1303,25 @@ public async Task TestAsync(System.Threading.CancellationToken if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/test", requestedAtLocalVar, _jsonSerializerOptions); + TestApiResponse apiResponseLocalVar = new TestApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/test", requestedAtLocalVar, _jsonSerializerOptions); AfterTestDefaultImplementation(apiResponseLocalVar); @@ -1319,7 +1382,12 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1327,7 +1395,11 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs index 567ffe1fa4d2..2b9131d1f2fd 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1379,18 +1379,25 @@ public async Task FakeHealthGetAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FakeHealthGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/health", requestedAtLocalVar, _jsonSerializerOptions); + FakeHealthGetApiResponse apiResponseLocalVar = new FakeHealthGetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/health", requestedAtLocalVar, _jsonSerializerOptions); AfterFakeHealthGetDefaultImplementation(apiResponseLocalVar); @@ -1451,7 +1458,12 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1459,7 +1471,11 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.HealthCheckResult result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.HealthCheckResult result) { result = null; @@ -1597,18 +1613,25 @@ public async Task FakeOuterBooleanSeriali if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FakeOuterBooleanSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/boolean", requestedAtLocalVar, _jsonSerializerOptions); + FakeOuterBooleanSerializeApiResponse apiResponseLocalVar = new FakeOuterBooleanSerializeApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/boolean", requestedAtLocalVar, _jsonSerializerOptions); AfterFakeOuterBooleanSerializeDefaultImplementation(apiResponseLocalVar, body); @@ -1669,7 +1692,12 @@ public FakeOuterBooleanSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1677,7 +1705,11 @@ public FakeOuterBooleanSerializeApiResponse(ILogger /// /// - public bool TryOk([NotNullWhen(true)]out bool? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out bool? result) { result = null; @@ -1828,18 +1860,25 @@ public async Task FakeOuterCompositeSer if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FakeOuterCompositeSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/composite", requestedAtLocalVar, _jsonSerializerOptions); + FakeOuterCompositeSerializeApiResponse apiResponseLocalVar = new FakeOuterCompositeSerializeApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/composite", requestedAtLocalVar, _jsonSerializerOptions); AfterFakeOuterCompositeSerializeDefaultImplementation(apiResponseLocalVar, outerComposite); @@ -1900,7 +1939,12 @@ public Org.OpenAPITools.Model.OuterComposite Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1908,7 +1952,11 @@ public Org.OpenAPITools.Model.OuterComposite Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.OuterComposite result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.OuterComposite result) { result = null; @@ -2046,18 +2094,25 @@ public async Task FakeOuterNumberSerialize if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FakeOuterNumberSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/number", requestedAtLocalVar, _jsonSerializerOptions); + FakeOuterNumberSerializeApiResponse apiResponseLocalVar = new FakeOuterNumberSerializeApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/number", requestedAtLocalVar, _jsonSerializerOptions); AfterFakeOuterNumberSerializeDefaultImplementation(apiResponseLocalVar, body); @@ -2118,7 +2173,12 @@ public FakeOuterNumberSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2126,7 +2186,11 @@ public FakeOuterNumberSerializeApiResponse(ILogger /// /// - public bool TryOk([NotNullWhen(true)]out decimal? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out decimal? result) { result = null; @@ -2289,18 +2353,25 @@ public async Task FakeOuterStringSerialize if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FakeOuterStringSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/string", requestedAtLocalVar, _jsonSerializerOptions); + FakeOuterStringSerializeApiResponse apiResponseLocalVar = new FakeOuterStringSerializeApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/string", requestedAtLocalVar, _jsonSerializerOptions); AfterFakeOuterStringSerializeDefaultImplementation(apiResponseLocalVar, requiredStringUuid, body); @@ -2361,7 +2432,12 @@ public string Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2369,7 +2445,11 @@ public string Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out string result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out string result) { result = null; @@ -2483,18 +2563,25 @@ public async Task GetArrayOfEnumsAsync(System.Threa if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetArrayOfEnumsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/array-of-enums", requestedAtLocalVar, _jsonSerializerOptions); + GetArrayOfEnumsApiResponse apiResponseLocalVar = new GetArrayOfEnumsApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/array-of-enums", requestedAtLocalVar, _jsonSerializerOptions); AfterGetArrayOfEnumsDefaultImplementation(apiResponseLocalVar); @@ -2555,7 +2642,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2563,7 +2655,11 @@ public List Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -2677,18 +2773,25 @@ public async Task GetMixedAnyOfAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetMixedAnyOfApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/anyOf", requestedAtLocalVar, _jsonSerializerOptions); + GetMixedAnyOfApiResponse apiResponseLocalVar = new GetMixedAnyOfApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/anyOf", requestedAtLocalVar, _jsonSerializerOptions); AfterGetMixedAnyOfDefaultImplementation(apiResponseLocalVar); @@ -2749,7 +2852,12 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2757,7 +2865,11 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.MixedAnyOf result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.MixedAnyOf result) { result = null; @@ -2871,18 +2983,25 @@ public async Task GetMixedOneOfAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetMixedOneOfApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/oneOf", requestedAtLocalVar, _jsonSerializerOptions); + GetMixedOneOfApiResponse apiResponseLocalVar = new GetMixedOneOfApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/oneOf", requestedAtLocalVar, _jsonSerializerOptions); AfterGetMixedOneOfDefaultImplementation(apiResponseLocalVar); @@ -2943,7 +3062,12 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2951,7 +3075,11 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.MixedOneOf result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.MixedOneOf result) { result = null; @@ -3093,17 +3221,25 @@ public async Task TestAdditionalP if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/additionalProperties-reference", requestedAtLocalVar, _jsonSerializerOptions); + TestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar = new TestAdditionalPropertiesReferenceApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/additionalProperties-reference", requestedAtLocalVar, _jsonSerializerOptions); AfterTestAdditionalPropertiesReferenceDefaultImplementation(apiResponseLocalVar, requestBody); @@ -3282,17 +3418,25 @@ public async Task TestBodyWithFileSchemaAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestBodyWithFileSchemaApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-file-schema", requestedAtLocalVar, _jsonSerializerOptions); + TestBodyWithFileSchemaApiResponse apiResponseLocalVar = new TestBodyWithFileSchemaApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-file-schema", requestedAtLocalVar, _jsonSerializerOptions); AfterTestBodyWithFileSchemaDefaultImplementation(apiResponseLocalVar, fileSchemaTestClass); @@ -3487,17 +3631,25 @@ public async Task TestBodyWithQueryParamsAs if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestBodyWithQueryParamsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-query-params", requestedAtLocalVar, _jsonSerializerOptions); + TestBodyWithQueryParamsApiResponse apiResponseLocalVar = new TestBodyWithQueryParamsApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-query-params", requestedAtLocalVar, _jsonSerializerOptions); AfterTestBodyWithQueryParamsDefaultImplementation(apiResponseLocalVar, query, user); @@ -3684,18 +3836,25 @@ public async Task TestClientModelAsync(ModelClient if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestClientModelApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + TestClientModelApiResponse apiResponseLocalVar = new TestClientModelApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); AfterTestClientModelDefaultImplementation(apiResponseLocalVar, modelClient); @@ -3756,7 +3915,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -3764,7 +3928,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; @@ -4053,17 +4221,25 @@ public async Task TestEndpointParametersAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestEndpointParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + TestEndpointParametersApiResponse apiResponseLocalVar = new TestEndpointParametersApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); AfterTestEndpointParametersDefaultImplementation(apiResponseLocalVar, number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); @@ -4332,17 +4508,25 @@ public async Task TestEnumParametersAsync(Option if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestEnumParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + TestEnumParametersApiResponse apiResponseLocalVar = new TestEnumParametersApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); AfterTestEnumParametersDefaultImplementation(apiResponseLocalVar, enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); @@ -4555,18 +4739,25 @@ public async Task TestGroupParametersAsync(bool tokenBaseLocalVars.Add(bearerTokenLocalVar1); bearerTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestGroupParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + TestGroupParametersApiResponse apiResponseLocalVar = new TestGroupParametersApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); AfterTestGroupParametersDefaultImplementation(apiResponseLocalVar, requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); @@ -4749,17 +4940,25 @@ public async Task TestInlineAddition if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestInlineAdditionalPropertiesApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); + TestInlineAdditionalPropertiesApiResponse apiResponseLocalVar = new TestInlineAdditionalPropertiesApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); AfterTestInlineAdditionalPropertiesDefaultImplementation(apiResponseLocalVar, requestBody); @@ -4938,17 +5137,25 @@ public async Task TestInline if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestInlineFreeformAdditionalPropertiesApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-freeform-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); + TestInlineFreeformAdditionalPropertiesApiResponse apiResponseLocalVar = new TestInlineFreeformAdditionalPropertiesApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-freeform-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); AfterTestInlineFreeformAdditionalPropertiesDefaultImplementation(apiResponseLocalVar, testInlineFreeformAdditionalPropertiesRequest); @@ -5145,17 +5352,25 @@ public async Task TestJsonFormDataAsync(string par if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestJsonFormDataApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/jsonFormData", requestedAtLocalVar, _jsonSerializerOptions); + TestJsonFormDataApiResponse apiResponseLocalVar = new TestJsonFormDataApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/jsonFormData", requestedAtLocalVar, _jsonSerializerOptions); AfterTestJsonFormDataDefaultImplementation(apiResponseLocalVar, param, param2); @@ -5410,18 +5625,25 @@ public async Task TestQueryParam uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestQueryParameterCollectionFormatApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/test-query-parameters", requestedAtLocalVar, _jsonSerializerOptions); + TestQueryParameterCollectionFormatApiResponse apiResponseLocalVar = new TestQueryParameterCollectionFormatApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/test-query-parameters", requestedAtLocalVar, _jsonSerializerOptions); AfterTestQueryParameterCollectionFormatDefaultImplementation(apiResponseLocalVar, context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); @@ -5600,17 +5822,25 @@ public async Task TestStringMapReferenceAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestStringMapReferenceApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/stringMap-reference", requestedAtLocalVar, _jsonSerializerOptions); + TestStringMapReferenceApiResponse apiResponseLocalVar = new TestStringMapReferenceApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/stringMap-reference", requestedAtLocalVar, _jsonSerializerOptions); AfterTestStringMapReferenceDefaultImplementation(apiResponseLocalVar, requestBody); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index a12284afb01b..99add155ed62 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -303,18 +303,25 @@ public async Task TestClassnameAsync(ModelClient mode if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestClassnameApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake_classname_test", requestedAtLocalVar, _jsonSerializerOptions); + TestClassnameApiResponse apiResponseLocalVar = new TestClassnameApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake_classname_test", requestedAtLocalVar, _jsonSerializerOptions); AfterTestClassnameDefaultImplementation(apiResponseLocalVar, modelClient); @@ -379,7 +386,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -387,7 +399,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs index 3361c03e39bf..a414c4420ddd 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs @@ -793,7 +793,11 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -808,17 +812,25 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - AddPetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); + AddPetApiResponse apiResponseLocalVar = new AddPetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); AfterAddPetDefaultImplementation(apiResponseLocalVar, pet); @@ -1004,18 +1016,25 @@ public async Task DeletePetAsync(long petId, Option apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - DeletePetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + DeletePetApiResponse apiResponseLocalVar = new DeletePetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); AfterDeletePetDefaultImplementation(apiResponseLocalVar, petId, apiKey); @@ -1203,7 +1222,11 @@ public async Task FindPetsByStatusAsync(List FindPetsByStatusAsync(List apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FindPetsByStatusApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByStatus", requestedAtLocalVar, _jsonSerializerOptions); + FindPetsByStatusApiResponse apiResponseLocalVar = new FindPetsByStatusApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByStatus", requestedAtLocalVar, _jsonSerializerOptions); AfterFindPetsByStatusDefaultImplementation(apiResponseLocalVar, status); @@ -1293,7 +1323,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1301,7 +1336,11 @@ public List Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1480,7 +1519,11 @@ public async Task FindPetsByTagsAsync(List t tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -1494,18 +1537,25 @@ public async Task FindPetsByTagsAsync(List t if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FindPetsByTagsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByTags", requestedAtLocalVar, _jsonSerializerOptions); + FindPetsByTagsApiResponse apiResponseLocalVar = new FindPetsByTagsApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByTags", requestedAtLocalVar, _jsonSerializerOptions); AfterFindPetsByTagsDefaultImplementation(apiResponseLocalVar, tags); @@ -1570,7 +1620,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1578,7 +1633,11 @@ public List Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1723,18 +1782,25 @@ public async Task GetPetByIdAsync(long petId, System.Thr if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetPetByIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + GetPetByIdApiResponse apiResponseLocalVar = new GetPetByIdApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); AfterGetPetByIdDefaultImplementation(apiResponseLocalVar, petId); @@ -1799,7 +1865,12 @@ public Org.OpenAPITools.Model.Pet Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1807,7 +1878,11 @@ public Org.OpenAPITools.Model.Pet Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Pet result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Pet result) { result = null; @@ -1964,7 +2039,11 @@ public async Task UpdatePetAsync(Pet pet, System.Threadin tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -1979,17 +2058,25 @@ public async Task UpdatePetAsync(Pet pet, System.Threadin if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - UpdatePetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); + UpdatePetApiResponse apiResponseLocalVar = new UpdatePetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); AfterUpdatePetDefaultImplementation(apiResponseLocalVar, pet); @@ -2216,17 +2303,25 @@ public async Task UpdatePetWithFormAsync(long pet if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - UpdatePetWithFormApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + UpdatePetWithFormApiResponse apiResponseLocalVar = new UpdatePetWithFormApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); AfterUpdatePetWithFormDefaultImplementation(apiResponseLocalVar, petId, name, status); @@ -2449,18 +2544,25 @@ public async Task UploadFileAsync(long petId, Option apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - UploadFileApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}/uploadImage", requestedAtLocalVar, _jsonSerializerOptions); + UploadFileApiResponse apiResponseLocalVar = new UploadFileApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}/uploadImage", requestedAtLocalVar, _jsonSerializerOptions); AfterUploadFileDefaultImplementation(apiResponseLocalVar, petId, additionalMetadata, file); @@ -2525,7 +2627,12 @@ public Org.OpenAPITools.Model.ApiResponse Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2533,7 +2640,11 @@ public Org.OpenAPITools.Model.ApiResponse Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ApiResponse result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ApiResponse result) { result = null; @@ -2715,18 +2826,25 @@ public async Task UploadFileWithRequired if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - UploadFileWithRequiredFileApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/{petId}/uploadImageWithRequiredFile", requestedAtLocalVar, _jsonSerializerOptions); + UploadFileWithRequiredFileApiResponse apiResponseLocalVar = new UploadFileWithRequiredFileApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/{petId}/uploadImageWithRequiredFile", requestedAtLocalVar, _jsonSerializerOptions); AfterUploadFileWithRequiredFileDefaultImplementation(apiResponseLocalVar, petId, requiredFile, additionalMetadata); @@ -2791,7 +2909,12 @@ public Org.OpenAPITools.Model.ApiResponse Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2799,7 +2922,11 @@ public Org.OpenAPITools.Model.ApiResponse Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ApiResponse result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ApiResponse result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs index b3cd5adcbcca..d96b8f3f429f 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs @@ -460,18 +460,25 @@ public async Task DeleteOrderAsync(string orderId, Syst uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Border_id%7D", Uri.EscapeDataString(orderId.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - DeleteOrderApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); + DeleteOrderApiResponse apiResponseLocalVar = new DeleteOrderApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); AfterDeleteOrderDefaultImplementation(apiResponseLocalVar, orderId); @@ -633,18 +640,25 @@ public async Task GetInventoryAsync(System.Threading.C if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetInventoryApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/inventory", requestedAtLocalVar, _jsonSerializerOptions); + GetInventoryApiResponse apiResponseLocalVar = new GetInventoryApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/inventory", requestedAtLocalVar, _jsonSerializerOptions); AfterGetInventoryDefaultImplementation(apiResponseLocalVar); @@ -709,7 +723,12 @@ public Dictionary Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -717,7 +736,11 @@ public Dictionary Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Dictionary result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Dictionary result) { result = null; @@ -843,18 +866,25 @@ public async Task GetOrderByIdAsync(long orderId, Syst if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetOrderByIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); + GetOrderByIdApiResponse apiResponseLocalVar = new GetOrderByIdApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); AfterGetOrderByIdDefaultImplementation(apiResponseLocalVar, orderId); @@ -915,7 +945,12 @@ public Org.OpenAPITools.Model.Order Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -923,7 +958,11 @@ public Org.OpenAPITools.Model.Order Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Order result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Order result) { result = null; @@ -1086,18 +1125,25 @@ public async Task PlaceOrderAsync(Order order, System.Th if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - PlaceOrderApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order", requestedAtLocalVar, _jsonSerializerOptions); + PlaceOrderApiResponse apiResponseLocalVar = new PlaceOrderApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order", requestedAtLocalVar, _jsonSerializerOptions); AfterPlaceOrderDefaultImplementation(apiResponseLocalVar, order); @@ -1158,7 +1204,12 @@ public Org.OpenAPITools.Model.Order Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1166,7 +1217,11 @@ public Org.OpenAPITools.Model.Order Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Order result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Order result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/UserApi.cs index 788e681d73c8..66c54a994961 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/UserApi.cs @@ -723,17 +723,25 @@ public async Task CreateUserAsync(User user, System.Thre if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - CreateUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user", requestedAtLocalVar, _jsonSerializerOptions); + CreateUserApiResponse apiResponseLocalVar = new CreateUserApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user", requestedAtLocalVar, _jsonSerializerOptions); AfterCreateUserDefaultImplementation(apiResponseLocalVar, user); @@ -912,17 +920,25 @@ public async Task CreateUsersWithArrayInp if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - CreateUsersWithArrayInputApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithArray", requestedAtLocalVar, _jsonSerializerOptions); + CreateUsersWithArrayInputApiResponse apiResponseLocalVar = new CreateUsersWithArrayInputApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithArray", requestedAtLocalVar, _jsonSerializerOptions); AfterCreateUsersWithArrayInputDefaultImplementation(apiResponseLocalVar, user); @@ -1101,17 +1117,25 @@ public async Task CreateUsersWithListInput if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - CreateUsersWithListInputApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithList", requestedAtLocalVar, _jsonSerializerOptions); + CreateUsersWithListInputApiResponse apiResponseLocalVar = new CreateUsersWithListInputApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithList", requestedAtLocalVar, _jsonSerializerOptions); AfterCreateUsersWithListInputDefaultImplementation(apiResponseLocalVar, user); @@ -1277,18 +1301,25 @@ public async Task DeleteUserAsync(string username, Syste uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - DeleteUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + DeleteUserApiResponse apiResponseLocalVar = new DeleteUserApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); AfterDeleteUserDefaultImplementation(apiResponseLocalVar, username); @@ -1470,18 +1501,25 @@ public async Task GetUserByNameAsync(string username, if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetUserByNameApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + GetUserByNameApiResponse apiResponseLocalVar = new GetUserByNameApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); AfterGetUserByNameDefaultImplementation(apiResponseLocalVar, username); @@ -1542,7 +1580,12 @@ public Org.OpenAPITools.Model.User Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1550,7 +1593,11 @@ public Org.OpenAPITools.Model.User Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.User result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.User result) { result = null; @@ -1598,7 +1645,12 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() // This logic may be modified with the AsModel.mustache template return IsCustomHttpStatusCode599 ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1606,7 +1658,11 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() /// /// /// - public bool TryCustomHttpStatusCode599([NotNullWhen(true)]out Org.OpenAPITools.Model.User result) + public bool TryCustomHttpStatusCode599( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.User result) { result = null; @@ -1761,18 +1817,25 @@ public async Task LoginUserAsync(string password, string if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - LoginUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/login", requestedAtLocalVar, _jsonSerializerOptions); + LoginUserApiResponse apiResponseLocalVar = new LoginUserApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/login", requestedAtLocalVar, _jsonSerializerOptions); AfterLoginUserDefaultImplementation(apiResponseLocalVar, password, username); @@ -1860,7 +1923,12 @@ public string Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1868,7 +1936,11 @@ public string Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out string result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out string result) { result = null; @@ -1979,18 +2051,25 @@ public async Task LogoutUserAsync(System.Threading.Cance uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/logout"; httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - LogoutUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/logout", requestedAtLocalVar, _jsonSerializerOptions); + LogoutUserApiResponse apiResponseLocalVar = new LogoutUserApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/logout", requestedAtLocalVar, _jsonSerializerOptions); AfterLogoutUserDefaultImplementation(apiResponseLocalVar); @@ -2180,17 +2259,25 @@ public async Task UpdateUserAsync(User user, string user if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - UpdateUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + UpdateUserApiResponse apiResponseLocalVar = new UpdateUserApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); AfterUpdateUserDefaultImplementation(apiResponseLocalVar, user, username); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 794b3601c853..bd5767856501 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -165,7 +165,11 @@ public interface ICustomHttpStatusCode599 : IApiResponse /// /// /// - bool TryCustomHttpStatusCode599([NotNullWhen(true)]out TType result); + bool TryCustomHttpStatusCode599( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } /// @@ -185,7 +189,11 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk([NotNullWhen(true)]out TType result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } /// @@ -205,6 +213,10 @@ public interface IDefault : IApiResponse /// /// /// - bool TryDefault([NotNullWhen(true)]out TType result); + bool TryDefault( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } } diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs index 32d03988e2d1..7609cfff60b9 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -91,7 +91,11 @@ public static string ApiKeyHeaderToString(ApiKeyHeader value) /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -113,7 +117,11 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -160,8 +168,10 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER if (obj is DateOnly dateOnly) return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs index f35ca51d2d2a..fc772b911105 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -190,7 +190,7 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new ZeroBasedEnumClassJsonConverter()); _jsonOptions.Converters.Add(new ZeroBasedEnumClassZeroBasedEnumJsonConverter()); _jsonOptions.Converters.Add(new ZeroBasedEnumClassZeroBasedEnumNullableJsonConverter()); - JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new JsonSerializerOptionsProvider(_jsonOptions); _services.AddSingleton(jsonSerializerOptionsProvider); _services.AddSingleton(); _services.AddSingleton(); diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index 012e633f989c..cbcebbca1085 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -276,6 +276,7 @@ private string GetRSASignature(byte[] stringToSign) /// private string GetECDSASignature(byte[] dataToSign) { +#if NET6_0_OR_GREATER if (!File.Exists(KeyFilePath)) throw new Exception("key file path does not exist."); @@ -313,6 +314,10 @@ private string GetECDSASignature(byte[] dataToSign) var signedString = System.Convert.ToBase64String(derBytes); return signedString; +#endif +#if !NET6_0_OR_GREATER + throw new Exception("ECDSA signing is supported only on NETCOREAPP3_0 and above"); +#endif } private byte[] ConvertToECDSAANS1Format(byte[] signedBytes) diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index a34c828167b1..1f8d4f80602a 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -296,18 +296,25 @@ public async Task Call123TestSpecialTagsAsyn if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - Call123TestSpecialTagsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/another-fake/dummy", requestedAtLocalVar, _jsonSerializerOptions); + Call123TestSpecialTagsApiResponse apiResponseLocalVar = new Call123TestSpecialTagsApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/another-fake/dummy", requestedAtLocalVar, _jsonSerializerOptions); AfterCall123TestSpecialTagsDefaultImplementation(apiResponseLocalVar, modelClient); @@ -368,7 +375,12 @@ public Call123TestSpecialTagsApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -376,7 +388,11 @@ public Call123TestSpecialTagsApiResponse(ILogger /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient? result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/DefaultApi.cs index cced9ce3479a..4a1b787df36b 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -472,18 +472,25 @@ public async Task FooGetAsync(System.Threading.CancellationT if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FooGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/foo", requestedAtLocalVar, _jsonSerializerOptions); + FooGetApiResponse apiResponseLocalVar = new FooGetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/foo", requestedAtLocalVar, _jsonSerializerOptions); AfterFooGetDefaultImplementation(apiResponseLocalVar); @@ -544,7 +551,12 @@ public FooGetApiResponse(ILogger logger, System.Net.Http.Http // This logic may be modified with the AsModel.mustache template return IsDefault ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -552,7 +564,11 @@ public FooGetApiResponse(ILogger logger, System.Net.Http.Http /// /// /// - public bool TryDefault([NotNullWhen(true)]out Org.OpenAPITools.Model.FooGetDefaultResponse? result) + public bool TryDefault( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.FooGetDefaultResponse? result) { result = null; @@ -700,17 +716,25 @@ public async Task GetCountryAsync(string country, System if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetCountryApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/country", requestedAtLocalVar, _jsonSerializerOptions); + GetCountryApiResponse apiResponseLocalVar = new GetCountryApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/country", requestedAtLocalVar, _jsonSerializerOptions); AfterGetCountryDefaultImplementation(apiResponseLocalVar, country); @@ -861,18 +885,25 @@ public async Task HelloAsync(System.Threading.CancellationTok if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - HelloApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/hello", requestedAtLocalVar, _jsonSerializerOptions); + HelloApiResponse apiResponseLocalVar = new HelloApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/hello", requestedAtLocalVar, _jsonSerializerOptions); AfterHelloDefaultImplementation(apiResponseLocalVar); @@ -933,7 +964,12 @@ public HelloApiResponse(ILogger logger, System.Net.Http.HttpRe // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -941,7 +977,11 @@ public HelloApiResponse(ILogger logger, System.Net.Http.HttpRe /// /// /// - public bool TryOk([NotNullWhen(true)]out List? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List? result) { result = null; @@ -1055,18 +1095,25 @@ public async Task RolesReportGetAsync(System.Threadi if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - RolesReportGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/roles/report", requestedAtLocalVar, _jsonSerializerOptions); + RolesReportGetApiResponse apiResponseLocalVar = new RolesReportGetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/roles/report", requestedAtLocalVar, _jsonSerializerOptions); AfterRolesReportGetDefaultImplementation(apiResponseLocalVar); @@ -1127,7 +1174,12 @@ public RolesReportGetApiResponse(ILogger logger, Syst // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1135,7 +1187,11 @@ public RolesReportGetApiResponse(ILogger logger, Syst /// /// /// - public bool TryOk([NotNullWhen(true)]out List? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List? result) { result = null; @@ -1249,18 +1305,25 @@ public async Task TestAsync(System.Threading.CancellationToken if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/test", requestedAtLocalVar, _jsonSerializerOptions); + TestApiResponse apiResponseLocalVar = new TestApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/test", requestedAtLocalVar, _jsonSerializerOptions); AfterTestDefaultImplementation(apiResponseLocalVar); @@ -1321,7 +1384,12 @@ public TestApiResponse(ILogger logger, System.Net.Http.HttpRequ // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1329,7 +1397,11 @@ public TestApiResponse(ILogger logger, System.Net.Http.HttpRequ /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload? result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeApi.cs index 39b422f6f7f7..c6aaaa3ae4fd 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1381,18 +1381,25 @@ public async Task FakeHealthGetAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FakeHealthGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/health", requestedAtLocalVar, _jsonSerializerOptions); + FakeHealthGetApiResponse apiResponseLocalVar = new FakeHealthGetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/health", requestedAtLocalVar, _jsonSerializerOptions); AfterFakeHealthGetDefaultImplementation(apiResponseLocalVar); @@ -1453,7 +1460,12 @@ public FakeHealthGetApiResponse(ILogger logger, System // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1461,7 +1473,11 @@ public FakeHealthGetApiResponse(ILogger logger, System /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.HealthCheckResult? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.HealthCheckResult? result) { result = null; @@ -1599,18 +1615,25 @@ public async Task FakeOuterBooleanSeriali if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FakeOuterBooleanSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/boolean", requestedAtLocalVar, _jsonSerializerOptions); + FakeOuterBooleanSerializeApiResponse apiResponseLocalVar = new FakeOuterBooleanSerializeApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/boolean", requestedAtLocalVar, _jsonSerializerOptions); AfterFakeOuterBooleanSerializeDefaultImplementation(apiResponseLocalVar, body); @@ -1671,7 +1694,12 @@ public FakeOuterBooleanSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1679,7 +1707,11 @@ public FakeOuterBooleanSerializeApiResponse(ILogger /// /// - public bool TryOk([NotNullWhen(true)]out bool? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out bool? result) { result = null; @@ -1830,18 +1862,25 @@ public async Task FakeOuterCompositeSer if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FakeOuterCompositeSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/composite", requestedAtLocalVar, _jsonSerializerOptions); + FakeOuterCompositeSerializeApiResponse apiResponseLocalVar = new FakeOuterCompositeSerializeApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/composite", requestedAtLocalVar, _jsonSerializerOptions); AfterFakeOuterCompositeSerializeDefaultImplementation(apiResponseLocalVar, outerComposite); @@ -1902,7 +1941,12 @@ public FakeOuterCompositeSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1910,7 +1954,11 @@ public FakeOuterCompositeSerializeApiResponse(ILogger /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.OuterComposite? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.OuterComposite? result) { result = null; @@ -2048,18 +2096,25 @@ public async Task FakeOuterNumberSerialize if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FakeOuterNumberSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/number", requestedAtLocalVar, _jsonSerializerOptions); + FakeOuterNumberSerializeApiResponse apiResponseLocalVar = new FakeOuterNumberSerializeApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/number", requestedAtLocalVar, _jsonSerializerOptions); AfterFakeOuterNumberSerializeDefaultImplementation(apiResponseLocalVar, body); @@ -2120,7 +2175,12 @@ public FakeOuterNumberSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2128,7 +2188,11 @@ public FakeOuterNumberSerializeApiResponse(ILogger /// /// - public bool TryOk([NotNullWhen(true)]out decimal? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out decimal? result) { result = null; @@ -2291,18 +2355,25 @@ public async Task FakeOuterStringSerialize if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FakeOuterStringSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/string", requestedAtLocalVar, _jsonSerializerOptions); + FakeOuterStringSerializeApiResponse apiResponseLocalVar = new FakeOuterStringSerializeApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/string", requestedAtLocalVar, _jsonSerializerOptions); AfterFakeOuterStringSerializeDefaultImplementation(apiResponseLocalVar, requiredStringUuid, body); @@ -2363,7 +2434,12 @@ public FakeOuterStringSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2371,7 +2447,11 @@ public FakeOuterStringSerializeApiResponse(ILogger /// /// - public bool TryOk([NotNullWhen(true)]out string? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out string? result) { result = null; @@ -2485,18 +2565,25 @@ public async Task GetArrayOfEnumsAsync(System.Threa if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetArrayOfEnumsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/array-of-enums", requestedAtLocalVar, _jsonSerializerOptions); + GetArrayOfEnumsApiResponse apiResponseLocalVar = new GetArrayOfEnumsApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/array-of-enums", requestedAtLocalVar, _jsonSerializerOptions); AfterGetArrayOfEnumsDefaultImplementation(apiResponseLocalVar); @@ -2557,7 +2644,12 @@ public GetArrayOfEnumsApiResponse(ILogger logger, Sy // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2565,7 +2657,11 @@ public GetArrayOfEnumsApiResponse(ILogger logger, Sy /// /// /// - public bool TryOk([NotNullWhen(true)]out List? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List? result) { result = null; @@ -2679,18 +2775,25 @@ public async Task GetMixedAnyOfAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetMixedAnyOfApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/anyOf", requestedAtLocalVar, _jsonSerializerOptions); + GetMixedAnyOfApiResponse apiResponseLocalVar = new GetMixedAnyOfApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/anyOf", requestedAtLocalVar, _jsonSerializerOptions); AfterGetMixedAnyOfDefaultImplementation(apiResponseLocalVar); @@ -2751,7 +2854,12 @@ public GetMixedAnyOfApiResponse(ILogger logger, System // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2759,7 +2867,11 @@ public GetMixedAnyOfApiResponse(ILogger logger, System /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.MixedAnyOf? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.MixedAnyOf? result) { result = null; @@ -2873,18 +2985,25 @@ public async Task GetMixedOneOfAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetMixedOneOfApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/oneOf", requestedAtLocalVar, _jsonSerializerOptions); + GetMixedOneOfApiResponse apiResponseLocalVar = new GetMixedOneOfApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/oneOf", requestedAtLocalVar, _jsonSerializerOptions); AfterGetMixedOneOfDefaultImplementation(apiResponseLocalVar); @@ -2945,7 +3064,12 @@ public GetMixedOneOfApiResponse(ILogger logger, System // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2953,7 +3077,11 @@ public GetMixedOneOfApiResponse(ILogger logger, System /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.MixedOneOf? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.MixedOneOf? result) { result = null; @@ -3095,17 +3223,25 @@ public async Task TestAdditionalP if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/additionalProperties-reference", requestedAtLocalVar, _jsonSerializerOptions); + TestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar = new TestAdditionalPropertiesReferenceApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/additionalProperties-reference", requestedAtLocalVar, _jsonSerializerOptions); AfterTestAdditionalPropertiesReferenceDefaultImplementation(apiResponseLocalVar, requestBody); @@ -3284,17 +3420,25 @@ public async Task TestBodyWithFileSchemaAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestBodyWithFileSchemaApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-file-schema", requestedAtLocalVar, _jsonSerializerOptions); + TestBodyWithFileSchemaApiResponse apiResponseLocalVar = new TestBodyWithFileSchemaApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-file-schema", requestedAtLocalVar, _jsonSerializerOptions); AfterTestBodyWithFileSchemaDefaultImplementation(apiResponseLocalVar, fileSchemaTestClass); @@ -3489,17 +3633,25 @@ public async Task TestBodyWithQueryParamsAs if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestBodyWithQueryParamsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-query-params", requestedAtLocalVar, _jsonSerializerOptions); + TestBodyWithQueryParamsApiResponse apiResponseLocalVar = new TestBodyWithQueryParamsApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-query-params", requestedAtLocalVar, _jsonSerializerOptions); AfterTestBodyWithQueryParamsDefaultImplementation(apiResponseLocalVar, query, user); @@ -3686,18 +3838,25 @@ public async Task TestClientModelAsync(ModelClient if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestClientModelApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + TestClientModelApiResponse apiResponseLocalVar = new TestClientModelApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); AfterTestClientModelDefaultImplementation(apiResponseLocalVar, modelClient); @@ -3758,7 +3917,12 @@ public TestClientModelApiResponse(ILogger logger, Sy // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -3766,7 +3930,11 @@ public TestClientModelApiResponse(ILogger logger, Sy /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient? result) { result = null; @@ -4055,17 +4223,25 @@ public async Task TestEndpointParametersAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestEndpointParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + TestEndpointParametersApiResponse apiResponseLocalVar = new TestEndpointParametersApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); AfterTestEndpointParametersDefaultImplementation(apiResponseLocalVar, number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); @@ -4346,17 +4522,25 @@ public async Task TestEnumParametersAsync(Option if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestEnumParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + TestEnumParametersApiResponse apiResponseLocalVar = new TestEnumParametersApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); AfterTestEnumParametersDefaultImplementation(apiResponseLocalVar, enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); @@ -4569,18 +4753,25 @@ public async Task TestGroupParametersAsync(bool tokenBaseLocalVars.Add(bearerTokenLocalVar1); bearerTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestGroupParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + TestGroupParametersApiResponse apiResponseLocalVar = new TestGroupParametersApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); AfterTestGroupParametersDefaultImplementation(apiResponseLocalVar, requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); @@ -4763,17 +4954,25 @@ public async Task TestInlineAddition if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestInlineAdditionalPropertiesApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); + TestInlineAdditionalPropertiesApiResponse apiResponseLocalVar = new TestInlineAdditionalPropertiesApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); AfterTestInlineAdditionalPropertiesDefaultImplementation(apiResponseLocalVar, requestBody); @@ -4952,17 +5151,25 @@ public async Task TestInline if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestInlineFreeformAdditionalPropertiesApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-freeform-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); + TestInlineFreeformAdditionalPropertiesApiResponse apiResponseLocalVar = new TestInlineFreeformAdditionalPropertiesApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-freeform-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); AfterTestInlineFreeformAdditionalPropertiesDefaultImplementation(apiResponseLocalVar, testInlineFreeformAdditionalPropertiesRequest); @@ -5159,17 +5366,25 @@ public async Task TestJsonFormDataAsync(string par if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestJsonFormDataApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/jsonFormData", requestedAtLocalVar, _jsonSerializerOptions); + TestJsonFormDataApiResponse apiResponseLocalVar = new TestJsonFormDataApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/jsonFormData", requestedAtLocalVar, _jsonSerializerOptions); AfterTestJsonFormDataDefaultImplementation(apiResponseLocalVar, param, param2); @@ -5424,18 +5639,25 @@ public async Task TestQueryParam uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestQueryParameterCollectionFormatApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/test-query-parameters", requestedAtLocalVar, _jsonSerializerOptions); + TestQueryParameterCollectionFormatApiResponse apiResponseLocalVar = new TestQueryParameterCollectionFormatApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/test-query-parameters", requestedAtLocalVar, _jsonSerializerOptions); AfterTestQueryParameterCollectionFormatDefaultImplementation(apiResponseLocalVar, context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); @@ -5614,17 +5836,25 @@ public async Task TestStringMapReferenceAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestStringMapReferenceApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/stringMap-reference", requestedAtLocalVar, _jsonSerializerOptions); + TestStringMapReferenceApiResponse apiResponseLocalVar = new TestStringMapReferenceApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/stringMap-reference", requestedAtLocalVar, _jsonSerializerOptions); AfterTestStringMapReferenceDefaultImplementation(apiResponseLocalVar, requestBody); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index d70af83c9115..f2255affdb6b 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -305,18 +305,25 @@ public async Task TestClassnameAsync(ModelClient mode if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestClassnameApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake_classname_test", requestedAtLocalVar, _jsonSerializerOptions); + TestClassnameApiResponse apiResponseLocalVar = new TestClassnameApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake_classname_test", requestedAtLocalVar, _jsonSerializerOptions); AfterTestClassnameDefaultImplementation(apiResponseLocalVar, modelClient); @@ -381,7 +388,12 @@ public TestClassnameApiResponse(ILogger logger, System // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -389,7 +401,11 @@ public TestClassnameApiResponse(ILogger logger, System /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient? result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs index 1d959b49106f..e25fe5ad13cd 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs @@ -795,7 +795,11 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -810,17 +814,25 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - AddPetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); + AddPetApiResponse apiResponseLocalVar = new AddPetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); AfterAddPetDefaultImplementation(apiResponseLocalVar, pet); @@ -1006,18 +1018,25 @@ public async Task DeletePetAsync(long petId, Option apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - DeletePetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + DeletePetApiResponse apiResponseLocalVar = new DeletePetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); AfterDeletePetDefaultImplementation(apiResponseLocalVar, petId, apiKey); @@ -1205,7 +1224,11 @@ public async Task FindPetsByStatusAsync(List FindPetsByStatusAsync(List apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FindPetsByStatusApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByStatus", requestedAtLocalVar, _jsonSerializerOptions); + FindPetsByStatusApiResponse apiResponseLocalVar = new FindPetsByStatusApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByStatus", requestedAtLocalVar, _jsonSerializerOptions); AfterFindPetsByStatusDefaultImplementation(apiResponseLocalVar, status); @@ -1295,7 +1325,12 @@ public FindPetsByStatusApiResponse(ILogger logger, // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1303,7 +1338,11 @@ public FindPetsByStatusApiResponse(ILogger logger, /// /// /// - public bool TryOk([NotNullWhen(true)]out List? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List? result) { result = null; @@ -1482,7 +1521,11 @@ public async Task FindPetsByTagsAsync(List t tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -1496,18 +1539,25 @@ public async Task FindPetsByTagsAsync(List t if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FindPetsByTagsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByTags", requestedAtLocalVar, _jsonSerializerOptions); + FindPetsByTagsApiResponse apiResponseLocalVar = new FindPetsByTagsApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByTags", requestedAtLocalVar, _jsonSerializerOptions); AfterFindPetsByTagsDefaultImplementation(apiResponseLocalVar, tags); @@ -1572,7 +1622,12 @@ public FindPetsByTagsApiResponse(ILogger logger, Syst // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1580,7 +1635,11 @@ public FindPetsByTagsApiResponse(ILogger logger, Syst /// /// /// - public bool TryOk([NotNullWhen(true)]out List? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List? result) { result = null; @@ -1725,18 +1784,25 @@ public async Task GetPetByIdAsync(long petId, System.Thr if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetPetByIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + GetPetByIdApiResponse apiResponseLocalVar = new GetPetByIdApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); AfterGetPetByIdDefaultImplementation(apiResponseLocalVar, petId); @@ -1801,7 +1867,12 @@ public GetPetByIdApiResponse(ILogger logger, System.Net.H // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1809,7 +1880,11 @@ public GetPetByIdApiResponse(ILogger logger, System.Net.H /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Pet? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Pet? result) { result = null; @@ -1966,7 +2041,11 @@ public async Task UpdatePetAsync(Pet pet, System.Threadin tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -1981,17 +2060,25 @@ public async Task UpdatePetAsync(Pet pet, System.Threadin if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - UpdatePetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); + UpdatePetApiResponse apiResponseLocalVar = new UpdatePetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); AfterUpdatePetDefaultImplementation(apiResponseLocalVar, pet); @@ -2218,17 +2305,25 @@ public async Task UpdatePetWithFormAsync(long pet if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - UpdatePetWithFormApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + UpdatePetWithFormApiResponse apiResponseLocalVar = new UpdatePetWithFormApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); AfterUpdatePetWithFormDefaultImplementation(apiResponseLocalVar, petId, name, status); @@ -2451,18 +2546,25 @@ public async Task UploadFileAsync(long petId, Option apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - UploadFileApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}/uploadImage", requestedAtLocalVar, _jsonSerializerOptions); + UploadFileApiResponse apiResponseLocalVar = new UploadFileApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}/uploadImage", requestedAtLocalVar, _jsonSerializerOptions); AfterUploadFileDefaultImplementation(apiResponseLocalVar, petId, additionalMetadata, file); @@ -2527,7 +2629,12 @@ public UploadFileApiResponse(ILogger logger, System.Net.H // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2535,7 +2642,11 @@ public UploadFileApiResponse(ILogger logger, System.Net.H /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ApiResponse? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ApiResponse? result) { result = null; @@ -2717,18 +2828,25 @@ public async Task UploadFileWithRequired if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - UploadFileWithRequiredFileApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/{petId}/uploadImageWithRequiredFile", requestedAtLocalVar, _jsonSerializerOptions); + UploadFileWithRequiredFileApiResponse apiResponseLocalVar = new UploadFileWithRequiredFileApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/{petId}/uploadImageWithRequiredFile", requestedAtLocalVar, _jsonSerializerOptions); AfterUploadFileWithRequiredFileDefaultImplementation(apiResponseLocalVar, petId, requiredFile, additionalMetadata); @@ -2793,7 +2911,12 @@ public UploadFileWithRequiredFileApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2801,7 +2924,11 @@ public UploadFileWithRequiredFileApiResponse(ILogger /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ApiResponse? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ApiResponse? result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/StoreApi.cs index 1677ff9901e2..69bcd9ac1d7e 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/StoreApi.cs @@ -462,18 +462,25 @@ public async Task DeleteOrderAsync(string orderId, Syst uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Border_id%7D", Uri.EscapeDataString(orderId.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - DeleteOrderApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); + DeleteOrderApiResponse apiResponseLocalVar = new DeleteOrderApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); AfterDeleteOrderDefaultImplementation(apiResponseLocalVar, orderId); @@ -635,18 +642,25 @@ public async Task GetInventoryAsync(System.Threading.C if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetInventoryApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/inventory", requestedAtLocalVar, _jsonSerializerOptions); + GetInventoryApiResponse apiResponseLocalVar = new GetInventoryApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/inventory", requestedAtLocalVar, _jsonSerializerOptions); AfterGetInventoryDefaultImplementation(apiResponseLocalVar); @@ -711,7 +725,12 @@ public GetInventoryApiResponse(ILogger logger, System.N // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -719,7 +738,11 @@ public GetInventoryApiResponse(ILogger logger, System.N /// /// /// - public bool TryOk([NotNullWhen(true)]out Dictionary? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Dictionary? result) { result = null; @@ -845,18 +868,25 @@ public async Task GetOrderByIdAsync(long orderId, Syst if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetOrderByIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); + GetOrderByIdApiResponse apiResponseLocalVar = new GetOrderByIdApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); AfterGetOrderByIdDefaultImplementation(apiResponseLocalVar, orderId); @@ -917,7 +947,12 @@ public GetOrderByIdApiResponse(ILogger logger, System.N // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -925,7 +960,11 @@ public GetOrderByIdApiResponse(ILogger logger, System.N /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Order? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Order? result) { result = null; @@ -1088,18 +1127,25 @@ public async Task PlaceOrderAsync(Order order, System.Th if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - PlaceOrderApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order", requestedAtLocalVar, _jsonSerializerOptions); + PlaceOrderApiResponse apiResponseLocalVar = new PlaceOrderApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order", requestedAtLocalVar, _jsonSerializerOptions); AfterPlaceOrderDefaultImplementation(apiResponseLocalVar, order); @@ -1160,7 +1206,12 @@ public PlaceOrderApiResponse(ILogger logger, System.Net.H // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1168,7 +1219,11 @@ public PlaceOrderApiResponse(ILogger logger, System.Net.H /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Order? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Order? result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/UserApi.cs index 0352814ae67d..6e5832560558 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/UserApi.cs @@ -725,17 +725,25 @@ public async Task CreateUserAsync(User user, System.Thre if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - CreateUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user", requestedAtLocalVar, _jsonSerializerOptions); + CreateUserApiResponse apiResponseLocalVar = new CreateUserApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user", requestedAtLocalVar, _jsonSerializerOptions); AfterCreateUserDefaultImplementation(apiResponseLocalVar, user); @@ -914,17 +922,25 @@ public async Task CreateUsersWithArrayInp if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - CreateUsersWithArrayInputApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithArray", requestedAtLocalVar, _jsonSerializerOptions); + CreateUsersWithArrayInputApiResponse apiResponseLocalVar = new CreateUsersWithArrayInputApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithArray", requestedAtLocalVar, _jsonSerializerOptions); AfterCreateUsersWithArrayInputDefaultImplementation(apiResponseLocalVar, user); @@ -1103,17 +1119,25 @@ public async Task CreateUsersWithListInput if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - CreateUsersWithListInputApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithList", requestedAtLocalVar, _jsonSerializerOptions); + CreateUsersWithListInputApiResponse apiResponseLocalVar = new CreateUsersWithListInputApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithList", requestedAtLocalVar, _jsonSerializerOptions); AfterCreateUsersWithListInputDefaultImplementation(apiResponseLocalVar, user); @@ -1279,18 +1303,25 @@ public async Task DeleteUserAsync(string username, Syste uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - DeleteUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + DeleteUserApiResponse apiResponseLocalVar = new DeleteUserApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); AfterDeleteUserDefaultImplementation(apiResponseLocalVar, username); @@ -1472,18 +1503,25 @@ public async Task GetUserByNameAsync(string username, if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetUserByNameApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + GetUserByNameApiResponse apiResponseLocalVar = new GetUserByNameApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); AfterGetUserByNameDefaultImplementation(apiResponseLocalVar, username); @@ -1544,7 +1582,12 @@ public GetUserByNameApiResponse(ILogger logger, System // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1552,7 +1595,11 @@ public GetUserByNameApiResponse(ILogger logger, System /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.User? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.User? result) { result = null; @@ -1600,7 +1647,12 @@ public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.User? result) // This logic may be modified with the AsModel.mustache template return IsCustomHttpStatusCode599 ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1608,7 +1660,11 @@ public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.User? result) /// /// /// - public bool TryCustomHttpStatusCode599([NotNullWhen(true)]out Org.OpenAPITools.Model.User? result) + public bool TryCustomHttpStatusCode599( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.User? result) { result = null; @@ -1763,18 +1819,25 @@ public async Task LoginUserAsync(string password, string if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - LoginUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/login", requestedAtLocalVar, _jsonSerializerOptions); + LoginUserApiResponse apiResponseLocalVar = new LoginUserApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/login", requestedAtLocalVar, _jsonSerializerOptions); AfterLoginUserDefaultImplementation(apiResponseLocalVar, password, username); @@ -1862,7 +1925,12 @@ public LoginUserApiResponse(ILogger logger, System.Net.Htt // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1870,7 +1938,11 @@ public LoginUserApiResponse(ILogger logger, System.Net.Htt /// /// /// - public bool TryOk([NotNullWhen(true)]out string? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out string? result) { result = null; @@ -1981,18 +2053,25 @@ public async Task LogoutUserAsync(System.Threading.Cance uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/logout"; httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - LogoutUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/logout", requestedAtLocalVar, _jsonSerializerOptions); + LogoutUserApiResponse apiResponseLocalVar = new LogoutUserApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/logout", requestedAtLocalVar, _jsonSerializerOptions); AfterLogoutUserDefaultImplementation(apiResponseLocalVar); @@ -2182,17 +2261,25 @@ public async Task UpdateUserAsync(User user, string user if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - UpdateUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + UpdateUserApiResponse apiResponseLocalVar = new UpdateUserApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); AfterUpdateUserDefaultImplementation(apiResponseLocalVar, user, username); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 88b4a497394b..2622f0d2692e 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -167,7 +167,11 @@ public interface ICustomHttpStatusCode599 : IApiResponse /// /// /// - bool TryCustomHttpStatusCode599([NotNullWhen(true)]out TType? result); + bool TryCustomHttpStatusCode599( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType? result); } /// @@ -187,7 +191,11 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk([NotNullWhen(true)]out TType? result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType? result); } /// @@ -207,6 +215,10 @@ public interface IDefault : IApiResponse /// /// /// - bool TryDefault([NotNullWhen(true)]out TType? result); + bool TryDefault( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType? result); } } diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs index ec53dbda4326..8897fec5bd0f 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -93,7 +93,15 @@ public static string ApiKeyHeaderToString(ApiKeyHeader value) /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T +#if NET6_0_OR_GREATER + ? +#endif + result) { try { @@ -115,7 +123,15 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T +#if NET6_0_OR_GREATER + ? +#endif + result) { try { @@ -162,8 +178,10 @@ public static string SanitizeFilename(string filename) // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER if (obj is DateOnly dateOnly) return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs index 8be0791ee4fb..f6b757935488 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -146,7 +146,7 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new ZeroBasedEnumJsonConverter()); _jsonOptions.Converters.Add(new ZeroBasedEnumNullableJsonConverter()); _jsonOptions.Converters.Add(new ZeroBasedEnumClassJsonConverter()); - JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new JsonSerializerOptionsProvider(_jsonOptions); _services.AddSingleton(jsonSerializerOptionsProvider); _services.AddSingleton(); _services.AddSingleton(); diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index 2d8c0b2a52f7..58b15a34c655 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -278,6 +278,7 @@ private string GetRSASignature(byte[] stringToSign) /// private string GetECDSASignature(byte[] dataToSign) { +#if NET6_0_OR_GREATER if (!File.Exists(KeyFilePath)) throw new Exception("key file path does not exist."); @@ -315,6 +316,10 @@ private string GetECDSASignature(byte[] dataToSign) var signedString = System.Convert.ToBase64String(derBytes); return signedString; +#endif +#if !NET6_0_OR_GREATER + throw new Exception("ECDSA signing is supported only on NETCOREAPP3_0 and above"); +#endif } private byte[] ConvertToECDSAANS1Format(byte[] signedBytes) diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs index 030cc3bf12e0..b69e537e6efe 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -223,18 +223,25 @@ public async Task RootGetAsync(System.Threading.Cancellatio if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - RootGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/", requestedAtLocalVar, _jsonSerializerOptions); + RootGetApiResponse apiResponseLocalVar = new RootGetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/", requestedAtLocalVar, _jsonSerializerOptions); AfterRootGetDefaultImplementation(apiResponseLocalVar); @@ -295,7 +302,12 @@ public RootGetApiResponse(ILogger logger, System.Net.Http.Ht // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -303,7 +315,11 @@ public RootGetApiResponse(ILogger logger, System.Net.Http.Ht /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Fruit? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Fruit? result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 2675478b8b4f..f8b16165c3a2 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -167,6 +167,10 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk([NotNullWhen(true)]out TType? result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType? result); } } diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs index 17060612c0b4..809933a698b4 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -62,7 +62,15 @@ static ClientUtils() /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T +#if NET6_0_OR_GREATER + ? +#endif + result) { try { @@ -84,7 +92,15 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T +#if NET6_0_OR_GREATER + ? +#endif + result) { try { @@ -131,8 +147,10 @@ public static string SanitizeFilename(string filename) // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER if (obj is DateOnly dateOnly) return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs index 0cffc3195908..db879aa99f87 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -46,7 +46,7 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new AppleJsonConverter()); _jsonOptions.Converters.Add(new BananaJsonConverter()); _jsonOptions.Converters.Add(new FruitJsonConverter()); - JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new JsonSerializerOptionsProvider(_jsonOptions); _services.AddSingleton(jsonSerializerOptionsProvider); _services.AddSingleton(); _services.AddSingleton(); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 3d7d0c482339..490d20d1a61a 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -294,18 +294,25 @@ public async Task Call123TestSpecialTagsAsyn if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - Call123TestSpecialTagsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/another-fake/dummy", requestedAtLocalVar, _jsonSerializerOptions); + Call123TestSpecialTagsApiResponse apiResponseLocalVar = new Call123TestSpecialTagsApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/another-fake/dummy", requestedAtLocalVar, _jsonSerializerOptions); AfterCall123TestSpecialTagsDefaultImplementation(apiResponseLocalVar, modelClient); @@ -366,7 +373,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -374,7 +386,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs index 84ec2eff6bff..db3d9888945c 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -470,18 +470,25 @@ public async Task FooGetAsync(System.Threading.CancellationT if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FooGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/foo", requestedAtLocalVar, _jsonSerializerOptions); + FooGetApiResponse apiResponseLocalVar = new FooGetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/foo", requestedAtLocalVar, _jsonSerializerOptions); AfterFooGetDefaultImplementation(apiResponseLocalVar); @@ -542,7 +549,12 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() // This logic may be modified with the AsModel.mustache template return IsDefault ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -550,7 +562,11 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() /// /// /// - public bool TryDefault([NotNullWhen(true)]out Org.OpenAPITools.Model.FooGetDefaultResponse result) + public bool TryDefault( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.FooGetDefaultResponse result) { result = null; @@ -698,17 +714,25 @@ public async Task GetCountryAsync(string country, System if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetCountryApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/country", requestedAtLocalVar, _jsonSerializerOptions); + GetCountryApiResponse apiResponseLocalVar = new GetCountryApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/country", requestedAtLocalVar, _jsonSerializerOptions); AfterGetCountryDefaultImplementation(apiResponseLocalVar, country); @@ -859,18 +883,25 @@ public async Task HelloAsync(System.Threading.CancellationTok if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - HelloApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/hello", requestedAtLocalVar, _jsonSerializerOptions); + HelloApiResponse apiResponseLocalVar = new HelloApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/hello", requestedAtLocalVar, _jsonSerializerOptions); AfterHelloDefaultImplementation(apiResponseLocalVar); @@ -931,7 +962,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -939,7 +975,11 @@ public List Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1053,18 +1093,25 @@ public async Task RolesReportGetAsync(System.Threadi if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - RolesReportGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/roles/report", requestedAtLocalVar, _jsonSerializerOptions); + RolesReportGetApiResponse apiResponseLocalVar = new RolesReportGetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/roles/report", requestedAtLocalVar, _jsonSerializerOptions); AfterRolesReportGetDefaultImplementation(apiResponseLocalVar); @@ -1125,7 +1172,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1133,7 +1185,11 @@ public List Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1247,18 +1303,25 @@ public async Task TestAsync(System.Threading.CancellationToken if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/test", requestedAtLocalVar, _jsonSerializerOptions); + TestApiResponse apiResponseLocalVar = new TestApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/test", requestedAtLocalVar, _jsonSerializerOptions); AfterTestDefaultImplementation(apiResponseLocalVar); @@ -1319,7 +1382,12 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1327,7 +1395,11 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs index 551265024789..c83451d5c3ab 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1379,18 +1379,25 @@ public async Task FakeHealthGetAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FakeHealthGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/health", requestedAtLocalVar, _jsonSerializerOptions); + FakeHealthGetApiResponse apiResponseLocalVar = new FakeHealthGetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/health", requestedAtLocalVar, _jsonSerializerOptions); AfterFakeHealthGetDefaultImplementation(apiResponseLocalVar); @@ -1451,7 +1458,12 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1459,7 +1471,11 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.HealthCheckResult result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.HealthCheckResult result) { result = null; @@ -1597,18 +1613,25 @@ public async Task FakeOuterBooleanSeriali if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FakeOuterBooleanSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/boolean", requestedAtLocalVar, _jsonSerializerOptions); + FakeOuterBooleanSerializeApiResponse apiResponseLocalVar = new FakeOuterBooleanSerializeApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/boolean", requestedAtLocalVar, _jsonSerializerOptions); AfterFakeOuterBooleanSerializeDefaultImplementation(apiResponseLocalVar, body); @@ -1669,7 +1692,12 @@ public FakeOuterBooleanSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1677,7 +1705,11 @@ public FakeOuterBooleanSerializeApiResponse(ILogger /// /// - public bool TryOk([NotNullWhen(true)]out bool? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out bool? result) { result = null; @@ -1828,18 +1860,25 @@ public async Task FakeOuterCompositeSer if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FakeOuterCompositeSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/composite", requestedAtLocalVar, _jsonSerializerOptions); + FakeOuterCompositeSerializeApiResponse apiResponseLocalVar = new FakeOuterCompositeSerializeApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/composite", requestedAtLocalVar, _jsonSerializerOptions); AfterFakeOuterCompositeSerializeDefaultImplementation(apiResponseLocalVar, outerComposite); @@ -1900,7 +1939,12 @@ public Org.OpenAPITools.Model.OuterComposite Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1908,7 +1952,11 @@ public Org.OpenAPITools.Model.OuterComposite Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.OuterComposite result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.OuterComposite result) { result = null; @@ -2046,18 +2094,25 @@ public async Task FakeOuterNumberSerialize if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FakeOuterNumberSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/number", requestedAtLocalVar, _jsonSerializerOptions); + FakeOuterNumberSerializeApiResponse apiResponseLocalVar = new FakeOuterNumberSerializeApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/number", requestedAtLocalVar, _jsonSerializerOptions); AfterFakeOuterNumberSerializeDefaultImplementation(apiResponseLocalVar, body); @@ -2118,7 +2173,12 @@ public FakeOuterNumberSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2126,7 +2186,11 @@ public FakeOuterNumberSerializeApiResponse(ILogger /// /// - public bool TryOk([NotNullWhen(true)]out decimal? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out decimal? result) { result = null; @@ -2289,18 +2353,25 @@ public async Task FakeOuterStringSerialize if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FakeOuterStringSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/string", requestedAtLocalVar, _jsonSerializerOptions); + FakeOuterStringSerializeApiResponse apiResponseLocalVar = new FakeOuterStringSerializeApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/string", requestedAtLocalVar, _jsonSerializerOptions); AfterFakeOuterStringSerializeDefaultImplementation(apiResponseLocalVar, requiredStringUuid, body); @@ -2361,7 +2432,12 @@ public string Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2369,7 +2445,11 @@ public string Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out string result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out string result) { result = null; @@ -2483,18 +2563,25 @@ public async Task GetArrayOfEnumsAsync(System.Threa if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetArrayOfEnumsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/array-of-enums", requestedAtLocalVar, _jsonSerializerOptions); + GetArrayOfEnumsApiResponse apiResponseLocalVar = new GetArrayOfEnumsApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/array-of-enums", requestedAtLocalVar, _jsonSerializerOptions); AfterGetArrayOfEnumsDefaultImplementation(apiResponseLocalVar); @@ -2555,7 +2642,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2563,7 +2655,11 @@ public List Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -2677,18 +2773,25 @@ public async Task GetMixedAnyOfAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetMixedAnyOfApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/anyOf", requestedAtLocalVar, _jsonSerializerOptions); + GetMixedAnyOfApiResponse apiResponseLocalVar = new GetMixedAnyOfApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/anyOf", requestedAtLocalVar, _jsonSerializerOptions); AfterGetMixedAnyOfDefaultImplementation(apiResponseLocalVar); @@ -2749,7 +2852,12 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2757,7 +2865,11 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.MixedAnyOf result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.MixedAnyOf result) { result = null; @@ -2871,18 +2983,25 @@ public async Task GetMixedOneOfAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetMixedOneOfApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/oneOf", requestedAtLocalVar, _jsonSerializerOptions); + GetMixedOneOfApiResponse apiResponseLocalVar = new GetMixedOneOfApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/oneOf", requestedAtLocalVar, _jsonSerializerOptions); AfterGetMixedOneOfDefaultImplementation(apiResponseLocalVar); @@ -2943,7 +3062,12 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2951,7 +3075,11 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.MixedOneOf result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.MixedOneOf result) { result = null; @@ -3093,17 +3221,25 @@ public async Task TestAdditionalP if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/additionalProperties-reference", requestedAtLocalVar, _jsonSerializerOptions); + TestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar = new TestAdditionalPropertiesReferenceApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/additionalProperties-reference", requestedAtLocalVar, _jsonSerializerOptions); AfterTestAdditionalPropertiesReferenceDefaultImplementation(apiResponseLocalVar, requestBody); @@ -3282,17 +3418,25 @@ public async Task TestBodyWithFileSchemaAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestBodyWithFileSchemaApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-file-schema", requestedAtLocalVar, _jsonSerializerOptions); + TestBodyWithFileSchemaApiResponse apiResponseLocalVar = new TestBodyWithFileSchemaApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-file-schema", requestedAtLocalVar, _jsonSerializerOptions); AfterTestBodyWithFileSchemaDefaultImplementation(apiResponseLocalVar, fileSchemaTestClass); @@ -3487,17 +3631,25 @@ public async Task TestBodyWithQueryParamsAs if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestBodyWithQueryParamsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-query-params", requestedAtLocalVar, _jsonSerializerOptions); + TestBodyWithQueryParamsApiResponse apiResponseLocalVar = new TestBodyWithQueryParamsApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-query-params", requestedAtLocalVar, _jsonSerializerOptions); AfterTestBodyWithQueryParamsDefaultImplementation(apiResponseLocalVar, query, user); @@ -3684,18 +3836,25 @@ public async Task TestClientModelAsync(ModelClient if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestClientModelApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + TestClientModelApiResponse apiResponseLocalVar = new TestClientModelApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); AfterTestClientModelDefaultImplementation(apiResponseLocalVar, modelClient); @@ -3756,7 +3915,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -3764,7 +3928,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; @@ -4053,17 +4221,25 @@ public async Task TestEndpointParametersAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestEndpointParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + TestEndpointParametersApiResponse apiResponseLocalVar = new TestEndpointParametersApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); AfterTestEndpointParametersDefaultImplementation(apiResponseLocalVar, number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); @@ -4344,17 +4520,25 @@ public async Task TestEnumParametersAsync(Option if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestEnumParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + TestEnumParametersApiResponse apiResponseLocalVar = new TestEnumParametersApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); AfterTestEnumParametersDefaultImplementation(apiResponseLocalVar, enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); @@ -4567,18 +4751,25 @@ public async Task TestGroupParametersAsync(bool tokenBaseLocalVars.Add(bearerTokenLocalVar1); bearerTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestGroupParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + TestGroupParametersApiResponse apiResponseLocalVar = new TestGroupParametersApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); AfterTestGroupParametersDefaultImplementation(apiResponseLocalVar, requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); @@ -4761,17 +4952,25 @@ public async Task TestInlineAddition if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestInlineAdditionalPropertiesApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); + TestInlineAdditionalPropertiesApiResponse apiResponseLocalVar = new TestInlineAdditionalPropertiesApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); AfterTestInlineAdditionalPropertiesDefaultImplementation(apiResponseLocalVar, requestBody); @@ -4950,17 +5149,25 @@ public async Task TestInline if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestInlineFreeformAdditionalPropertiesApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-freeform-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); + TestInlineFreeformAdditionalPropertiesApiResponse apiResponseLocalVar = new TestInlineFreeformAdditionalPropertiesApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-freeform-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); AfterTestInlineFreeformAdditionalPropertiesDefaultImplementation(apiResponseLocalVar, testInlineFreeformAdditionalPropertiesRequest); @@ -5157,17 +5364,25 @@ public async Task TestJsonFormDataAsync(string par if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestJsonFormDataApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/jsonFormData", requestedAtLocalVar, _jsonSerializerOptions); + TestJsonFormDataApiResponse apiResponseLocalVar = new TestJsonFormDataApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/jsonFormData", requestedAtLocalVar, _jsonSerializerOptions); AfterTestJsonFormDataDefaultImplementation(apiResponseLocalVar, param, param2); @@ -5422,18 +5637,25 @@ public async Task TestQueryParam uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestQueryParameterCollectionFormatApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/test-query-parameters", requestedAtLocalVar, _jsonSerializerOptions); + TestQueryParameterCollectionFormatApiResponse apiResponseLocalVar = new TestQueryParameterCollectionFormatApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/test-query-parameters", requestedAtLocalVar, _jsonSerializerOptions); AfterTestQueryParameterCollectionFormatDefaultImplementation(apiResponseLocalVar, context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); @@ -5612,17 +5834,25 @@ public async Task TestStringMapReferenceAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestStringMapReferenceApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/stringMap-reference", requestedAtLocalVar, _jsonSerializerOptions); + TestStringMapReferenceApiResponse apiResponseLocalVar = new TestStringMapReferenceApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/stringMap-reference", requestedAtLocalVar, _jsonSerializerOptions); AfterTestStringMapReferenceDefaultImplementation(apiResponseLocalVar, requestBody); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index a12284afb01b..99add155ed62 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -303,18 +303,25 @@ public async Task TestClassnameAsync(ModelClient mode if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestClassnameApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake_classname_test", requestedAtLocalVar, _jsonSerializerOptions); + TestClassnameApiResponse apiResponseLocalVar = new TestClassnameApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake_classname_test", requestedAtLocalVar, _jsonSerializerOptions); AfterTestClassnameDefaultImplementation(apiResponseLocalVar, modelClient); @@ -379,7 +386,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -387,7 +399,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index 0350d428124a..0f1ebce15075 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -793,7 +793,11 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -808,17 +812,25 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - AddPetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); + AddPetApiResponse apiResponseLocalVar = new AddPetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); AfterAddPetDefaultImplementation(apiResponseLocalVar, pet); @@ -1004,18 +1016,25 @@ public async Task DeletePetAsync(long petId, Option apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - DeletePetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + DeletePetApiResponse apiResponseLocalVar = new DeletePetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); AfterDeletePetDefaultImplementation(apiResponseLocalVar, petId, apiKey); @@ -1203,7 +1222,11 @@ public async Task FindPetsByStatusAsync(List FindPetsByStatusAsync(List apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FindPetsByStatusApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByStatus", requestedAtLocalVar, _jsonSerializerOptions); + FindPetsByStatusApiResponse apiResponseLocalVar = new FindPetsByStatusApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByStatus", requestedAtLocalVar, _jsonSerializerOptions); AfterFindPetsByStatusDefaultImplementation(apiResponseLocalVar, status); @@ -1293,7 +1323,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1301,7 +1336,11 @@ public List Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1480,7 +1519,11 @@ public async Task FindPetsByTagsAsync(List t tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -1494,18 +1537,25 @@ public async Task FindPetsByTagsAsync(List t if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FindPetsByTagsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByTags", requestedAtLocalVar, _jsonSerializerOptions); + FindPetsByTagsApiResponse apiResponseLocalVar = new FindPetsByTagsApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByTags", requestedAtLocalVar, _jsonSerializerOptions); AfterFindPetsByTagsDefaultImplementation(apiResponseLocalVar, tags); @@ -1570,7 +1620,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1578,7 +1633,11 @@ public List Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1723,18 +1782,25 @@ public async Task GetPetByIdAsync(long petId, System.Thr if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetPetByIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + GetPetByIdApiResponse apiResponseLocalVar = new GetPetByIdApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); AfterGetPetByIdDefaultImplementation(apiResponseLocalVar, petId); @@ -1799,7 +1865,12 @@ public Org.OpenAPITools.Model.Pet Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1807,7 +1878,11 @@ public Org.OpenAPITools.Model.Pet Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Pet result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Pet result) { result = null; @@ -1964,7 +2039,11 @@ public async Task UpdatePetAsync(Pet pet, System.Threadin tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -1979,17 +2058,25 @@ public async Task UpdatePetAsync(Pet pet, System.Threadin if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - UpdatePetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); + UpdatePetApiResponse apiResponseLocalVar = new UpdatePetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); AfterUpdatePetDefaultImplementation(apiResponseLocalVar, pet); @@ -2216,17 +2303,25 @@ public async Task UpdatePetWithFormAsync(long pet if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - UpdatePetWithFormApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + UpdatePetWithFormApiResponse apiResponseLocalVar = new UpdatePetWithFormApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); AfterUpdatePetWithFormDefaultImplementation(apiResponseLocalVar, petId, name, status); @@ -2449,18 +2544,25 @@ public async Task UploadFileAsync(long petId, Option apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - UploadFileApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}/uploadImage", requestedAtLocalVar, _jsonSerializerOptions); + UploadFileApiResponse apiResponseLocalVar = new UploadFileApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}/uploadImage", requestedAtLocalVar, _jsonSerializerOptions); AfterUploadFileDefaultImplementation(apiResponseLocalVar, petId, additionalMetadata, file); @@ -2525,7 +2627,12 @@ public Org.OpenAPITools.Model.ApiResponse Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2533,7 +2640,11 @@ public Org.OpenAPITools.Model.ApiResponse Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ApiResponse result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ApiResponse result) { result = null; @@ -2715,18 +2826,25 @@ public async Task UploadFileWithRequired if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - UploadFileWithRequiredFileApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/{petId}/uploadImageWithRequiredFile", requestedAtLocalVar, _jsonSerializerOptions); + UploadFileWithRequiredFileApiResponse apiResponseLocalVar = new UploadFileWithRequiredFileApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/{petId}/uploadImageWithRequiredFile", requestedAtLocalVar, _jsonSerializerOptions); AfterUploadFileWithRequiredFileDefaultImplementation(apiResponseLocalVar, petId, requiredFile, additionalMetadata); @@ -2791,7 +2909,12 @@ public Org.OpenAPITools.Model.ApiResponse Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2799,7 +2922,11 @@ public Org.OpenAPITools.Model.ApiResponse Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ApiResponse result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ApiResponse result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs index b3cd5adcbcca..d96b8f3f429f 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs @@ -460,18 +460,25 @@ public async Task DeleteOrderAsync(string orderId, Syst uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Border_id%7D", Uri.EscapeDataString(orderId.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - DeleteOrderApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); + DeleteOrderApiResponse apiResponseLocalVar = new DeleteOrderApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); AfterDeleteOrderDefaultImplementation(apiResponseLocalVar, orderId); @@ -633,18 +640,25 @@ public async Task GetInventoryAsync(System.Threading.C if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetInventoryApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/inventory", requestedAtLocalVar, _jsonSerializerOptions); + GetInventoryApiResponse apiResponseLocalVar = new GetInventoryApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/inventory", requestedAtLocalVar, _jsonSerializerOptions); AfterGetInventoryDefaultImplementation(apiResponseLocalVar); @@ -709,7 +723,12 @@ public Dictionary Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -717,7 +736,11 @@ public Dictionary Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Dictionary result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Dictionary result) { result = null; @@ -843,18 +866,25 @@ public async Task GetOrderByIdAsync(long orderId, Syst if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetOrderByIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); + GetOrderByIdApiResponse apiResponseLocalVar = new GetOrderByIdApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); AfterGetOrderByIdDefaultImplementation(apiResponseLocalVar, orderId); @@ -915,7 +945,12 @@ public Org.OpenAPITools.Model.Order Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -923,7 +958,11 @@ public Org.OpenAPITools.Model.Order Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Order result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Order result) { result = null; @@ -1086,18 +1125,25 @@ public async Task PlaceOrderAsync(Order order, System.Th if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - PlaceOrderApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order", requestedAtLocalVar, _jsonSerializerOptions); + PlaceOrderApiResponse apiResponseLocalVar = new PlaceOrderApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order", requestedAtLocalVar, _jsonSerializerOptions); AfterPlaceOrderDefaultImplementation(apiResponseLocalVar, order); @@ -1158,7 +1204,12 @@ public Org.OpenAPITools.Model.Order Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1166,7 +1217,11 @@ public Org.OpenAPITools.Model.Order Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Order result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Order result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs index 788e681d73c8..66c54a994961 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs @@ -723,17 +723,25 @@ public async Task CreateUserAsync(User user, System.Thre if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - CreateUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user", requestedAtLocalVar, _jsonSerializerOptions); + CreateUserApiResponse apiResponseLocalVar = new CreateUserApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user", requestedAtLocalVar, _jsonSerializerOptions); AfterCreateUserDefaultImplementation(apiResponseLocalVar, user); @@ -912,17 +920,25 @@ public async Task CreateUsersWithArrayInp if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - CreateUsersWithArrayInputApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithArray", requestedAtLocalVar, _jsonSerializerOptions); + CreateUsersWithArrayInputApiResponse apiResponseLocalVar = new CreateUsersWithArrayInputApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithArray", requestedAtLocalVar, _jsonSerializerOptions); AfterCreateUsersWithArrayInputDefaultImplementation(apiResponseLocalVar, user); @@ -1101,17 +1117,25 @@ public async Task CreateUsersWithListInput if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - CreateUsersWithListInputApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithList", requestedAtLocalVar, _jsonSerializerOptions); + CreateUsersWithListInputApiResponse apiResponseLocalVar = new CreateUsersWithListInputApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithList", requestedAtLocalVar, _jsonSerializerOptions); AfterCreateUsersWithListInputDefaultImplementation(apiResponseLocalVar, user); @@ -1277,18 +1301,25 @@ public async Task DeleteUserAsync(string username, Syste uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - DeleteUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + DeleteUserApiResponse apiResponseLocalVar = new DeleteUserApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); AfterDeleteUserDefaultImplementation(apiResponseLocalVar, username); @@ -1470,18 +1501,25 @@ public async Task GetUserByNameAsync(string username, if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetUserByNameApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + GetUserByNameApiResponse apiResponseLocalVar = new GetUserByNameApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); AfterGetUserByNameDefaultImplementation(apiResponseLocalVar, username); @@ -1542,7 +1580,12 @@ public Org.OpenAPITools.Model.User Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1550,7 +1593,11 @@ public Org.OpenAPITools.Model.User Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.User result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.User result) { result = null; @@ -1598,7 +1645,12 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() // This logic may be modified with the AsModel.mustache template return IsCustomHttpStatusCode599 ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1606,7 +1658,11 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() /// /// /// - public bool TryCustomHttpStatusCode599([NotNullWhen(true)]out Org.OpenAPITools.Model.User result) + public bool TryCustomHttpStatusCode599( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.User result) { result = null; @@ -1761,18 +1817,25 @@ public async Task LoginUserAsync(string password, string if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - LoginUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/login", requestedAtLocalVar, _jsonSerializerOptions); + LoginUserApiResponse apiResponseLocalVar = new LoginUserApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/login", requestedAtLocalVar, _jsonSerializerOptions); AfterLoginUserDefaultImplementation(apiResponseLocalVar, password, username); @@ -1860,7 +1923,12 @@ public string Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1868,7 +1936,11 @@ public string Ok() /// /// /// - public bool TryOk([NotNullWhen(true)]out string result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out string result) { result = null; @@ -1979,18 +2051,25 @@ public async Task LogoutUserAsync(System.Threading.Cance uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/logout"; httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - LogoutUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/logout", requestedAtLocalVar, _jsonSerializerOptions); + LogoutUserApiResponse apiResponseLocalVar = new LogoutUserApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/logout", requestedAtLocalVar, _jsonSerializerOptions); AfterLogoutUserDefaultImplementation(apiResponseLocalVar); @@ -2180,17 +2259,25 @@ public async Task UpdateUserAsync(User user, string user if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - UpdateUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + UpdateUserApiResponse apiResponseLocalVar = new UpdateUserApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); AfterUpdateUserDefaultImplementation(apiResponseLocalVar, user, username); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 794b3601c853..bd5767856501 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -165,7 +165,11 @@ public interface ICustomHttpStatusCode599 : IApiResponse /// /// /// - bool TryCustomHttpStatusCode599([NotNullWhen(true)]out TType result); + bool TryCustomHttpStatusCode599( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } /// @@ -185,7 +189,11 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk([NotNullWhen(true)]out TType result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } /// @@ -205,6 +213,10 @@ public interface IDefault : IApiResponse /// /// /// - bool TryDefault([NotNullWhen(true)]out TType result); + bool TryDefault( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } } diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs index b8e281efd8ba..19f42fedb458 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -91,7 +91,11 @@ public static string ApiKeyHeaderToString(ApiKeyHeader value) /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -113,7 +117,11 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -160,8 +168,10 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER if (obj is DateOnly dateOnly) return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs index cb0e43c85272..e4e9a61c397e 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -144,7 +144,7 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new ZeroBasedEnumJsonConverter()); _jsonOptions.Converters.Add(new ZeroBasedEnumNullableJsonConverter()); _jsonOptions.Converters.Add(new ZeroBasedEnumClassJsonConverter()); - JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new JsonSerializerOptionsProvider(_jsonOptions); _services.AddSingleton(jsonSerializerOptionsProvider); _services.AddSingleton(); _services.AddSingleton(); diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index 012e633f989c..cbcebbca1085 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -276,6 +276,7 @@ private string GetRSASignature(byte[] stringToSign) /// private string GetECDSASignature(byte[] dataToSign) { +#if NET6_0_OR_GREATER if (!File.Exists(KeyFilePath)) throw new Exception("key file path does not exist."); @@ -313,6 +314,10 @@ private string GetECDSASignature(byte[] dataToSign) var signedString = System.Convert.ToBase64String(derBytes); return signedString; +#endif +#if !NET6_0_OR_GREATER + throw new Exception("ECDSA signing is supported only on NETCOREAPP3_0 and above"); +#endif } private byte[] ConvertToECDSAANS1Format(byte[] signedBytes) diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index a34c828167b1..1f8d4f80602a 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -296,18 +296,25 @@ public async Task Call123TestSpecialTagsAsyn if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - Call123TestSpecialTagsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/another-fake/dummy", requestedAtLocalVar, _jsonSerializerOptions); + Call123TestSpecialTagsApiResponse apiResponseLocalVar = new Call123TestSpecialTagsApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/another-fake/dummy", requestedAtLocalVar, _jsonSerializerOptions); AfterCall123TestSpecialTagsDefaultImplementation(apiResponseLocalVar, modelClient); @@ -368,7 +375,12 @@ public Call123TestSpecialTagsApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -376,7 +388,11 @@ public Call123TestSpecialTagsApiResponse(ILogger /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient? result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/DefaultApi.cs index cced9ce3479a..4a1b787df36b 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -472,18 +472,25 @@ public async Task FooGetAsync(System.Threading.CancellationT if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FooGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/foo", requestedAtLocalVar, _jsonSerializerOptions); + FooGetApiResponse apiResponseLocalVar = new FooGetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/foo", requestedAtLocalVar, _jsonSerializerOptions); AfterFooGetDefaultImplementation(apiResponseLocalVar); @@ -544,7 +551,12 @@ public FooGetApiResponse(ILogger logger, System.Net.Http.Http // This logic may be modified with the AsModel.mustache template return IsDefault ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -552,7 +564,11 @@ public FooGetApiResponse(ILogger logger, System.Net.Http.Http /// /// /// - public bool TryDefault([NotNullWhen(true)]out Org.OpenAPITools.Model.FooGetDefaultResponse? result) + public bool TryDefault( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.FooGetDefaultResponse? result) { result = null; @@ -700,17 +716,25 @@ public async Task GetCountryAsync(string country, System if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetCountryApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/country", requestedAtLocalVar, _jsonSerializerOptions); + GetCountryApiResponse apiResponseLocalVar = new GetCountryApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/country", requestedAtLocalVar, _jsonSerializerOptions); AfterGetCountryDefaultImplementation(apiResponseLocalVar, country); @@ -861,18 +885,25 @@ public async Task HelloAsync(System.Threading.CancellationTok if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - HelloApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/hello", requestedAtLocalVar, _jsonSerializerOptions); + HelloApiResponse apiResponseLocalVar = new HelloApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/hello", requestedAtLocalVar, _jsonSerializerOptions); AfterHelloDefaultImplementation(apiResponseLocalVar); @@ -933,7 +964,12 @@ public HelloApiResponse(ILogger logger, System.Net.Http.HttpRe // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -941,7 +977,11 @@ public HelloApiResponse(ILogger logger, System.Net.Http.HttpRe /// /// /// - public bool TryOk([NotNullWhen(true)]out List? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List? result) { result = null; @@ -1055,18 +1095,25 @@ public async Task RolesReportGetAsync(System.Threadi if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - RolesReportGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/roles/report", requestedAtLocalVar, _jsonSerializerOptions); + RolesReportGetApiResponse apiResponseLocalVar = new RolesReportGetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/roles/report", requestedAtLocalVar, _jsonSerializerOptions); AfterRolesReportGetDefaultImplementation(apiResponseLocalVar); @@ -1127,7 +1174,12 @@ public RolesReportGetApiResponse(ILogger logger, Syst // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1135,7 +1187,11 @@ public RolesReportGetApiResponse(ILogger logger, Syst /// /// /// - public bool TryOk([NotNullWhen(true)]out List? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List? result) { result = null; @@ -1249,18 +1305,25 @@ public async Task TestAsync(System.Threading.CancellationToken if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/test", requestedAtLocalVar, _jsonSerializerOptions); + TestApiResponse apiResponseLocalVar = new TestApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/test", requestedAtLocalVar, _jsonSerializerOptions); AfterTestDefaultImplementation(apiResponseLocalVar); @@ -1321,7 +1384,12 @@ public TestApiResponse(ILogger logger, System.Net.Http.HttpRequ // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1329,7 +1397,11 @@ public TestApiResponse(ILogger logger, System.Net.Http.HttpRequ /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload? result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/FakeApi.cs index 39b422f6f7f7..c6aaaa3ae4fd 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1381,18 +1381,25 @@ public async Task FakeHealthGetAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FakeHealthGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/health", requestedAtLocalVar, _jsonSerializerOptions); + FakeHealthGetApiResponse apiResponseLocalVar = new FakeHealthGetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/health", requestedAtLocalVar, _jsonSerializerOptions); AfterFakeHealthGetDefaultImplementation(apiResponseLocalVar); @@ -1453,7 +1460,12 @@ public FakeHealthGetApiResponse(ILogger logger, System // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1461,7 +1473,11 @@ public FakeHealthGetApiResponse(ILogger logger, System /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.HealthCheckResult? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.HealthCheckResult? result) { result = null; @@ -1599,18 +1615,25 @@ public async Task FakeOuterBooleanSeriali if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FakeOuterBooleanSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/boolean", requestedAtLocalVar, _jsonSerializerOptions); + FakeOuterBooleanSerializeApiResponse apiResponseLocalVar = new FakeOuterBooleanSerializeApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/boolean", requestedAtLocalVar, _jsonSerializerOptions); AfterFakeOuterBooleanSerializeDefaultImplementation(apiResponseLocalVar, body); @@ -1671,7 +1694,12 @@ public FakeOuterBooleanSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1679,7 +1707,11 @@ public FakeOuterBooleanSerializeApiResponse(ILogger /// /// - public bool TryOk([NotNullWhen(true)]out bool? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out bool? result) { result = null; @@ -1830,18 +1862,25 @@ public async Task FakeOuterCompositeSer if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FakeOuterCompositeSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/composite", requestedAtLocalVar, _jsonSerializerOptions); + FakeOuterCompositeSerializeApiResponse apiResponseLocalVar = new FakeOuterCompositeSerializeApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/composite", requestedAtLocalVar, _jsonSerializerOptions); AfterFakeOuterCompositeSerializeDefaultImplementation(apiResponseLocalVar, outerComposite); @@ -1902,7 +1941,12 @@ public FakeOuterCompositeSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1910,7 +1954,11 @@ public FakeOuterCompositeSerializeApiResponse(ILogger /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.OuterComposite? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.OuterComposite? result) { result = null; @@ -2048,18 +2096,25 @@ public async Task FakeOuterNumberSerialize if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FakeOuterNumberSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/number", requestedAtLocalVar, _jsonSerializerOptions); + FakeOuterNumberSerializeApiResponse apiResponseLocalVar = new FakeOuterNumberSerializeApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/number", requestedAtLocalVar, _jsonSerializerOptions); AfterFakeOuterNumberSerializeDefaultImplementation(apiResponseLocalVar, body); @@ -2120,7 +2175,12 @@ public FakeOuterNumberSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2128,7 +2188,11 @@ public FakeOuterNumberSerializeApiResponse(ILogger /// /// - public bool TryOk([NotNullWhen(true)]out decimal? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out decimal? result) { result = null; @@ -2291,18 +2355,25 @@ public async Task FakeOuterStringSerialize if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FakeOuterStringSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/string", requestedAtLocalVar, _jsonSerializerOptions); + FakeOuterStringSerializeApiResponse apiResponseLocalVar = new FakeOuterStringSerializeApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/string", requestedAtLocalVar, _jsonSerializerOptions); AfterFakeOuterStringSerializeDefaultImplementation(apiResponseLocalVar, requiredStringUuid, body); @@ -2363,7 +2434,12 @@ public FakeOuterStringSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2371,7 +2447,11 @@ public FakeOuterStringSerializeApiResponse(ILogger /// /// - public bool TryOk([NotNullWhen(true)]out string? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out string? result) { result = null; @@ -2485,18 +2565,25 @@ public async Task GetArrayOfEnumsAsync(System.Threa if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetArrayOfEnumsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/array-of-enums", requestedAtLocalVar, _jsonSerializerOptions); + GetArrayOfEnumsApiResponse apiResponseLocalVar = new GetArrayOfEnumsApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/array-of-enums", requestedAtLocalVar, _jsonSerializerOptions); AfterGetArrayOfEnumsDefaultImplementation(apiResponseLocalVar); @@ -2557,7 +2644,12 @@ public GetArrayOfEnumsApiResponse(ILogger logger, Sy // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2565,7 +2657,11 @@ public GetArrayOfEnumsApiResponse(ILogger logger, Sy /// /// /// - public bool TryOk([NotNullWhen(true)]out List? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List? result) { result = null; @@ -2679,18 +2775,25 @@ public async Task GetMixedAnyOfAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetMixedAnyOfApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/anyOf", requestedAtLocalVar, _jsonSerializerOptions); + GetMixedAnyOfApiResponse apiResponseLocalVar = new GetMixedAnyOfApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/anyOf", requestedAtLocalVar, _jsonSerializerOptions); AfterGetMixedAnyOfDefaultImplementation(apiResponseLocalVar); @@ -2751,7 +2854,12 @@ public GetMixedAnyOfApiResponse(ILogger logger, System // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2759,7 +2867,11 @@ public GetMixedAnyOfApiResponse(ILogger logger, System /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.MixedAnyOf? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.MixedAnyOf? result) { result = null; @@ -2873,18 +2985,25 @@ public async Task GetMixedOneOfAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetMixedOneOfApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/oneOf", requestedAtLocalVar, _jsonSerializerOptions); + GetMixedOneOfApiResponse apiResponseLocalVar = new GetMixedOneOfApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/oneOf", requestedAtLocalVar, _jsonSerializerOptions); AfterGetMixedOneOfDefaultImplementation(apiResponseLocalVar); @@ -2945,7 +3064,12 @@ public GetMixedOneOfApiResponse(ILogger logger, System // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2953,7 +3077,11 @@ public GetMixedOneOfApiResponse(ILogger logger, System /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.MixedOneOf? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.MixedOneOf? result) { result = null; @@ -3095,17 +3223,25 @@ public async Task TestAdditionalP if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/additionalProperties-reference", requestedAtLocalVar, _jsonSerializerOptions); + TestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar = new TestAdditionalPropertiesReferenceApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/additionalProperties-reference", requestedAtLocalVar, _jsonSerializerOptions); AfterTestAdditionalPropertiesReferenceDefaultImplementation(apiResponseLocalVar, requestBody); @@ -3284,17 +3420,25 @@ public async Task TestBodyWithFileSchemaAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestBodyWithFileSchemaApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-file-schema", requestedAtLocalVar, _jsonSerializerOptions); + TestBodyWithFileSchemaApiResponse apiResponseLocalVar = new TestBodyWithFileSchemaApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-file-schema", requestedAtLocalVar, _jsonSerializerOptions); AfterTestBodyWithFileSchemaDefaultImplementation(apiResponseLocalVar, fileSchemaTestClass); @@ -3489,17 +3633,25 @@ public async Task TestBodyWithQueryParamsAs if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestBodyWithQueryParamsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-query-params", requestedAtLocalVar, _jsonSerializerOptions); + TestBodyWithQueryParamsApiResponse apiResponseLocalVar = new TestBodyWithQueryParamsApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-query-params", requestedAtLocalVar, _jsonSerializerOptions); AfterTestBodyWithQueryParamsDefaultImplementation(apiResponseLocalVar, query, user); @@ -3686,18 +3838,25 @@ public async Task TestClientModelAsync(ModelClient if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestClientModelApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + TestClientModelApiResponse apiResponseLocalVar = new TestClientModelApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); AfterTestClientModelDefaultImplementation(apiResponseLocalVar, modelClient); @@ -3758,7 +3917,12 @@ public TestClientModelApiResponse(ILogger logger, Sy // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -3766,7 +3930,11 @@ public TestClientModelApiResponse(ILogger logger, Sy /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient? result) { result = null; @@ -4055,17 +4223,25 @@ public async Task TestEndpointParametersAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestEndpointParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + TestEndpointParametersApiResponse apiResponseLocalVar = new TestEndpointParametersApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); AfterTestEndpointParametersDefaultImplementation(apiResponseLocalVar, number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); @@ -4346,17 +4522,25 @@ public async Task TestEnumParametersAsync(Option if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestEnumParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + TestEnumParametersApiResponse apiResponseLocalVar = new TestEnumParametersApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); AfterTestEnumParametersDefaultImplementation(apiResponseLocalVar, enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); @@ -4569,18 +4753,25 @@ public async Task TestGroupParametersAsync(bool tokenBaseLocalVars.Add(bearerTokenLocalVar1); bearerTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestGroupParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + TestGroupParametersApiResponse apiResponseLocalVar = new TestGroupParametersApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); AfterTestGroupParametersDefaultImplementation(apiResponseLocalVar, requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); @@ -4763,17 +4954,25 @@ public async Task TestInlineAddition if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestInlineAdditionalPropertiesApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); + TestInlineAdditionalPropertiesApiResponse apiResponseLocalVar = new TestInlineAdditionalPropertiesApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); AfterTestInlineAdditionalPropertiesDefaultImplementation(apiResponseLocalVar, requestBody); @@ -4952,17 +5151,25 @@ public async Task TestInline if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestInlineFreeformAdditionalPropertiesApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-freeform-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); + TestInlineFreeformAdditionalPropertiesApiResponse apiResponseLocalVar = new TestInlineFreeformAdditionalPropertiesApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-freeform-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); AfterTestInlineFreeformAdditionalPropertiesDefaultImplementation(apiResponseLocalVar, testInlineFreeformAdditionalPropertiesRequest); @@ -5159,17 +5366,25 @@ public async Task TestJsonFormDataAsync(string par if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestJsonFormDataApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/jsonFormData", requestedAtLocalVar, _jsonSerializerOptions); + TestJsonFormDataApiResponse apiResponseLocalVar = new TestJsonFormDataApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/jsonFormData", requestedAtLocalVar, _jsonSerializerOptions); AfterTestJsonFormDataDefaultImplementation(apiResponseLocalVar, param, param2); @@ -5424,18 +5639,25 @@ public async Task TestQueryParam uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestQueryParameterCollectionFormatApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/test-query-parameters", requestedAtLocalVar, _jsonSerializerOptions); + TestQueryParameterCollectionFormatApiResponse apiResponseLocalVar = new TestQueryParameterCollectionFormatApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/test-query-parameters", requestedAtLocalVar, _jsonSerializerOptions); AfterTestQueryParameterCollectionFormatDefaultImplementation(apiResponseLocalVar, context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); @@ -5614,17 +5836,25 @@ public async Task TestStringMapReferenceAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestStringMapReferenceApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/stringMap-reference", requestedAtLocalVar, _jsonSerializerOptions); + TestStringMapReferenceApiResponse apiResponseLocalVar = new TestStringMapReferenceApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/stringMap-reference", requestedAtLocalVar, _jsonSerializerOptions); AfterTestStringMapReferenceDefaultImplementation(apiResponseLocalVar, requestBody); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index d70af83c9115..f2255affdb6b 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -305,18 +305,25 @@ public async Task TestClassnameAsync(ModelClient mode if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - TestClassnameApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake_classname_test", requestedAtLocalVar, _jsonSerializerOptions); + TestClassnameApiResponse apiResponseLocalVar = new TestClassnameApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake_classname_test", requestedAtLocalVar, _jsonSerializerOptions); AfterTestClassnameDefaultImplementation(apiResponseLocalVar, modelClient); @@ -381,7 +388,12 @@ public TestClassnameApiResponse(ILogger logger, System // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -389,7 +401,11 @@ public TestClassnameApiResponse(ILogger logger, System /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient? result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs index 1d959b49106f..e25fe5ad13cd 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs @@ -795,7 +795,11 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -810,17 +814,25 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - AddPetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); + AddPetApiResponse apiResponseLocalVar = new AddPetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); AfterAddPetDefaultImplementation(apiResponseLocalVar, pet); @@ -1006,18 +1018,25 @@ public async Task DeletePetAsync(long petId, Option apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - DeletePetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + DeletePetApiResponse apiResponseLocalVar = new DeletePetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); AfterDeletePetDefaultImplementation(apiResponseLocalVar, petId, apiKey); @@ -1205,7 +1224,11 @@ public async Task FindPetsByStatusAsync(List FindPetsByStatusAsync(List apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FindPetsByStatusApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByStatus", requestedAtLocalVar, _jsonSerializerOptions); + FindPetsByStatusApiResponse apiResponseLocalVar = new FindPetsByStatusApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByStatus", requestedAtLocalVar, _jsonSerializerOptions); AfterFindPetsByStatusDefaultImplementation(apiResponseLocalVar, status); @@ -1295,7 +1325,12 @@ public FindPetsByStatusApiResponse(ILogger logger, // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1303,7 +1338,11 @@ public FindPetsByStatusApiResponse(ILogger logger, /// /// /// - public bool TryOk([NotNullWhen(true)]out List? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List? result) { result = null; @@ -1482,7 +1521,11 @@ public async Task FindPetsByTagsAsync(List t tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -1496,18 +1539,25 @@ public async Task FindPetsByTagsAsync(List t if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - FindPetsByTagsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByTags", requestedAtLocalVar, _jsonSerializerOptions); + FindPetsByTagsApiResponse apiResponseLocalVar = new FindPetsByTagsApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByTags", requestedAtLocalVar, _jsonSerializerOptions); AfterFindPetsByTagsDefaultImplementation(apiResponseLocalVar, tags); @@ -1572,7 +1622,12 @@ public FindPetsByTagsApiResponse(ILogger logger, Syst // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1580,7 +1635,11 @@ public FindPetsByTagsApiResponse(ILogger logger, Syst /// /// /// - public bool TryOk([NotNullWhen(true)]out List? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List? result) { result = null; @@ -1725,18 +1784,25 @@ public async Task GetPetByIdAsync(long petId, System.Thr if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetPetByIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + GetPetByIdApiResponse apiResponseLocalVar = new GetPetByIdApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); AfterGetPetByIdDefaultImplementation(apiResponseLocalVar, petId); @@ -1801,7 +1867,12 @@ public GetPetByIdApiResponse(ILogger logger, System.Net.H // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1809,7 +1880,11 @@ public GetPetByIdApiResponse(ILogger logger, System.Net.H /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Pet? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Pet? result) { result = null; @@ -1966,7 +2041,11 @@ public async Task UpdatePetAsync(Pet pet, System.Threadin tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -1981,17 +2060,25 @@ public async Task UpdatePetAsync(Pet pet, System.Threadin if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - UpdatePetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); + UpdatePetApiResponse apiResponseLocalVar = new UpdatePetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); AfterUpdatePetDefaultImplementation(apiResponseLocalVar, pet); @@ -2218,17 +2305,25 @@ public async Task UpdatePetWithFormAsync(long pet if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - UpdatePetWithFormApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + UpdatePetWithFormApiResponse apiResponseLocalVar = new UpdatePetWithFormApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); AfterUpdatePetWithFormDefaultImplementation(apiResponseLocalVar, petId, name, status); @@ -2451,18 +2546,25 @@ public async Task UploadFileAsync(long petId, Option apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - UploadFileApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}/uploadImage", requestedAtLocalVar, _jsonSerializerOptions); + UploadFileApiResponse apiResponseLocalVar = new UploadFileApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}/uploadImage", requestedAtLocalVar, _jsonSerializerOptions); AfterUploadFileDefaultImplementation(apiResponseLocalVar, petId, additionalMetadata, file); @@ -2527,7 +2629,12 @@ public UploadFileApiResponse(ILogger logger, System.Net.H // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2535,7 +2642,11 @@ public UploadFileApiResponse(ILogger logger, System.Net.H /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ApiResponse? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ApiResponse? result) { result = null; @@ -2717,18 +2828,25 @@ public async Task UploadFileWithRequired if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - UploadFileWithRequiredFileApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/{petId}/uploadImageWithRequiredFile", requestedAtLocalVar, _jsonSerializerOptions); + UploadFileWithRequiredFileApiResponse apiResponseLocalVar = new UploadFileWithRequiredFileApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/{petId}/uploadImageWithRequiredFile", requestedAtLocalVar, _jsonSerializerOptions); AfterUploadFileWithRequiredFileDefaultImplementation(apiResponseLocalVar, petId, requiredFile, additionalMetadata); @@ -2793,7 +2911,12 @@ public UploadFileWithRequiredFileApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2801,7 +2924,11 @@ public UploadFileWithRequiredFileApiResponse(ILogger /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ApiResponse? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ApiResponse? result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/StoreApi.cs index 1677ff9901e2..69bcd9ac1d7e 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/StoreApi.cs @@ -462,18 +462,25 @@ public async Task DeleteOrderAsync(string orderId, Syst uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Border_id%7D", Uri.EscapeDataString(orderId.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - DeleteOrderApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); + DeleteOrderApiResponse apiResponseLocalVar = new DeleteOrderApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); AfterDeleteOrderDefaultImplementation(apiResponseLocalVar, orderId); @@ -635,18 +642,25 @@ public async Task GetInventoryAsync(System.Threading.C if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetInventoryApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/inventory", requestedAtLocalVar, _jsonSerializerOptions); + GetInventoryApiResponse apiResponseLocalVar = new GetInventoryApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/inventory", requestedAtLocalVar, _jsonSerializerOptions); AfterGetInventoryDefaultImplementation(apiResponseLocalVar); @@ -711,7 +725,12 @@ public GetInventoryApiResponse(ILogger logger, System.N // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -719,7 +738,11 @@ public GetInventoryApiResponse(ILogger logger, System.N /// /// /// - public bool TryOk([NotNullWhen(true)]out Dictionary? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Dictionary? result) { result = null; @@ -845,18 +868,25 @@ public async Task GetOrderByIdAsync(long orderId, Syst if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetOrderByIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); + GetOrderByIdApiResponse apiResponseLocalVar = new GetOrderByIdApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); AfterGetOrderByIdDefaultImplementation(apiResponseLocalVar, orderId); @@ -917,7 +947,12 @@ public GetOrderByIdApiResponse(ILogger logger, System.N // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -925,7 +960,11 @@ public GetOrderByIdApiResponse(ILogger logger, System.N /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Order? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Order? result) { result = null; @@ -1088,18 +1127,25 @@ public async Task PlaceOrderAsync(Order order, System.Th if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - PlaceOrderApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order", requestedAtLocalVar, _jsonSerializerOptions); + PlaceOrderApiResponse apiResponseLocalVar = new PlaceOrderApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order", requestedAtLocalVar, _jsonSerializerOptions); AfterPlaceOrderDefaultImplementation(apiResponseLocalVar, order); @@ -1160,7 +1206,12 @@ public PlaceOrderApiResponse(ILogger logger, System.Net.H // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1168,7 +1219,11 @@ public PlaceOrderApiResponse(ILogger logger, System.Net.H /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Order? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Order? result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/UserApi.cs index 0352814ae67d..6e5832560558 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/UserApi.cs @@ -725,17 +725,25 @@ public async Task CreateUserAsync(User user, System.Thre if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - CreateUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user", requestedAtLocalVar, _jsonSerializerOptions); + CreateUserApiResponse apiResponseLocalVar = new CreateUserApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user", requestedAtLocalVar, _jsonSerializerOptions); AfterCreateUserDefaultImplementation(apiResponseLocalVar, user); @@ -914,17 +922,25 @@ public async Task CreateUsersWithArrayInp if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - CreateUsersWithArrayInputApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithArray", requestedAtLocalVar, _jsonSerializerOptions); + CreateUsersWithArrayInputApiResponse apiResponseLocalVar = new CreateUsersWithArrayInputApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithArray", requestedAtLocalVar, _jsonSerializerOptions); AfterCreateUsersWithArrayInputDefaultImplementation(apiResponseLocalVar, user); @@ -1103,17 +1119,25 @@ public async Task CreateUsersWithListInput if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - CreateUsersWithListInputApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithList", requestedAtLocalVar, _jsonSerializerOptions); + CreateUsersWithListInputApiResponse apiResponseLocalVar = new CreateUsersWithListInputApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithList", requestedAtLocalVar, _jsonSerializerOptions); AfterCreateUsersWithListInputDefaultImplementation(apiResponseLocalVar, user); @@ -1279,18 +1303,25 @@ public async Task DeleteUserAsync(string username, Syste uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - DeleteUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + DeleteUserApiResponse apiResponseLocalVar = new DeleteUserApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); AfterDeleteUserDefaultImplementation(apiResponseLocalVar, username); @@ -1472,18 +1503,25 @@ public async Task GetUserByNameAsync(string username, if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - GetUserByNameApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + GetUserByNameApiResponse apiResponseLocalVar = new GetUserByNameApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); AfterGetUserByNameDefaultImplementation(apiResponseLocalVar, username); @@ -1544,7 +1582,12 @@ public GetUserByNameApiResponse(ILogger logger, System // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1552,7 +1595,11 @@ public GetUserByNameApiResponse(ILogger logger, System /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.User? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.User? result) { result = null; @@ -1600,7 +1647,12 @@ public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.User? result) // This logic may be modified with the AsModel.mustache template return IsCustomHttpStatusCode599 ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1608,7 +1660,11 @@ public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.User? result) /// /// /// - public bool TryCustomHttpStatusCode599([NotNullWhen(true)]out Org.OpenAPITools.Model.User? result) + public bool TryCustomHttpStatusCode599( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.User? result) { result = null; @@ -1763,18 +1819,25 @@ public async Task LoginUserAsync(string password, string if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - LoginUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/login", requestedAtLocalVar, _jsonSerializerOptions); + LoginUserApiResponse apiResponseLocalVar = new LoginUserApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/login", requestedAtLocalVar, _jsonSerializerOptions); AfterLoginUserDefaultImplementation(apiResponseLocalVar, password, username); @@ -1862,7 +1925,12 @@ public LoginUserApiResponse(ILogger logger, System.Net.Htt // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1870,7 +1938,11 @@ public LoginUserApiResponse(ILogger logger, System.Net.Htt /// /// /// - public bool TryOk([NotNullWhen(true)]out string? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out string? result) { result = null; @@ -1981,18 +2053,25 @@ public async Task LogoutUserAsync(System.Threading.Cance uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/logout"; httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - LogoutUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/logout", requestedAtLocalVar, _jsonSerializerOptions); + LogoutUserApiResponse apiResponseLocalVar = new LogoutUserApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/logout", requestedAtLocalVar, _jsonSerializerOptions); AfterLogoutUserDefaultImplementation(apiResponseLocalVar); @@ -2182,17 +2261,25 @@ public async Task UpdateUserAsync(User user, string user if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - UpdateUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + UpdateUserApiResponse apiResponseLocalVar = new UpdateUserApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); AfterUpdateUserDefaultImplementation(apiResponseLocalVar, user, username); diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 88b4a497394b..2622f0d2692e 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -167,7 +167,11 @@ public interface ICustomHttpStatusCode599 : IApiResponse /// /// /// - bool TryCustomHttpStatusCode599([NotNullWhen(true)]out TType? result); + bool TryCustomHttpStatusCode599( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType? result); } /// @@ -187,7 +191,11 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk([NotNullWhen(true)]out TType? result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType? result); } /// @@ -207,6 +215,10 @@ public interface IDefault : IApiResponse /// /// /// - bool TryDefault([NotNullWhen(true)]out TType? result); + bool TryDefault( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType? result); } } diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs index ec53dbda4326..8897fec5bd0f 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -93,7 +93,15 @@ public static string ApiKeyHeaderToString(ApiKeyHeader value) /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T +#if NET6_0_OR_GREATER + ? +#endif + result) { try { @@ -115,7 +123,15 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T +#if NET6_0_OR_GREATER + ? +#endif + result) { try { @@ -162,8 +178,10 @@ public static string SanitizeFilename(string filename) // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER if (obj is DateOnly dateOnly) return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs index 03e2cd6ecb87..c91be723a333 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -146,7 +146,7 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new ZeroBasedEnumJsonConverter()); _jsonOptions.Converters.Add(new ZeroBasedEnumNullableJsonConverter()); _jsonOptions.Converters.Add(new ZeroBasedEnumClassJsonConverter()); - JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new JsonSerializerOptionsProvider(_jsonOptions); _services.AddSingleton(jsonSerializerOptionsProvider); _jsonOptions.TypeInfoResolver = System.Text.Json.Serialization.Metadata.JsonTypeInfoResolver.Combine( diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index 2d8c0b2a52f7..58b15a34c655 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -278,6 +278,7 @@ private string GetRSASignature(byte[] stringToSign) /// private string GetECDSASignature(byte[] dataToSign) { +#if NET6_0_OR_GREATER if (!File.Exists(KeyFilePath)) throw new Exception("key file path does not exist."); @@ -315,6 +316,10 @@ private string GetECDSASignature(byte[] dataToSign) var signedString = System.Convert.ToBase64String(derBytes); return signedString; +#endif +#if !NET6_0_OR_GREATER + throw new Exception("ECDSA signing is supported only on NETCOREAPP3_0 and above"); +#endif } private byte[] ConvertToECDSAANS1Format(byte[] signedBytes) diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs index 7782f09b34bf..3dfef38d490d 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -223,18 +223,25 @@ public async Task NowGetAsync(System.Threading.CancellationT if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); - +#if NET6_0_OR_GREATER httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else + httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - NowGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/now", requestedAtLocalVar, _jsonSerializerOptions); + NowGetApiResponse apiResponseLocalVar = new NowGetApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/now", requestedAtLocalVar, _jsonSerializerOptions); AfterNowGetDefaultImplementation(apiResponseLocalVar); @@ -295,7 +302,12 @@ public NowGetApiResponse(ILogger logger, System.Net.Http.Http // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : null; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -303,7 +315,11 @@ public NowGetApiResponse(ILogger logger, System.Net.Http.Http /// /// /// - public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.NowGet200Response? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.NowGet200Response? result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 0027952859de..db488eb60ec0 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -167,6 +167,10 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk([NotNullWhen(true)]out TType? result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType? result); } } diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs index 4cdf0f206124..88bcd1c8a44d 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -47,7 +47,15 @@ public static class ClientUtils /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T +#if NET6_0_OR_GREATER + ? +#endif + result) { try { @@ -69,7 +77,15 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T +#if NET6_0_OR_GREATER + ? +#endif + result) { try { @@ -116,8 +132,10 @@ public static string SanitizeFilename(string filename) // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER if (obj is DateOnly dateOnly) return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs index 90dd61c2c492..fc3406f68f96 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -42,7 +42,7 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new DateTimeJsonConverter()); _jsonOptions.Converters.Add(new DateTimeNullableJsonConverter()); _jsonOptions.Converters.Add(new NowGet200ResponseJsonConverter()); - JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new JsonSerializerOptionsProvider(_jsonOptions); _services.AddSingleton(jsonSerializerOptionsProvider); _services.AddSingleton(); _services.AddSingleton(); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 57b7fd8511df..74eade0879e4 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -293,13 +293,21 @@ public async Task Call123TestSpecialTagsAsyn if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -364,7 +372,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -372,7 +385,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs index e2f9ed3767b0..75326be2d3b8 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -469,13 +469,21 @@ public async Task FooGetAsync(System.Threading.CancellationT if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -540,7 +548,12 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() // This logic may be modified with the AsModel.mustache template return IsDefault ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -548,7 +561,11 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() /// /// /// - public bool TryDefault(out Org.OpenAPITools.Model.FooGetDefaultResponse result) + public bool TryDefault( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.FooGetDefaultResponse result) { result = null; @@ -696,13 +713,21 @@ public async Task GetCountryAsync(string country, System if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -857,13 +882,21 @@ public async Task HelloAsync(System.Threading.CancellationTok if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -928,7 +961,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -936,7 +974,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1050,13 +1092,21 @@ public async Task RolesReportGetAsync(System.Threadi if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1121,7 +1171,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1129,7 +1184,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1243,13 +1302,21 @@ public async Task TestAsync(System.Threading.CancellationToken if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1314,7 +1381,12 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1322,7 +1394,11 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs index 0df3dc21b8d7..3a10ef1a96f5 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1378,13 +1378,21 @@ public async Task FakeHealthGetAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1449,7 +1457,12 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1457,7 +1470,11 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.HealthCheckResult result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.HealthCheckResult result) { result = null; @@ -1595,13 +1612,21 @@ public async Task FakeOuterBooleanSeriali if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1666,7 +1691,12 @@ public FakeOuterBooleanSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1674,7 +1704,11 @@ public FakeOuterBooleanSerializeApiResponse(ILogger /// /// - public bool TryOk(out bool? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out bool? result) { result = null; @@ -1825,13 +1859,21 @@ public async Task FakeOuterCompositeSer if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1896,7 +1938,12 @@ public Org.OpenAPITools.Model.OuterComposite Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1904,7 +1951,11 @@ public Org.OpenAPITools.Model.OuterComposite Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.OuterComposite result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.OuterComposite result) { result = null; @@ -2042,13 +2093,21 @@ public async Task FakeOuterNumberSerialize if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2113,7 +2172,12 @@ public FakeOuterNumberSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2121,7 +2185,11 @@ public FakeOuterNumberSerializeApiResponse(ILogger /// /// - public bool TryOk(out decimal? result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out decimal? result) { result = null; @@ -2284,13 +2352,21 @@ public async Task FakeOuterStringSerialize if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2355,7 +2431,12 @@ public string Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2363,7 +2444,11 @@ public string Ok() /// /// /// - public bool TryOk(out string result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out string result) { result = null; @@ -2477,13 +2562,21 @@ public async Task GetArrayOfEnumsAsync(System.Threa if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2548,7 +2641,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2556,7 +2654,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -2670,13 +2772,21 @@ public async Task GetMixedAnyOfAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2741,7 +2851,12 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2749,7 +2864,11 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.MixedAnyOf result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.MixedAnyOf result) { result = null; @@ -2863,13 +2982,21 @@ public async Task GetMixedOneOfAsync(System.Threading if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2934,7 +3061,12 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2942,7 +3074,11 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.MixedOneOf result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.MixedOneOf result) { result = null; @@ -3084,13 +3220,21 @@ public async Task TestAdditionalP if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -3273,13 +3417,21 @@ public async Task TestBodyWithFileSchemaAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -3478,13 +3630,21 @@ public async Task TestBodyWithQueryParamsAs if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -3675,13 +3835,21 @@ public async Task TestClientModelAsync(ModelClient if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -3746,7 +3914,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -3754,7 +3927,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; @@ -4043,13 +4220,21 @@ public async Task TestEndpointParametersAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -4334,13 +4519,21 @@ public async Task TestEnumParametersAsync(Option if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -4557,13 +4750,21 @@ public async Task TestGroupParametersAsync(bool tokenBaseLocalVars.Add(bearerTokenLocalVar1); bearerTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -4750,13 +4951,21 @@ public async Task TestInlineAddition if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -4939,13 +5148,21 @@ public async Task TestInline if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -5146,13 +5363,21 @@ public async Task TestJsonFormDataAsync(string par if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -5411,13 +5636,21 @@ public async Task TestQueryParam uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -5600,13 +5833,21 @@ public async Task TestStringMapReferenceAsyn if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index 6417fde05b99..93e8c0ed7f87 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -302,13 +302,21 @@ public async Task TestClassnameAsync(ModelClient mode if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Patch; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PATCH"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -377,7 +385,12 @@ public Org.OpenAPITools.Model.ModelClient Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -385,7 +398,11 @@ public Org.OpenAPITools.Model.ModelClient Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ModelClient result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ModelClient result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index db54750a432f..c0069fe74993 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -792,7 +792,11 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -807,13 +811,21 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1003,13 +1015,21 @@ public async Task DeletePetAsync(long petId, Option apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1201,7 +1221,11 @@ public async Task FindPetsByStatusAsync(List FindPetsByStatusAsync(List apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1290,7 +1322,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1298,7 +1335,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1477,7 +1518,11 @@ public async Task FindPetsByTagsAsync(List t tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -1491,13 +1536,21 @@ public async Task FindPetsByTagsAsync(List t if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1566,7 +1619,12 @@ public List Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1574,7 +1632,11 @@ public List Ok() /// /// /// - public bool TryOk(out List result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out List result) { result = null; @@ -1719,13 +1781,21 @@ public async Task GetPetByIdAsync(long petId, System.Thr if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1794,7 +1864,12 @@ public Org.OpenAPITools.Model.Pet Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1802,7 +1877,11 @@ public Org.OpenAPITools.Model.Pet Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Pet result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Pet result) { result = null; @@ -1959,7 +2038,11 @@ public async Task UpdatePetAsync(Pet pet, System.Threadin tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); if (httpRequestMessageLocalVar.Content != null) { - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } @@ -1974,13 +2057,21 @@ public async Task UpdatePetAsync(Pet pet, System.Threadin if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2211,13 +2302,21 @@ public async Task UpdatePetWithFormAsync(long pet if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2444,13 +2543,21 @@ public async Task UploadFileAsync(long petId, Option apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2519,7 +2626,12 @@ public Org.OpenAPITools.Model.ApiResponse Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2527,7 +2639,11 @@ public Org.OpenAPITools.Model.ApiResponse Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ApiResponse result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ApiResponse result) { result = null; @@ -2709,13 +2825,21 @@ public async Task UploadFileWithRequired if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2784,7 +2908,12 @@ public Org.OpenAPITools.Model.ApiResponse Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -2792,7 +2921,11 @@ public Org.OpenAPITools.Model.ApiResponse Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.ApiResponse result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.ApiResponse result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs index 52a7f2d56123..d11d29e6b88d 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs @@ -459,13 +459,21 @@ public async Task DeleteOrderAsync(string orderId, Syst uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Border_id%7D", Uri.EscapeDataString(orderId.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -631,13 +639,21 @@ public async Task GetInventoryAsync(System.Threading.C if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -706,7 +722,12 @@ public Dictionary Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -714,7 +735,11 @@ public Dictionary Ok() /// /// /// - public bool TryOk(out Dictionary result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Dictionary result) { result = null; @@ -840,13 +865,21 @@ public async Task GetOrderByIdAsync(long orderId, Syst if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -911,7 +944,12 @@ public Org.OpenAPITools.Model.Order Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -919,7 +957,11 @@ public Org.OpenAPITools.Model.Order Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Order result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Order result) { result = null; @@ -1082,13 +1124,21 @@ public async Task PlaceOrderAsync(Order order, System.Th if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1153,7 +1203,12 @@ public Org.OpenAPITools.Model.Order Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1161,7 +1216,11 @@ public Org.OpenAPITools.Model.Order Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.Order result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.Order result) { result = null; diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/UserApi.cs index d29929bbd0fd..8460c13d69a1 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/UserApi.cs @@ -714,13 +714,21 @@ public async Task CreateUserAsync(User user, System.Thre if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -903,13 +911,21 @@ public async Task CreateUsersWithArrayInp if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1092,13 +1108,21 @@ public async Task CreateUsersWithListInput if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Post; +#else httpRequestMessageLocalVar.Method = new HttpMethod("POST"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1268,13 +1292,21 @@ public async Task DeleteUserAsync(string username, Syste uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Delete; +#else httpRequestMessageLocalVar.Method = new HttpMethod("DELETE"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1460,13 +1492,21 @@ public async Task GetUserByNameAsync(string username, if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1531,7 +1571,12 @@ public Org.OpenAPITools.Model.User Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1539,7 +1584,11 @@ public Org.OpenAPITools.Model.User Ok() /// /// /// - public bool TryOk(out Org.OpenAPITools.Model.User result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.User result) { result = null; @@ -1587,7 +1636,12 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() // This logic may be modified with the AsModel.mustache template return IsCustomHttpStatusCode599 ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1595,7 +1649,11 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() /// /// /// - public bool TryCustomHttpStatusCode599(out Org.OpenAPITools.Model.User result) + public bool TryCustomHttpStatusCode599( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out Org.OpenAPITools.Model.User result) { result = null; @@ -1750,13 +1808,21 @@ public async Task LoginUserAsync(string password, string if (acceptLocalVar != null) httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -1821,7 +1887,12 @@ public string Ok() // This logic may be modified with the AsModel.mustache template return IsOk ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) - : default; + : + #if NET6_0_OR_GREATER + null + #else + default + #endif; } /// @@ -1829,7 +1900,11 @@ public string Ok() /// /// /// - public bool TryOk(out string result) + public bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out string result) { result = null; @@ -1940,13 +2015,21 @@ public async Task LogoutUserAsync(System.Threading.Cance uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/logout"; httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Get; +#else httpRequestMessageLocalVar.Method = new HttpMethod("GET"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); @@ -2140,13 +2223,21 @@ public async Task UpdateUserAsync(User user, string user if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); +#if NET6_0_OR_GREATER + httpRequestMessageLocalVar.Method = HttpMethod.Put; +#else httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); +#endif DateTime requestedAtLocalVar = DateTime.UtcNow; using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) { - string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync( +#if NET6_0_OR_GREATER + cancellationToken +#endif + ).ConfigureAwait(false); ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiResponse`1.cs index 1a0d0a718382..3020604121b7 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiResponse`1.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -164,7 +164,11 @@ public interface ICustomHttpStatusCode599 : IApiResponse /// /// /// - bool TryCustomHttpStatusCode599(out TType result); + bool TryCustomHttpStatusCode599( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } /// @@ -184,7 +188,11 @@ public interface IOk : IApiResponse /// /// /// - bool TryOk(out TType result); + bool TryOk( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } /// @@ -204,6 +212,10 @@ public interface IDefault : IApiResponse /// /// /// - bool TryDefault(out TType result); + bool TryDefault( +#if NET6_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TType result); } } diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs index 231c516c999c..66f4eb2f50cf 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -94,7 +94,11 @@ public static string ApiKeyHeaderToString(ApiKeyHeader value) /// /// /// - public static bool TryDeserialize(string json, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(string json, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -116,7 +120,11 @@ public static bool TryDeserialize(string json, JsonSerializerOptions options, /// /// /// - public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, out T result) + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out T result) { try { @@ -163,6 +171,10 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString(format); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); +#endif if (obj is bool boolean) return boolean ? "true" diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index 5c4159491eec..cbcebbca1085 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -276,7 +276,48 @@ private string GetRSASignature(byte[] stringToSign) /// private string GetECDSASignature(byte[] dataToSign) { +#if NET6_0_OR_GREATER + if (!File.Exists(KeyFilePath)) + throw new Exception("key file path does not exist."); + + var ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----"; + var ecKeyFooter = "-----END EC PRIVATE KEY-----"; + var keyStr = File.ReadAllText(KeyFilePath); + var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim(); + var keyBytes = System.Convert.FromBase64String(ecKeyBase64String); + var ecdsa = ECDsa.Create(); + + var byteCount = 0; + if (KeyPassPhrase != null) + { + IntPtr unmanagedString = IntPtr.Zero; + try + { + // convert secure string to byte array + unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(KeyPassPhrase); + + string ptrToStringUni = Marshal.PtrToStringUni(unmanagedString) ?? throw new NullReferenceException(); + + ecdsa.ImportEncryptedPkcs8PrivateKey(Encoding.UTF8.GetBytes(ptrToStringUni), keyBytes, out byteCount); + } + finally + { + if (unmanagedString != IntPtr.Zero) + Marshal.ZeroFreeBSTR(unmanagedString); + } + } + else + ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount); + + var signedBytes = ecdsa.SignHash(dataToSign); + var derBytes = ConvertToECDSAANS1Format(signedBytes); + var signedString = System.Convert.ToBase64String(derBytes); + + return signedString; +#endif +#if !NET6_0_OR_GREATER throw new Exception("ECDSA signing is supported only on NETCOREAPP3_0 and above"); +#endif } private byte[] ConvertToECDSAANS1Format(byte[] signedBytes) diff --git a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs index 77cb3226ed07..9886721dd291 100644 --- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -116,6 +116,14 @@ public static string ParameterToString(object obj, IReadableConfiguration config // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15 + return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#endif if (obj is bool boolean) return boolean ? "true" : "false"; if (obj is ICollection collection) { diff --git a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index a419d35bed48..4ade38370fea 100644 --- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -352,7 +352,48 @@ private string GetRSASignature(byte[] stringToSign) /// ECDSA signature private string GetECDSASignature(byte[] dataToSign) { +#if NET6_0_OR_GREATER + if (!File.Exists(KeyFilePath) && string.IsNullOrEmpty(KeyString)) + { + throw new Exception("No API key has been provided."); + } + + var keyStr = KeyString; + const string ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----"; + const string ecKeyFooter = "-----END EC PRIVATE KEY-----"; + var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim(); + var keyBytes = System.Convert.FromBase64String(ecKeyBase64String); + var ecdsa = ECDsa.Create(); + + var byteCount = 0; + if (KeyPassPhrase != null) + { + IntPtr unmanagedString = IntPtr.Zero; + try + { + // convert secure string to byte array + unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(KeyPassPhrase); + ecdsa.ImportEncryptedPkcs8PrivateKey(Encoding.UTF8.GetBytes(Marshal.PtrToStringUni(unmanagedString)), keyBytes, out byteCount); + } + finally + { + if (unmanagedString != IntPtr.Zero) + { + Marshal.ZeroFreeBSTR(unmanagedString); + } + } + } + else + ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount); + + var derBytes = ecdsa.SignHash(dataToSign, DSASignatureFormat.Rfc3279DerSequence); + var signedString = System.Convert.ToBase64String(derBytes); + + return signedString; +#endif +#if !NET6_0_OR_GREATER throw new Exception("ECDSA signing is supported only on NETCOREAPP3_0 and above"); +#endif } /// diff --git a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs index 38ba17f24b23..2f97a82bfbbc 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs @@ -22,7 +22,9 @@ using System.Threading; using System.Text.RegularExpressions; using System.Threading.Tasks; +#if !NET6_0_OR_GREATER using System.Web; +#endif using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using RestSharp; diff --git a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ClientUtils.cs index ba5c33ca6779..d0283e8d7bdf 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -116,6 +116,14 @@ public static string ParameterToString(object obj, IReadableConfiguration config // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15 + return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#endif if (obj is bool boolean) return boolean ? "true" : "false"; if (obj is ICollection collection) { diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs index a0a43ea74aeb..4f7265545e1e 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -22,7 +22,9 @@ using System.Threading; using System.Text.RegularExpressions; using System.Threading.Tasks; +#if !NET6_0_OR_GREATER using System.Web; +#endif using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using RestSharp; diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs index 77cb3226ed07..9886721dd291 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -116,6 +116,14 @@ public static string ParameterToString(object obj, IReadableConfiguration config // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15 + return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#endif if (obj is bool boolean) return boolean ? "true" : "false"; if (obj is ICollection collection) { diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index a419d35bed48..4ade38370fea 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -352,7 +352,48 @@ private string GetRSASignature(byte[] stringToSign) /// ECDSA signature private string GetECDSASignature(byte[] dataToSign) { +#if NET6_0_OR_GREATER + if (!File.Exists(KeyFilePath) && string.IsNullOrEmpty(KeyString)) + { + throw new Exception("No API key has been provided."); + } + + var keyStr = KeyString; + const string ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----"; + const string ecKeyFooter = "-----END EC PRIVATE KEY-----"; + var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim(); + var keyBytes = System.Convert.FromBase64String(ecKeyBase64String); + var ecdsa = ECDsa.Create(); + + var byteCount = 0; + if (KeyPassPhrase != null) + { + IntPtr unmanagedString = IntPtr.Zero; + try + { + // convert secure string to byte array + unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(KeyPassPhrase); + ecdsa.ImportEncryptedPkcs8PrivateKey(Encoding.UTF8.GetBytes(Marshal.PtrToStringUni(unmanagedString)), keyBytes, out byteCount); + } + finally + { + if (unmanagedString != IntPtr.Zero) + { + Marshal.ZeroFreeBSTR(unmanagedString); + } + } + } + else + ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount); + + var derBytes = ecdsa.SignHash(dataToSign, DSASignatureFormat.Rfc3279DerSequence); + var signedString = System.Convert.ToBase64String(derBytes); + + return signedString; +#endif +#if !NET6_0_OR_GREATER throw new Exception("ECDSA signing is supported only on NETCOREAPP3_0 and above"); +#endif } /// diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs index a0a43ea74aeb..4f7265545e1e 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -22,7 +22,9 @@ using System.Threading; using System.Text.RegularExpressions; using System.Threading.Tasks; +#if !NET6_0_OR_GREATER using System.Web; +#endif using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using RestSharp; diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs index 77cb3226ed07..9886721dd291 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -116,6 +116,14 @@ public static string ParameterToString(object obj, IReadableConfiguration config // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15 + return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#endif if (obj is bool boolean) return boolean ? "true" : "false"; if (obj is ICollection collection) { diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index a419d35bed48..4ade38370fea 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -352,7 +352,48 @@ private string GetRSASignature(byte[] stringToSign) /// ECDSA signature private string GetECDSASignature(byte[] dataToSign) { +#if NET6_0_OR_GREATER + if (!File.Exists(KeyFilePath) && string.IsNullOrEmpty(KeyString)) + { + throw new Exception("No API key has been provided."); + } + + var keyStr = KeyString; + const string ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----"; + const string ecKeyFooter = "-----END EC PRIVATE KEY-----"; + var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim(); + var keyBytes = System.Convert.FromBase64String(ecKeyBase64String); + var ecdsa = ECDsa.Create(); + + var byteCount = 0; + if (KeyPassPhrase != null) + { + IntPtr unmanagedString = IntPtr.Zero; + try + { + // convert secure string to byte array + unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(KeyPassPhrase); + ecdsa.ImportEncryptedPkcs8PrivateKey(Encoding.UTF8.GetBytes(Marshal.PtrToStringUni(unmanagedString)), keyBytes, out byteCount); + } + finally + { + if (unmanagedString != IntPtr.Zero) + { + Marshal.ZeroFreeBSTR(unmanagedString); + } + } + } + else + ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount); + + var derBytes = ecdsa.SignHash(dataToSign, DSASignatureFormat.Rfc3279DerSequence); + var signedString = System.Convert.ToBase64String(derBytes); + + return signedString; +#endif +#if !NET6_0_OR_GREATER throw new Exception("ECDSA signing is supported only on NETCOREAPP3_0 and above"); +#endif } /// diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ApiClient.cs index 841ef8cadece..a415443d94fb 100644 --- a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ApiClient.cs @@ -22,6 +22,9 @@ using System.Threading; using System.Text.RegularExpressions; using System.Threading.Tasks; +#if !NET6_0_OR_GREATER +using System.Web; +#endif using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using RestSharp; diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ClientUtils.cs index 5ebe54e20468..b60b8fdabe91 100644 --- a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -100,12 +100,14 @@ public static string ParameterToString(object obj, IReadableConfiguration config // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#if NET6_0_OR_GREATER if (obj is DateOnly dateOnly) // Return a formatted date string - Can be customized with Configuration.DateTimeFormat // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15 return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#endif if (obj is bool boolean) return boolean ? "true" : "false"; if (obj is ICollection collection) { diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ApiClient.cs index 8431e531175d..4f7265545e1e 100644 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ApiClient.cs @@ -22,6 +22,9 @@ using System.Threading; using System.Text.RegularExpressions; using System.Threading.Tasks; +#if !NET6_0_OR_GREATER +using System.Web; +#endif using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using RestSharp; diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ClientUtils.cs index a3765e002293..2f7f3bab093a 100644 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -116,12 +116,14 @@ public static string ParameterToString(object obj, IReadableConfiguration config // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#if NET6_0_OR_GREATER if (obj is DateOnly dateOnly) // Return a formatted date string - Can be customized with Configuration.DateTimeFormat // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15 return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#endif if (obj is bool boolean) return boolean ? "true" : "false"; if (obj is ICollection collection) { diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index fcf584d1fd25..ce92aa28a500 100644 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -352,6 +352,7 @@ private string GetRSASignature(byte[] stringToSign) /// ECDSA signature private string GetECDSASignature(byte[] dataToSign) { +#if NET6_0_OR_GREATER if (!File.Exists(KeyFilePath) && string.IsNullOrEmpty(KeyString)) { throw new Exception("No API key has been provided."); @@ -389,6 +390,10 @@ private string GetECDSASignature(byte[] dataToSign) var signedString = System.Convert.ToBase64String(derBytes); return signedString; +#endif +#if !NET6_0_OR_GREATER + throw new Exception("ECDSA signing is supported only on NETCOREAPP3_0 and above"); +#endif } /// diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs index 8431e531175d..4f7265545e1e 100644 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -22,6 +22,9 @@ using System.Threading; using System.Text.RegularExpressions; using System.Threading.Tasks; +#if !NET6_0_OR_GREATER +using System.Web; +#endif using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using RestSharp; diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs index a3765e002293..2f7f3bab093a 100644 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -116,12 +116,14 @@ public static string ParameterToString(object obj, IReadableConfiguration config // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#if NET6_0_OR_GREATER if (obj is DateOnly dateOnly) // Return a formatted date string - Can be customized with Configuration.DateTimeFormat // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15 return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#endif if (obj is bool boolean) return boolean ? "true" : "false"; if (obj is ICollection collection) { diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index fcf584d1fd25..ce92aa28a500 100644 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -352,6 +352,7 @@ private string GetRSASignature(byte[] stringToSign) /// ECDSA signature private string GetECDSASignature(byte[] dataToSign) { +#if NET6_0_OR_GREATER if (!File.Exists(KeyFilePath) && string.IsNullOrEmpty(KeyString)) { throw new Exception("No API key has been provided."); @@ -389,6 +390,10 @@ private string GetECDSASignature(byte[] dataToSign) var signedString = System.Convert.ToBase64String(derBytes); return signedString; +#endif +#if !NET6_0_OR_GREATER + throw new Exception("ECDSA signing is supported only on NETCOREAPP3_0 and above"); +#endif } /// diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiClient.cs index bc3f8ca8e981..3e0e887cd4d4 100644 --- a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiClient.cs @@ -22,6 +22,9 @@ using System.Threading; using System.Text.RegularExpressions; using System.Threading.Tasks; +#if !NET6_0_OR_GREATER +using System.Web; +#endif using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using RestSharp; diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs index 02d02e362929..f9baf7d551a4 100644 --- a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -100,12 +100,14 @@ public static string ParameterToString(object obj, IReadableConfiguration config // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#if NET6_0_OR_GREATER if (obj is DateOnly dateOnly) // Return a formatted date string - Can be customized with Configuration.DateTimeFormat // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15 return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#endif if (obj is bool boolean) return boolean ? "true" : "false"; if (obj is ICollection collection) { diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/ApiClient.cs index a0a43ea74aeb..4f7265545e1e 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/ApiClient.cs @@ -22,7 +22,9 @@ using System.Threading; using System.Text.RegularExpressions; using System.Threading.Tasks; +#if !NET6_0_OR_GREATER using System.Web; +#endif using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using RestSharp; diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/ClientUtils.cs index 77cb3226ed07..9886721dd291 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -116,6 +116,14 @@ public static string ParameterToString(object obj, IReadableConfiguration config // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15 + return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#endif if (obj is bool boolean) return boolean ? "true" : "false"; if (obj is ICollection collection) { diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index a419d35bed48..4ade38370fea 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -352,7 +352,48 @@ private string GetRSASignature(byte[] stringToSign) /// ECDSA signature private string GetECDSASignature(byte[] dataToSign) { +#if NET6_0_OR_GREATER + if (!File.Exists(KeyFilePath) && string.IsNullOrEmpty(KeyString)) + { + throw new Exception("No API key has been provided."); + } + + var keyStr = KeyString; + const string ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----"; + const string ecKeyFooter = "-----END EC PRIVATE KEY-----"; + var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim(); + var keyBytes = System.Convert.FromBase64String(ecKeyBase64String); + var ecdsa = ECDsa.Create(); + + var byteCount = 0; + if (KeyPassPhrase != null) + { + IntPtr unmanagedString = IntPtr.Zero; + try + { + // convert secure string to byte array + unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(KeyPassPhrase); + ecdsa.ImportEncryptedPkcs8PrivateKey(Encoding.UTF8.GetBytes(Marshal.PtrToStringUni(unmanagedString)), keyBytes, out byteCount); + } + finally + { + if (unmanagedString != IntPtr.Zero) + { + Marshal.ZeroFreeBSTR(unmanagedString); + } + } + } + else + ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount); + + var derBytes = ecdsa.SignHash(dataToSign, DSASignatureFormat.Rfc3279DerSequence); + var signedString = System.Convert.ToBase64String(derBytes); + + return signedString; +#endif +#if !NET6_0_OR_GREATER throw new Exception("ECDSA signing is supported only on NETCOREAPP3_0 and above"); +#endif } /// diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs index a0a43ea74aeb..4f7265545e1e 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -22,7 +22,9 @@ using System.Threading; using System.Text.RegularExpressions; using System.Threading.Tasks; +#if !NET6_0_OR_GREATER using System.Web; +#endif using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using RestSharp; diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs index 77cb3226ed07..9886721dd291 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -116,6 +116,14 @@ public static string ParameterToString(object obj, IReadableConfiguration config // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15 + return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#endif if (obj is bool boolean) return boolean ? "true" : "false"; if (obj is ICollection collection) { diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index a419d35bed48..4ade38370fea 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -352,7 +352,48 @@ private string GetRSASignature(byte[] stringToSign) /// ECDSA signature private string GetECDSASignature(byte[] dataToSign) { +#if NET6_0_OR_GREATER + if (!File.Exists(KeyFilePath) && string.IsNullOrEmpty(KeyString)) + { + throw new Exception("No API key has been provided."); + } + + var keyStr = KeyString; + const string ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----"; + const string ecKeyFooter = "-----END EC PRIVATE KEY-----"; + var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim(); + var keyBytes = System.Convert.FromBase64String(ecKeyBase64String); + var ecdsa = ECDsa.Create(); + + var byteCount = 0; + if (KeyPassPhrase != null) + { + IntPtr unmanagedString = IntPtr.Zero; + try + { + // convert secure string to byte array + unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(KeyPassPhrase); + ecdsa.ImportEncryptedPkcs8PrivateKey(Encoding.UTF8.GetBytes(Marshal.PtrToStringUni(unmanagedString)), keyBytes, out byteCount); + } + finally + { + if (unmanagedString != IntPtr.Zero) + { + Marshal.ZeroFreeBSTR(unmanagedString); + } + } + } + else + ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount); + + var derBytes = ecdsa.SignHash(dataToSign, DSASignatureFormat.Rfc3279DerSequence); + var signedString = System.Convert.ToBase64String(derBytes); + + return signedString; +#endif +#if !NET6_0_OR_GREATER throw new Exception("ECDSA signing is supported only on NETCOREAPP3_0 and above"); +#endif } /// diff --git a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs index 12fe4347fc80..20ea961cc15c 100644 --- a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -100,6 +100,14 @@ public static string ParameterToString(object obj, IReadableConfiguration config // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 // For example: 2009-06-15T13:45:30.0000000 return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#if NET6_0_OR_GREATER + if (obj is DateOnly dateOnly) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15 + return dateOnly.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat); +#endif if (obj is bool boolean) return boolean ? "true" : "false"; if (obj is ICollection collection) { diff --git a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index a419d35bed48..4ade38370fea 100644 --- a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -352,7 +352,48 @@ private string GetRSASignature(byte[] stringToSign) /// ECDSA signature private string GetECDSASignature(byte[] dataToSign) { +#if NET6_0_OR_GREATER + if (!File.Exists(KeyFilePath) && string.IsNullOrEmpty(KeyString)) + { + throw new Exception("No API key has been provided."); + } + + var keyStr = KeyString; + const string ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----"; + const string ecKeyFooter = "-----END EC PRIVATE KEY-----"; + var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim(); + var keyBytes = System.Convert.FromBase64String(ecKeyBase64String); + var ecdsa = ECDsa.Create(); + + var byteCount = 0; + if (KeyPassPhrase != null) + { + IntPtr unmanagedString = IntPtr.Zero; + try + { + // convert secure string to byte array + unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(KeyPassPhrase); + ecdsa.ImportEncryptedPkcs8PrivateKey(Encoding.UTF8.GetBytes(Marshal.PtrToStringUni(unmanagedString)), keyBytes, out byteCount); + } + finally + { + if (unmanagedString != IntPtr.Zero) + { + Marshal.ZeroFreeBSTR(unmanagedString); + } + } + } + else + ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount); + + var derBytes = ecdsa.SignHash(dataToSign, DSASignatureFormat.Rfc3279DerSequence); + var signedString = System.Convert.ToBase64String(derBytes); + + return signedString; +#endif +#if !NET6_0_OR_GREATER throw new Exception("ECDSA signing is supported only on NETCOREAPP3_0 and above"); +#endif } /// From 94c4bf7ce9148e6c5183076b8d2fc7935e1a28cf Mon Sep 17 00:00:00 2001 From: Bryan Aldrich Date: Mon, 9 Dec 2024 17:40:25 -0500 Subject: [PATCH 3/4] fixed misplaced semicolon on the conditional directive. updated netcore projects to be truly multi target capable. updated project nuget references to be latest(ish) versions that still supported the relevant targets. Added a couple references to remove security related warnings. updated the multiple frameworks sample in .net47 to include net8.0 uppdated test project for httpclient/standard2.0/Petstore. It was woefully out of date. Project does contain handwritten tests. --- ...p-restsharp-net4.7-multipleFrameworks.yaml | 2 +- .../Project.csproj.mustache.bak | 36 -- .../csharp-functions/function.mustache.bak | 33 - .../libraries/generichost/AsModel.mustache | 6 +- .../csharp/libraries/generichost/api.mustache | 2 +- .../resources/csharp/netcore_project.mustache | 53 +- .../csharp/netcore_testproject.mustache | 6 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 26 +- .../Org.OpenAPITools.Test.csproj | 6 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 25 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../src/Org.OpenAPITools/Api/APIKeys0Api.cs | 2 +- .../src/Org.OpenAPITools/Api/ApiKeys1Api.cs | 2 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 6 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 6 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 6 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 6 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 24 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 54 +- .../Api/FakeClassnameTags123Api.cs | 6 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 30 +- .../src/Org.OpenAPITools/Api/StoreApi.cs | 18 +- .../src/Org.OpenAPITools/Api/UserApi.cs | 18 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 6 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 6 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 24 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 54 +- .../Api/FakeClassnameTags123Api.cs | 6 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 30 +- .../src/Org.OpenAPITools/Api/StoreApi.cs | 18 +- .../src/Org.OpenAPITools/Api/UserApi.cs | 18 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 6 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 6 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 6 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 6 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 6 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 24 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 54 +- .../Api/FakeClassnameTags123Api.cs | 6 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 30 +- .../src/Org.OpenAPITools/Api/StoreApi.cs | 18 +- .../src/Org.OpenAPITools/Api/UserApi.cs | 18 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 6 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 6 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 24 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 54 +- .../Api/FakeClassnameTags123Api.cs | 6 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 30 +- .../src/Org.OpenAPITools/Api/StoreApi.cs | 18 +- .../src/Org.OpenAPITools/Api/UserApi.cs | 18 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 6 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 6 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 6 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 6 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 6 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 24 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 54 +- .../Api/FakeClassnameTags123Api.cs | 6 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 30 +- .../src/Org.OpenAPITools/Api/StoreApi.cs | 18 +- .../src/Org.OpenAPITools/Api/UserApi.cs | 18 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 6 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 24 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 54 +- .../Api/FakeClassnameTags123Api.cs | 6 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 30 +- .../src/Org.OpenAPITools/Api/StoreApi.cs | 18 +- .../src/Org.OpenAPITools/Api/UserApi.cs | 18 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 6 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 6 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 24 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 54 +- .../Api/FakeClassnameTags123Api.cs | 6 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 30 +- .../src/Org.OpenAPITools/Api/StoreApi.cs | 18 +- .../src/Org.OpenAPITools/Api/UserApi.cs | 18 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 6 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 24 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 54 +- .../Api/FakeClassnameTags123Api.cs | 6 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 30 +- .../src/Org.OpenAPITools/Api/StoreApi.cs | 18 +- .../src/Org.OpenAPITools/Api/UserApi.cs | 18 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 6 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 30 +- .../Org.OpenAPITools.Test.csproj | 6 +- .../Org.OpenAPITools/Api/AnotherFakeApi.cs | 6 +- .../src/Org.OpenAPITools/Api/DefaultApi.cs | 24 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 54 +- .../Api/FakeClassnameTags123Api.cs | 6 +- .../src/Org.OpenAPITools/Api/PetApi.cs | 30 +- .../src/Org.OpenAPITools/Api/StoreApi.cs | 18 +- .../src/Org.OpenAPITools/Api/UserApi.cs | 18 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 29 +- .../Api/PetApiTestsV2.cs | 579 ------------------ .../Org.OpenAPITools.Test.csproj | 16 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 22 +- .../Org.OpenAPITools.Test.csproj | 8 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 27 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 25 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 27 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 26 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 26 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 26 +- .../Org.OpenAPITools.Test.csproj | 4 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 26 +- .../Org.OpenAPITools.Test.csproj | 6 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 25 +- .../Org.OpenAPITools.Test.csproj | 6 +- .../Org.OpenAPITools/Org.OpenAPITools.csproj | 25 +- 161 files changed, 1747 insertions(+), 1691 deletions(-) delete mode 100644 modules/openapi-generator/src/main/resources/csharp-functions/Project.csproj.mustache.bak delete mode 100644 modules/openapi-generator/src/main/resources/csharp-functions/function.mustache.bak delete mode 100644 samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools.Test/Api/PetApiTestsV2.cs diff --git a/bin/configs/csharp-restsharp-net4.7-multipleFrameworks.yaml b/bin/configs/csharp-restsharp-net4.7-multipleFrameworks.yaml index bdd64742026c..0b7b6bad3f3f 100644 --- a/bin/configs/csharp-restsharp-net4.7-multipleFrameworks.yaml +++ b/bin/configs/csharp-restsharp-net4.7-multipleFrameworks.yaml @@ -4,6 +4,6 @@ inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml templateDir: modules/openapi-generator/src/main/resources/csharp additionalProperties: packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' - targetFramework: netstandard2.1;net47 + targetFramework: netstandard2.1;net47;net8.0 useCompareNetObjects: "true" equatable: true diff --git a/modules/openapi-generator/src/main/resources/csharp-functions/Project.csproj.mustache.bak b/modules/openapi-generator/src/main/resources/csharp-functions/Project.csproj.mustache.bak deleted file mode 100644 index ab4ad28ede66..000000000000 --- a/modules/openapi-generator/src/main/resources/csharp-functions/Project.csproj.mustache.bak +++ /dev/null @@ -1,36 +0,0 @@ - - - {{packageDescription}}{{^packageDescription}}{{packageName}}{{/packageDescription}} - {{packageCopyright}} - {{packageAuthors}} - {{targetFramework}} - true - true - {{packageVersion}} - {{azureFunctionsVersion}} -{{#nullableReferenceTypes}} - annotations -{{/nullableReferenceTypes}} -{{#isLibrary}} - Library -{{/isLibrary}} - {{packageName}} - {{packageName}} - {{userSecretsGuid}} - Linux - ..\.. - - - - - - - - PreserveNewest - - - PreserveNewest - Never - - - diff --git a/modules/openapi-generator/src/main/resources/csharp-functions/function.mustache.bak b/modules/openapi-generator/src/main/resources/csharp-functions/function.mustache.bak deleted file mode 100644 index 397ba84eb774..000000000000 --- a/modules/openapi-generator/src/main/resources/csharp-functions/function.mustache.bak +++ /dev/null @@ -1,33 +0,0 @@ -using System.IO; -using System.Net; -using System.Threading.Tasks; -using System.ComponentModel.DataAnnotations; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Azure.WebJobs; -using Microsoft.Azure.WebJobs.Extensions.Http; -using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Attributes; -using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Enums; -using Microsoft.Extensions.Logging; -using Microsoft.OpenApi.Models; -using Newtonsoft.Json; - -namespace {{apiPackage}} -{ {{#operations}} - public partial {{#classModifier}}{{classModifier}} {{/classModifier}}class {{classname}} - { {{#operation}} - [FunctionName("{{classname}}_{{operationId}}")] - public async Task _{{operationId}}([HttpTrigger(AuthorizationLevel.Anonymous, "{{httpMethod}}", Route = "{{{path}}}")]HttpRequest req, ExecutionContext context{{#allParams}}{{#isPathParam}}, {{>pathParam}}{{/isPathParam}}{{/allParams}}){{^generateBody}};{{/generateBody}} - {{#generateBody}} - { - var method = this.GetType().GetMethod("{{operationId}}"); - - return method != null - ? (await ((Task)method.Invoke(this, new object[] { req, context{{#allParams}}{{#isPathParam}}, {{>paramName}}{{/isPathParam}}{{/allParams}} })).ConfigureAwait(false)) - : new StatusCodeResult((int)HttpStatusCode.NotImplemented); - } - {{/generateBody}} - {{/operation}} - } -{{/operations}} -} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/AsModel.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/AsModel.mustache index dd7ce036f3ff..69a673e0c7c3 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/AsModel.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/AsModel.mustache @@ -3,7 +3,7 @@ return Is{{vendorExtensions.x-http-status}} ? System.Text.Json.JsonSerializer.Deserialize<{{#isModel}}{{^containerType}}{{packageName}}.{{modelPackage}}.{{/containerType}}{{/isModel}}{{{dataType}}}>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default -#endif; + default; +#endif diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api.mustache index 25abe72ca737..1e5f688a90bf 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api.mustache @@ -629,7 +629,7 @@ namespace {{packageName}}.{{apiPackage}} ILogger<{{#vendorExtensions.x-duplicates}}{{.}}.{{/vendorExtensions.x-duplicates}}{{operationId}}ApiResponse> apiResponseLoggerLocalVar = LoggerFactory.CreateLogger<{{#vendorExtensions.x-duplicates}}{{.}}.{{/vendorExtensions.x-duplicates}}{{operationId}}ApiResponse>(); - {{#vendorExtensions.x-duplicates}}{{.}}.{{/vendorExtensions.x-duplicates}}{{operationId}}ApiResponse apiResponseLocalVar = new {{operationId}}ApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "{{{path}}}", requestedAtLocalVar, _jsonSerializerOptions); + {{#vendorExtensions.x-duplicates}}{{.}}.{{/vendorExtensions.x-duplicates}}{{operationId}}ApiResponse apiResponseLocalVar = new {{#vendorExtensions.x-duplicates}}{{.}}.{{/vendorExtensions.x-duplicates}}{{operationId}}ApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "{{{path}}}", requestedAtLocalVar, _jsonSerializerOptions); After{{operationId}}DefaultImplementation({{#lambda.joinWithComma}}apiResponseLocalVar {{#allParams}}{{paramName}} {{/allParams}}{{/lambda.joinWithComma}}); diff --git a/modules/openapi-generator/src/main/resources/csharp/netcore_project.mustache b/modules/openapi-generator/src/main/resources/csharp/netcore_project.mustache index 5769512aa877..1f3c37c0b4d7 100644 --- a/modules/openapi-generator/src/main/resources/csharp/netcore_project.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/netcore_project.mustache @@ -1,5 +1,4 @@ - {{#useGenericHost}} true {{/useGenericHost}}{{^useGenericHost}} false{{/useGenericHost}} @@ -24,6 +23,16 @@ false + + + true + + + true + + + + {{#useCompareNetObjects}} @@ -33,52 +42,42 @@ {{/useGenericHost}} {{#useRestSharp}} - + + {{/useRestSharp}} {{#useGenericHost}} - - + + + {{#supportsRetry}} - + {{/supportsRetry}} {{#net80OrLater}} {{/net80OrLater}} {{^net60OrLater}} - {{#net47OrLater}} - - {{/net47OrLater}} {{/net60OrLater}} {{/useGenericHost}} {{^useGenericHost}} {{#supportsRetry}} - + {{/supportsRetry}} {{/useGenericHost}} - {{#validatable}} - {{^net60OrLater}} + +{{#validatable}} + - {{/net60OrLater}} - {{/validatable}} +{{/validatable}} -{{^useGenericHost}} - - {{^net60OrLater}} + - {{/net60OrLater}} - {{#net48}} - - {{/net48}} + + - {{^net60OrLater}} - - {{/net60OrLater}} - {{#net48}} - - {{/net48}} + + -{{/useGenericHost}} {{>netcore_project.additions}} diff --git a/modules/openapi-generator/src/main/resources/csharp/netcore_testproject.mustache b/modules/openapi-generator/src/main/resources/csharp/netcore_testproject.mustache index eb8bd548d1e0..4b108acaa81e 100644 --- a/modules/openapi-generator/src/main/resources/csharp/netcore_testproject.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/netcore_testproject.mustache @@ -9,9 +9,9 @@ - - - + + + diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index a381e6a2f3cf..3bc135471dba 100644 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Org.OpenAPITools.csproj index a5a6bf6200b9..4a5f5a0cc9c3 100644 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - false net6.0 @@ -21,15 +20,34 @@ false + + + true + + + true + + + + - - + + + - + + + + + + + + + diff --git a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 66dc542c5c2c..8fd7adbef647 100644 --- a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,9 +8,9 @@ - - - + + + diff --git a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 05f8f0bf135f..ef7e07f7ec0d 100644 --- a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - false netstandard2.0 @@ -20,19 +19,35 @@ false + + + true + + + true + + + + - - + + + + + - + + + - + + diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 05ce7e5830d8..67a08dd23ebd 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs index 460d35e8eada..a94e240b04b0 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/APIKeys0Api.cs @@ -240,7 +240,7 @@ public async Task GetApiKeysIdAsync(int id, System.Thr ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - APIKEYSApi.GetApiKeysIdApiResponse apiResponseLocalVar = new GetApiKeysIdApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions); + APIKEYSApi.GetApiKeysIdApiResponse apiResponseLocalVar = new APIKEYSApi.GetApiKeysIdApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions); AfterGetApiKeysIdDefaultImplementation(apiResponseLocalVar, id); diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs index aea1a62eff64..ffe4572e649e 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Api/ApiKeys1Api.cs @@ -240,7 +240,7 @@ public async Task GetApiKeysIdAsync(int id, System.Thr ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); - APIKEYSApi.GetApiKeysIdApiResponse apiResponseLocalVar = new GetApiKeysIdApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions); + APIKEYSApi.GetApiKeysIdApiResponse apiResponseLocalVar = new APIKEYSApi.GetApiKeysIdApiResponse(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/api_keys/{id}", requestedAtLocalVar, _jsonSerializerOptions); AfterGetApiKeysIdDefaultImplementation(apiResponseLocalVar, id); diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 9f99b6957b6d..a17cb4f5dad5 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net8.0 @@ -21,11 +20,34 @@ false + + + true + + + true + + + + - - - + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 6e2e462b8a72..ef4192ba81be 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs index c1d9901db861..41c6c080c5cb 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -328,10 +328,10 @@ public Org.OpenAPITools.Model.Person Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index c6529e054024..3fb29411d2be 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net47 @@ -20,14 +19,35 @@ false + + + true + + + true + + + + - - - + + + + - + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 6e2e462b8a72..ef4192ba81be 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs index 74252a406259..7f4f27d1b912 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -302,10 +302,10 @@ public Org.OpenAPITools.Model.Fruit Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index c6529e054024..3fb29411d2be 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net47 @@ -20,14 +19,35 @@ false + + + true + + + true + + + + - - - + + + + - + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 6e2e462b8a72..ef4192ba81be 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs index 74252a406259..7f4f27d1b912 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -302,10 +302,10 @@ public Org.OpenAPITools.Model.Fruit Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 201640a24d33..caadbe462ab4 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net47 @@ -20,13 +19,34 @@ false + + + true + + + true + + + + - - - + + + + - + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 6e2e462b8a72..ef4192ba81be 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 490d20d1a61a..85bc1aac5dab 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -375,10 +375,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs index db3d9888945c..6277311b345b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -551,10 +551,10 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -964,10 +964,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1174,10 +1174,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1384,10 +1384,10 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs index 144226daaa88..4a95c19fae8f 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1460,10 +1460,10 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1694,10 +1694,10 @@ public FakeOuterBooleanSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1941,10 +1941,10 @@ public Org.OpenAPITools.Model.OuterComposite Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2175,10 +2175,10 @@ public FakeOuterNumberSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2434,10 +2434,10 @@ public string Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2644,10 +2644,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2854,10 +2854,10 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -3064,10 +3064,10 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -3917,10 +3917,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index 99add155ed62..846351642739 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -388,10 +388,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/PetApi.cs index a414c4420ddd..6c0676ac7785 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/PetApi.cs @@ -1325,10 +1325,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1622,10 +1622,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1867,10 +1867,10 @@ public Org.OpenAPITools.Model.Pet Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2629,10 +2629,10 @@ public Org.OpenAPITools.Model.ApiResponse Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2911,10 +2911,10 @@ public Org.OpenAPITools.Model.ApiResponse Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs index d96b8f3f429f..19048fd0b3dd 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs @@ -725,10 +725,10 @@ public Dictionary Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -947,10 +947,10 @@ public Org.OpenAPITools.Model.Order Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1206,10 +1206,10 @@ public Org.OpenAPITools.Model.Order Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/UserApi.cs index 30d4f2f1aad1..bb6d746bb65b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/UserApi.cs @@ -1574,10 +1574,10 @@ public Org.OpenAPITools.Model.User Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1639,10 +1639,10 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1890,10 +1890,10 @@ public string Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj index c6529e054024..3fb29411d2be 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net47 @@ -20,14 +19,35 @@ false + + + true + + + true + + + + - - - + + + + - + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 6e2e462b8a72..ef4192ba81be 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs index 74252a406259..7f4f27d1b912 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -302,10 +302,10 @@ public Org.OpenAPITools.Model.Fruit Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index c6529e054024..3fb29411d2be 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net47 @@ -20,14 +19,35 @@ false + + + true + + + true + + + + - - - + + + + - + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 6e2e462b8a72..ef4192ba81be 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 490d20d1a61a..85bc1aac5dab 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -375,10 +375,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs index db3d9888945c..6277311b345b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -551,10 +551,10 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -964,10 +964,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1174,10 +1174,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1384,10 +1384,10 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs index 882649ce655c..ca72c476a8bc 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1460,10 +1460,10 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1694,10 +1694,10 @@ public FakeOuterBooleanSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1941,10 +1941,10 @@ public Org.OpenAPITools.Model.OuterComposite Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2175,10 +2175,10 @@ public FakeOuterNumberSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2434,10 +2434,10 @@ public string Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2644,10 +2644,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2854,10 +2854,10 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -3064,10 +3064,10 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -3917,10 +3917,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index 99add155ed62..846351642739 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -388,10 +388,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index 0f1ebce15075..9cbf2bbd0852 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -1325,10 +1325,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1622,10 +1622,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1867,10 +1867,10 @@ public Org.OpenAPITools.Model.Pet Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2629,10 +2629,10 @@ public Org.OpenAPITools.Model.ApiResponse Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2911,10 +2911,10 @@ public Org.OpenAPITools.Model.ApiResponse Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs index d96b8f3f429f..19048fd0b3dd 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs @@ -725,10 +725,10 @@ public Dictionary Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -947,10 +947,10 @@ public Org.OpenAPITools.Model.Order Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1206,10 +1206,10 @@ public Org.OpenAPITools.Model.Order Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/UserApi.cs index 30d4f2f1aad1..bb6d746bb65b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/UserApi.cs @@ -1574,10 +1574,10 @@ public Org.OpenAPITools.Model.User Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1639,10 +1639,10 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1890,10 +1890,10 @@ public string Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj index c6529e054024..3fb29411d2be 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net47 @@ -20,14 +19,35 @@ false + + + true + + + true + + + + - - - + + + + - + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 6e2e462b8a72..ef4192ba81be 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs index 395d3f77aeea..d82feadf56b2 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -302,10 +302,10 @@ public Org.OpenAPITools.Model.NowGet200Response Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 201640a24d33..caadbe462ab4 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net47 @@ -20,13 +19,34 @@ false + + + true + + + true + + + + - - - + + + + - + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index a136411ab795..69917ecc99b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs index c1d9901db861..41c6c080c5cb 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -328,10 +328,10 @@ public Org.OpenAPITools.Model.Person Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 73a85280057e..121628b7fea1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net48 @@ -20,14 +19,35 @@ false + + + true + + + true + + + + - - - + + + + - + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index a136411ab795..69917ecc99b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs index 74252a406259..7f4f27d1b912 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -302,10 +302,10 @@ public Org.OpenAPITools.Model.Fruit Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 73a85280057e..121628b7fea1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net48 @@ -20,14 +19,35 @@ false + + + true + + + true + + + + - - - + + + + - + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index a136411ab795..69917ecc99b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs index 74252a406259..7f4f27d1b912 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -302,10 +302,10 @@ public Org.OpenAPITools.Model.Fruit Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 82bb1c228e8a..4a62f8f05df7 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net48 @@ -20,13 +19,34 @@ false + + + true + + + true + + + + - - - + + + + - + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index a136411ab795..69917ecc99b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 490d20d1a61a..85bc1aac5dab 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -375,10 +375,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs index db3d9888945c..6277311b345b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -551,10 +551,10 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -964,10 +964,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1174,10 +1174,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1384,10 +1384,10 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs index 144226daaa88..4a95c19fae8f 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1460,10 +1460,10 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1694,10 +1694,10 @@ public FakeOuterBooleanSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1941,10 +1941,10 @@ public Org.OpenAPITools.Model.OuterComposite Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2175,10 +2175,10 @@ public FakeOuterNumberSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2434,10 +2434,10 @@ public string Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2644,10 +2644,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2854,10 +2854,10 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -3064,10 +3064,10 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -3917,10 +3917,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index 99add155ed62..846351642739 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -388,10 +388,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs index a414c4420ddd..6c0676ac7785 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs @@ -1325,10 +1325,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1622,10 +1622,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1867,10 +1867,10 @@ public Org.OpenAPITools.Model.Pet Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2629,10 +2629,10 @@ public Org.OpenAPITools.Model.ApiResponse Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2911,10 +2911,10 @@ public Org.OpenAPITools.Model.ApiResponse Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs index d96b8f3f429f..19048fd0b3dd 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs @@ -725,10 +725,10 @@ public Dictionary Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -947,10 +947,10 @@ public Org.OpenAPITools.Model.Order Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1206,10 +1206,10 @@ public Org.OpenAPITools.Model.Order Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/UserApi.cs index 30d4f2f1aad1..bb6d746bb65b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/UserApi.cs @@ -1574,10 +1574,10 @@ public Org.OpenAPITools.Model.User Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1639,10 +1639,10 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1890,10 +1890,10 @@ public string Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 73a85280057e..121628b7fea1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net48 @@ -20,14 +19,35 @@ false + + + true + + + true + + + + - - - + + + + - + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index a136411ab795..69917ecc99b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs index 74252a406259..7f4f27d1b912 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -302,10 +302,10 @@ public Org.OpenAPITools.Model.Fruit Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 73a85280057e..121628b7fea1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net48 @@ -20,14 +19,35 @@ false + + + true + + + true + + + + - - - + + + + - + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index a136411ab795..69917ecc99b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 490d20d1a61a..85bc1aac5dab 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -375,10 +375,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs index db3d9888945c..6277311b345b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -551,10 +551,10 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -964,10 +964,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1174,10 +1174,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1384,10 +1384,10 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs index 882649ce655c..ca72c476a8bc 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1460,10 +1460,10 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1694,10 +1694,10 @@ public FakeOuterBooleanSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1941,10 +1941,10 @@ public Org.OpenAPITools.Model.OuterComposite Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2175,10 +2175,10 @@ public FakeOuterNumberSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2434,10 +2434,10 @@ public string Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2644,10 +2644,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2854,10 +2854,10 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -3064,10 +3064,10 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -3917,10 +3917,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index 99add155ed62..846351642739 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -388,10 +388,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index 0f1ebce15075..9cbf2bbd0852 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -1325,10 +1325,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1622,10 +1622,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1867,10 +1867,10 @@ public Org.OpenAPITools.Model.Pet Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2629,10 +2629,10 @@ public Org.OpenAPITools.Model.ApiResponse Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2911,10 +2911,10 @@ public Org.OpenAPITools.Model.ApiResponse Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs index d96b8f3f429f..19048fd0b3dd 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs @@ -725,10 +725,10 @@ public Dictionary Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -947,10 +947,10 @@ public Org.OpenAPITools.Model.Order Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1206,10 +1206,10 @@ public Org.OpenAPITools.Model.Order Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs index 30d4f2f1aad1..bb6d746bb65b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs @@ -1574,10 +1574,10 @@ public Org.OpenAPITools.Model.User Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1639,10 +1639,10 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1890,10 +1890,10 @@ public string Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 73a85280057e..121628b7fea1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net48 @@ -20,14 +19,35 @@ false + + + true + + + true + + + + - - - + + + + - + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index a136411ab795..69917ecc99b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs index 395d3f77aeea..d82feadf56b2 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -302,10 +302,10 @@ public Org.OpenAPITools.Model.NowGet200Response Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 82bb1c228e8a..4a62f8f05df7 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net48 @@ -20,13 +19,34 @@ false + + + true + + + true + + + + - - - + + + + - + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 05ce7e5830d8..67a08dd23ebd 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs index d9cc03e76599..b248b10c8880 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -330,10 +330,10 @@ public ListApiResponse(ILogger logger, System.Net.Http.HttpRequ ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index fad95b68dbdd..10796985a422 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net8.0 @@ -21,12 +20,35 @@ false + + + true + + + true + + + + - - - + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 05ce7e5830d8..67a08dd23ebd 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs index b69e537e6efe..dfb8a05d372a 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -304,10 +304,10 @@ public RootGetApiResponse(ILogger logger, System.Net.Http.Ht ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index fad95b68dbdd..10796985a422 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net8.0 @@ -21,12 +20,35 @@ false + + + true + + + true + + + + - - - + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 05ce7e5830d8..67a08dd23ebd 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs index b69e537e6efe..dfb8a05d372a 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -304,10 +304,10 @@ public RootGetApiResponse(ILogger logger, System.Net.Http.Ht ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 9f99b6957b6d..a17cb4f5dad5 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net8.0 @@ -21,11 +20,34 @@ false + + + true + + + true + + + + - - - + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index d8ddfad1b40c..de068c66902a 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 490d20d1a61a..85bc1aac5dab 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -375,10 +375,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs index db3d9888945c..6277311b345b 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -551,10 +551,10 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -964,10 +964,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1174,10 +1174,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1384,10 +1384,10 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs index 2b9131d1f2fd..9582a1226518 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1460,10 +1460,10 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1694,10 +1694,10 @@ public FakeOuterBooleanSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1941,10 +1941,10 @@ public Org.OpenAPITools.Model.OuterComposite Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2175,10 +2175,10 @@ public FakeOuterNumberSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2434,10 +2434,10 @@ public string Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2644,10 +2644,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2854,10 +2854,10 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -3064,10 +3064,10 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -3917,10 +3917,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index 99add155ed62..846351642739 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -388,10 +388,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs index a414c4420ddd..6c0676ac7785 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs @@ -1325,10 +1325,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1622,10 +1622,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1867,10 +1867,10 @@ public Org.OpenAPITools.Model.Pet Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2629,10 +2629,10 @@ public Org.OpenAPITools.Model.ApiResponse Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2911,10 +2911,10 @@ public Org.OpenAPITools.Model.ApiResponse Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs index d96b8f3f429f..19048fd0b3dd 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs @@ -725,10 +725,10 @@ public Dictionary Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -947,10 +947,10 @@ public Org.OpenAPITools.Model.Order Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1206,10 +1206,10 @@ public Org.OpenAPITools.Model.Order Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/UserApi.cs index 66c54a994961..653b8c4ab695 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/UserApi.cs @@ -1582,10 +1582,10 @@ public Org.OpenAPITools.Model.User Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1647,10 +1647,10 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1925,10 +1925,10 @@ public string Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj index d3c06f120ffe..0ca474f3c8b8 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net8.0 @@ -20,12 +19,35 @@ false + + + true + + + true + + + + - - - + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 05ce7e5830d8..67a08dd23ebd 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 1f8d4f80602a..344df099abea 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -377,10 +377,10 @@ public Call123TestSpecialTagsApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/DefaultApi.cs index 4a1b787df36b..f784c625cf5e 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -553,10 +553,10 @@ public FooGetApiResponse(ILogger logger, System.Net.Http.Http ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -966,10 +966,10 @@ public HelloApiResponse(ILogger logger, System.Net.Http.HttpRe ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1176,10 +1176,10 @@ public RolesReportGetApiResponse(ILogger logger, Syst ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1386,10 +1386,10 @@ public TestApiResponse(ILogger logger, System.Net.Http.HttpRequ ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeApi.cs index c6aaaa3ae4fd..2d74ac5c61e1 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1462,10 +1462,10 @@ public FakeHealthGetApiResponse(ILogger logger, System ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1696,10 +1696,10 @@ public FakeOuterBooleanSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1943,10 +1943,10 @@ public FakeOuterCompositeSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2177,10 +2177,10 @@ public FakeOuterNumberSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2436,10 +2436,10 @@ public FakeOuterStringSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2646,10 +2646,10 @@ public GetArrayOfEnumsApiResponse(ILogger logger, Sy ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2856,10 +2856,10 @@ public GetMixedAnyOfApiResponse(ILogger logger, System ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -3066,10 +3066,10 @@ public GetMixedOneOfApiResponse(ILogger logger, System ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -3919,10 +3919,10 @@ public TestClientModelApiResponse(ILogger logger, Sy ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index f2255affdb6b..37b635f88f8c 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -390,10 +390,10 @@ public TestClassnameApiResponse(ILogger logger, System ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs index e25fe5ad13cd..b98fc2ac0d07 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs @@ -1327,10 +1327,10 @@ public FindPetsByStatusApiResponse(ILogger logger, ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1624,10 +1624,10 @@ public FindPetsByTagsApiResponse(ILogger logger, Syst ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1869,10 +1869,10 @@ public GetPetByIdApiResponse(ILogger logger, System.Net.H ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2631,10 +2631,10 @@ public UploadFileApiResponse(ILogger logger, System.Net.H ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2913,10 +2913,10 @@ public UploadFileWithRequiredFileApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/StoreApi.cs index 69bcd9ac1d7e..8dcec67c5ad7 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/StoreApi.cs @@ -727,10 +727,10 @@ public GetInventoryApiResponse(ILogger logger, System.N ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -949,10 +949,10 @@ public GetOrderByIdApiResponse(ILogger logger, System.N ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1208,10 +1208,10 @@ public PlaceOrderApiResponse(ILogger logger, System.Net.H ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/UserApi.cs index 6e5832560558..32d1fd54846a 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/UserApi.cs @@ -1584,10 +1584,10 @@ public GetUserByNameApiResponse(ILogger logger, System ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1649,10 +1649,10 @@ public bool TryOk( ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1927,10 +1927,10 @@ public LoginUserApiResponse(ILogger logger, System.Net.Htt ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Org.OpenAPITools.csproj index fad95b68dbdd..10796985a422 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net8.0 @@ -21,12 +20,35 @@ false + + + true + + + true + + + + - - - + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 05ce7e5830d8..67a08dd23ebd 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs index b69e537e6efe..dfb8a05d372a 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -304,10 +304,10 @@ public RootGetApiResponse(ILogger logger, System.Net.Http.Ht ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index fad95b68dbdd..10796985a422 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net8.0 @@ -21,12 +20,35 @@ false + + + true + + + true + + + + - - - + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index d8ddfad1b40c..de068c66902a 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 490d20d1a61a..85bc1aac5dab 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -375,10 +375,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs index db3d9888945c..6277311b345b 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -551,10 +551,10 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -964,10 +964,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1174,10 +1174,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1384,10 +1384,10 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs index c83451d5c3ab..7ac78906185b 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1460,10 +1460,10 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1694,10 +1694,10 @@ public FakeOuterBooleanSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1941,10 +1941,10 @@ public Org.OpenAPITools.Model.OuterComposite Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2175,10 +2175,10 @@ public FakeOuterNumberSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2434,10 +2434,10 @@ public string Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2644,10 +2644,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2854,10 +2854,10 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -3064,10 +3064,10 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -3917,10 +3917,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index 99add155ed62..846351642739 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -388,10 +388,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index 0f1ebce15075..9cbf2bbd0852 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -1325,10 +1325,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1622,10 +1622,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1867,10 +1867,10 @@ public Org.OpenAPITools.Model.Pet Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2629,10 +2629,10 @@ public Org.OpenAPITools.Model.ApiResponse Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2911,10 +2911,10 @@ public Org.OpenAPITools.Model.ApiResponse Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs index d96b8f3f429f..19048fd0b3dd 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs @@ -725,10 +725,10 @@ public Dictionary Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -947,10 +947,10 @@ public Org.OpenAPITools.Model.Order Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1206,10 +1206,10 @@ public Org.OpenAPITools.Model.Order Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs index 66c54a994961..653b8c4ab695 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs @@ -1582,10 +1582,10 @@ public Org.OpenAPITools.Model.User Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1647,10 +1647,10 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1925,10 +1925,10 @@ public string Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj index d3c06f120ffe..0ca474f3c8b8 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net8.0 @@ -20,12 +19,35 @@ false + + + true + + + true + + + + - - - + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 05ce7e5830d8..67a08dd23ebd 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 1f8d4f80602a..344df099abea 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -377,10 +377,10 @@ public Call123TestSpecialTagsApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/DefaultApi.cs index 4a1b787df36b..f784c625cf5e 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -553,10 +553,10 @@ public FooGetApiResponse(ILogger logger, System.Net.Http.Http ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -966,10 +966,10 @@ public HelloApiResponse(ILogger logger, System.Net.Http.HttpRe ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1176,10 +1176,10 @@ public RolesReportGetApiResponse(ILogger logger, Syst ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1386,10 +1386,10 @@ public TestApiResponse(ILogger logger, System.Net.Http.HttpRequ ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/FakeApi.cs index c6aaaa3ae4fd..2d74ac5c61e1 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1462,10 +1462,10 @@ public FakeHealthGetApiResponse(ILogger logger, System ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1696,10 +1696,10 @@ public FakeOuterBooleanSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1943,10 +1943,10 @@ public FakeOuterCompositeSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2177,10 +2177,10 @@ public FakeOuterNumberSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2436,10 +2436,10 @@ public FakeOuterStringSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2646,10 +2646,10 @@ public GetArrayOfEnumsApiResponse(ILogger logger, Sy ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2856,10 +2856,10 @@ public GetMixedAnyOfApiResponse(ILogger logger, System ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -3066,10 +3066,10 @@ public GetMixedOneOfApiResponse(ILogger logger, System ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -3919,10 +3919,10 @@ public TestClientModelApiResponse(ILogger logger, Sy ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index f2255affdb6b..37b635f88f8c 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -390,10 +390,10 @@ public TestClassnameApiResponse(ILogger logger, System ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs index e25fe5ad13cd..b98fc2ac0d07 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs @@ -1327,10 +1327,10 @@ public FindPetsByStatusApiResponse(ILogger logger, ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1624,10 +1624,10 @@ public FindPetsByTagsApiResponse(ILogger logger, Syst ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1869,10 +1869,10 @@ public GetPetByIdApiResponse(ILogger logger, System.Net.H ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2631,10 +2631,10 @@ public UploadFileApiResponse(ILogger logger, System.Net.H ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2913,10 +2913,10 @@ public UploadFileWithRequiredFileApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/StoreApi.cs index 69bcd9ac1d7e..8dcec67c5ad7 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/StoreApi.cs @@ -727,10 +727,10 @@ public GetInventoryApiResponse(ILogger logger, System.N ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -949,10 +949,10 @@ public GetOrderByIdApiResponse(ILogger logger, System.N ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1208,10 +1208,10 @@ public PlaceOrderApiResponse(ILogger logger, System.Net.H ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/UserApi.cs index 6e5832560558..32d1fd54846a 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/UserApi.cs @@ -1584,10 +1584,10 @@ public GetUserByNameApiResponse(ILogger logger, System ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1649,10 +1649,10 @@ public bool TryOk( ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1927,10 +1927,10 @@ public LoginUserApiResponse(ILogger logger, System.Net.Htt ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Org.OpenAPITools.csproj index fad95b68dbdd..10796985a422 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net8.0 @@ -21,12 +20,35 @@ false + + + true + + + true + + + + - - - + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 05ce7e5830d8..67a08dd23ebd 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs index 3dfef38d490d..113b7c700d74 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -304,10 +304,10 @@ public NowGetApiResponse(ILogger logger, System.Net.Http.Http ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 9f99b6957b6d..a17cb4f5dad5 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true net8.0 @@ -21,11 +20,34 @@ false + + + true + + + true + + + + - - - + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 66dc542c5c2c..8fd7adbef647 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,9 +8,9 @@ - - - + + + diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 74eade0879e4..c75d3016b1e9 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -374,10 +374,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs index 75326be2d3b8..6a98a89f0675 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -550,10 +550,10 @@ public Org.OpenAPITools.Model.FooGetDefaultResponse Default() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -963,10 +963,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1173,10 +1173,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1383,10 +1383,10 @@ public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs index 3a10ef1a96f5..3d95b5541258 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1459,10 +1459,10 @@ public Org.OpenAPITools.Model.HealthCheckResult Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1693,10 +1693,10 @@ public FakeOuterBooleanSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1940,10 +1940,10 @@ public Org.OpenAPITools.Model.OuterComposite Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2174,10 +2174,10 @@ public FakeOuterNumberSerializeApiResponse(ILogger(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2433,10 +2433,10 @@ public string Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2643,10 +2643,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2853,10 +2853,10 @@ public Org.OpenAPITools.Model.MixedAnyOf Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -3063,10 +3063,10 @@ public Org.OpenAPITools.Model.MixedOneOf Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -3916,10 +3916,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index 93e8c0ed7f87..a7549c5566ff 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -387,10 +387,10 @@ public Org.OpenAPITools.Model.ModelClient Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index c0069fe74993..ea6f8d04b3c3 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -1324,10 +1324,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1621,10 +1621,10 @@ public List Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1866,10 +1866,10 @@ public Org.OpenAPITools.Model.Pet Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2628,10 +2628,10 @@ public Org.OpenAPITools.Model.ApiResponse Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -2910,10 +2910,10 @@ public Org.OpenAPITools.Model.ApiResponse Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs index d11d29e6b88d..7b631f5de8c5 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs @@ -724,10 +724,10 @@ public Dictionary Ok() ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -946,10 +946,10 @@ public Org.OpenAPITools.Model.Order Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1205,10 +1205,10 @@ public Org.OpenAPITools.Model.Order Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/UserApi.cs index 8460c13d69a1..7557b165bdb3 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/UserApi.cs @@ -1573,10 +1573,10 @@ public Org.OpenAPITools.Model.User Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1638,10 +1638,10 @@ public Org.OpenAPITools.Model.User CustomHttpStatusCode599() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// @@ -1889,10 +1889,10 @@ public string Ok() ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) : #if NET6_0_OR_GREATER - null + null; #else - default - #endif; + default; + #endif } /// diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj index f50496337d10..fcff276ad299 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - true netstandard2.0 @@ -20,13 +19,35 @@ false + + + true + + + true + + + + - - - + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools.Test/Api/PetApiTestsV2.cs b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools.Test/Api/PetApiTestsV2.cs deleted file mode 100644 index 0a7945d386bc..000000000000 --- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools.Test/Api/PetApiTestsV2.cs +++ /dev/null @@ -1,579 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * OpenAPI spec version: 1.0.0 - * - * Generated by: https://github.com/openapitools/openapi-generator.git - */ -using Org.OpenAPITools.Api; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Model; -using System; -using System.Collections.Generic; -using System.IO; -using System.Net.Http; -using System.Reflection; -using System.Threading.Tasks; -using Xunit; - -namespace Org.OpenAPITools.Test.Api -{ - /// - /// Class for testing PetApi - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the API endpoint. - /// - public class PetApiTestsV2 : IDisposable - { - // CONFIGURE TESTING PARAMETERS HERE - // see the Integration Test Wiki for details: https://github.com/OpenAPITools/openapi-generator/wiki/Integration-Tests - private const string BasePath = "http://petstore.swagger.io/v2"; - private const long PetId = 100000; - private const long NotExistentId = 100001; - - private readonly HttpClient _httpClient = new HttpClient(); - private readonly PetApi _petApi; - - public PetApiTestsV2() - { - // prepare the client - _petApi = new PetApi(_httpClient, new Configuration - { - BasePath = BasePath, - Timeout = TimeSpan.FromSeconds(10), - UserAgent = "TEST_USER_AGENT" - }); - - // add a sample pet for the expected PetId - _petApi.AddPet(BuildSamplePet()); - - // ensure there is not a pet for that ID - try - { - _petApi.DeletePet(NotExistentId); - } - catch (ApiException ex) when (ex.ErrorCode == 404) { } - } - - #region Get - - /// - /// Test GetPetById with an existent Id - /// - [Fact] - public void GetPetById_GivenExistentId_ReturnsPet() - { - Pet expected = BuildSamplePet(); - - Pet response = _petApi.GetPetById(PetId); - - Assert.IsType(response); - Assert.Equal(expected.Name, response.Name); - Assert.Equal(expected.Status, response.Status); - Assert.IsType>(response.Tags); - Assert.Equal(expected.Tags[0].Id, response.Tags[0].Id); - Assert.Equal(expected.Tags[0].Name, response.Tags[0].Name); - Assert.IsType>(response.PhotoUrls); - Assert.Equal(expected.PhotoUrls[0], response.PhotoUrls[0]); - Assert.IsType(response.Category); - Assert.Equal(expected.Category.Id, response.Category.Id); - Assert.Equal(expected.Category.Name, response.Category.Name); - } - - /// - /// Test GetPetById with a not existent Id - /// - [Fact] - public void GetPetById_GivenNotExistentId_ThrowsApiException() - { - var exception = Assert.Throws(() => - { - _petApi.GetPetById(NotExistentId); - }); - - Assert.IsType(exception); - Assert.Equal(404, exception.ErrorCode); - Assert.Equal("{\"code\":1,\"type\":\"error\",\"message\":\"Pet not found\"}", exception.ErrorContent); - Assert.Equal("Error calling GetPetById: {\"code\":1,\"type\":\"error\",\"message\":\"Pet not found\"}", exception.Message); - } - - /// - /// Test GetPetByIdWithHttpInfo with an existent Id - /// - [Fact] - public void GetPetByIdWithHttpInfo_GivenExistentId_Returns200Response() - { - Pet expected = BuildSamplePet(); - - ApiResponse response = _petApi.GetPetByIdWithHttpInfo(PetId); - Pet result = response.Data; - - Assert.IsType>(response); - Assert.Equal(200, (int)response.StatusCode); - Assert.True(response.Headers.ContainsKey("Content-Type")); - Assert.Equal("application/json", response.Headers["Content-Type"][0]); - - Assert.Equal(expected.Name, result.Name); - Assert.Equal(expected.Status, result.Status); - Assert.IsType>(result.Tags); - Assert.Equal(expected.Tags[0].Id, result.Tags[0].Id); - Assert.Equal(expected.Tags[0].Name, result.Tags[0].Name); - Assert.IsType>(result.PhotoUrls); - Assert.Equal(expected.PhotoUrls[0], result.PhotoUrls[0]); - Assert.IsType(result.Category); - Assert.Equal(expected.Category.Id, result.Category.Id); - Assert.Equal(expected.Category.Name, result.Category.Name); - } - - /// - /// Test GetPetByIdWithHttpInfo with a not existent Id and the ExceptionFactory disabled - /// - [Fact] - public void GetPetByIdWithHttpInfo_GivenNotExistentId_ThrowsApiException() - { - var exception = Assert.Throws(() => - { - _petApi.GetPetByIdWithHttpInfo(NotExistentId); - }); - - Assert.IsType(exception); - Assert.Equal(404, exception.ErrorCode); - Assert.Equal("{\"code\":1,\"type\":\"error\",\"message\":\"Pet not found\"}", exception.ErrorContent); - Assert.Equal("Error calling GetPetById: {\"code\":1,\"type\":\"error\",\"message\":\"Pet not found\"}", exception.Message); - } - - /// - /// Test GetPetByIdWithHttpInfo with a not existent Id and the ExceptionFactory disabled - /// - [Fact] - public void GetPetByIdWithHttpInfo_WithoutExceptionFactory_GivenNotExistentId_Returns404Response() - { - _petApi.ExceptionFactory = null; - ApiResponse response = _petApi.GetPetByIdWithHttpInfo(NotExistentId); - Pet result = response.Data; - - Assert.IsType>(response); - Assert.Equal(404, (int)response.StatusCode); - Assert.True(response.Headers.ContainsKey("Content-Type")); - Assert.Equal("application/json", response.Headers["Content-Type"][0]); - - Assert.Null(result); - Assert.Equal("{\"code\":1,\"type\":\"error\",\"message\":\"Pet not found\"}", response.RawContent); - Assert.Equal("Not Found", response.ErrorText); - } - - #endregion - - #region Get Async - - /// - /// Test GetPetByIdAsync with an existent Id. - /// - [Fact] - public async Task GetPetByIdAsync_GivenExistentId_ReturnsPet() - { - Pet expected = BuildSamplePet(); - - Pet response = await _petApi.GetPetByIdAsync(PetId); - - Assert.IsType(response); - Assert.Equal(expected.Name, response.Name); - Assert.Equal(expected.Status, response.Status); - Assert.IsType>(response.Tags); - Assert.Equal(expected.Tags[0].Id, response.Tags[0].Id); - Assert.Equal(expected.Tags[0].Name, response.Tags[0].Name); - Assert.IsType>(response.PhotoUrls); - Assert.Equal(expected.PhotoUrls[0], response.PhotoUrls[0]); - Assert.IsType(response.Category); - Assert.Equal(expected.Category.Id, response.Category.Id); - Assert.Equal(expected.Category.Name, response.Category.Name); - } - - /// - /// Test GetPetByIdAsync with a not existent Id. - /// - [Fact] - public async Task GetPetByIdAsync_GivenNotExistentId_ThrowsApiException() - { - var exception = await Assert.ThrowsAsync(() => _petApi.GetPetByIdAsync(NotExistentId)); - - Assert.IsType(exception); - Assert.Equal(404, exception.ErrorCode); - Assert.Equal("{\"code\":1,\"type\":\"error\",\"message\":\"Pet not found\"}", exception.ErrorContent); - Assert.Equal("Error calling GetPetById: {\"code\":1,\"type\":\"error\",\"message\":\"Pet not found\"}", exception.Message); - } - - /// - /// Test GetPetByIdWithHttpInfoAsync with an existent Id. - /// - [Fact] - public async Task GetPetByIdWithHttpInfoAsync_GivenExistentId_Returns200Response() - { - Pet expected = BuildSamplePet(); - - ApiResponse response = await _petApi.GetPetByIdWithHttpInfoAsync(PetId); - Pet result = response.Data; - - Assert.IsType>(response); - Assert.Equal(200, (int)response.StatusCode); - Assert.True(response.Headers.ContainsKey("Content-Type")); - Assert.Equal("application/json", response.Headers["Content-Type"][0]); - - Assert.Equal(expected.Name, result.Name); - Assert.Equal(expected.Status, result.Status); - Assert.IsType>(result.Tags); - Assert.Equal(expected.Tags[0].Id, result.Tags[0].Id); - Assert.Equal(expected.Tags[0].Name, result.Tags[0].Name); - Assert.IsType>(result.PhotoUrls); - Assert.Equal(expected.PhotoUrls[0], result.PhotoUrls[0]); - Assert.IsType(result.Category); - Assert.Equal(expected.Category.Id, result.Category.Id); - Assert.Equal(expected.Category.Name, result.Category.Name); - } - - /// - /// Test GetPetByIdWithHttpInfoAsync with a not existent Id and the ExceptionFactory disabled. - /// - [Fact] - public async Task GetPetByIdWithHttpInfoAsync_GivenNotExistentId_ThrowsApiException() - { - var exception = await Assert.ThrowsAsync(() => _petApi.GetPetByIdWithHttpInfoAsync(NotExistentId)); - - Assert.IsType(exception); - Assert.Equal(404, exception.ErrorCode); - Assert.Equal("{\"code\":1,\"type\":\"error\",\"message\":\"Pet not found\"}", exception.ErrorContent); - Assert.Equal("Error calling GetPetById: {\"code\":1,\"type\":\"error\",\"message\":\"Pet not found\"}", exception.Message); - } - - /// - /// Test GetPetByIdWithHttpInfoAsync with a not existent Id and the ExceptionFactory disabled. - /// - [Fact] - public async Task GetPetByIdWithHttpInfoAsync_WithoutExceptionFactory_GivenNotExistentId_Returns404Response() - { - _petApi.ExceptionFactory = null; - ApiResponse response = await _petApi.GetPetByIdWithHttpInfoAsync(NotExistentId); - Pet result = response.Data; - - Assert.IsType>(response); - Assert.Equal(404, (int)response.StatusCode); - Assert.True(response.Headers.ContainsKey("Content-Type")); - Assert.Equal("application/json", response.Headers["Content-Type"][0]); - - Assert.Null(result); - Assert.Equal("{\"code\":1,\"type\":\"error\",\"message\":\"Pet not found\"}", response.RawContent); - Assert.Equal("Not Found", response.ErrorText); - } - - #endregion - - #region Find - - /// - /// Test FindPetsByStatus filtering available pets. - /// - [Fact(Skip = "too much elements to fetch, the server cut the json content")] - public void FindPetsByStatus_ReturnsListOfPetsFiltered() - { - List pets = _petApi.FindPetsByStatus(new List(new[] { "available" })); - - foreach (Pet pet in pets) - { - Assert.IsType(pet); - Assert.Equal(Pet.StatusEnum.Available, pet.Status); - } - } - - #endregion - - #region Add - - /// - /// Test AddPet with an existent Id. The current server beavior is to update the Pet. - /// - [Fact] - public void AddPet_GivenExistentId_UpdateThePet() - { - Pet pet = BuildSamplePet(); - - _petApi.AddPet(pet); - } - - #endregion - - #region AddAsync - - /// - /// Test AddPetAsync with an existent Id. The current server beavior is to update the Pet. - /// - [Fact] - public async Task AddPetAsync_GivenExistentId_UpdateThePet() - { - Pet pet = BuildSamplePet(); - - await _petApi.AddPetAsync(pet); - } - - #endregion - - #region Update - - /// - /// Test UpdatePet with an existent Id. - /// - [Fact] - public void UpdatePet_GivenExistentId_UpdateThePet() - { - Pet pet = BuildSamplePet(); - - _petApi.UpdatePet(pet); - } - - /// - /// Test UpdatePet with a not existent Id. The current server beavior is to create the Pet. - /// - [Fact] - public void UpdatePet_GivenNotExistentId_UpdateThePet() - { - Pet pet = BuildSamplePet(i => i.Id = NotExistentId); - - _petApi.UpdatePet(pet); - } - - /// - /// Test UpdatePetWithForm with an existent Id. - /// - [Fact] - public void UpdatePetWithForm_GivenExistentId_UpdatesTheFields() - { - Pet expected = BuildSamplePet(pet => - { - pet.Name = "name updated"; - pet.Status = Pet.StatusEnum.Pending; - }); - - _petApi.UpdatePetWithForm(PetId, "name updated", "pending"); - - Pet response = _petApi.GetPetById(PetId); - - Assert.IsType(response); - Assert.Equal(expected.Name, response.Name); - Assert.Equal(expected.Status, response.Status); - Assert.IsType>(response.Tags); - Assert.Equal(expected.Tags[0].Id, response.Tags[0].Id); - Assert.Equal(expected.Tags[0].Name, response.Tags[0].Name); - Assert.IsType>(response.PhotoUrls); - Assert.Equal(expected.PhotoUrls[0], response.PhotoUrls[0]); - Assert.IsType(response.Category); - Assert.Equal(expected.Category.Id, response.Category.Id); - Assert.Equal(expected.Category.Name, response.Category.Name); - - _petApi.UpdatePetWithForm(PetId, "name updated twice"); - - response = _petApi.GetPetById(PetId); - - Assert.Equal("name updated twice", response.Name); - } - - /// - /// Test UploadFile with an existent Id. - /// - [Fact(Skip = "generates 500 code at the time of test")] - public void UploadFile_UploadFileUsingFormParameters_UpdatesTheFields() - { - var assembly = Assembly.GetExecutingAssembly(); - using Stream imageStream = assembly.GetManifestResourceStream("Org.OpenAPITools.Test.linux-logo.png"); - _petApi.UploadFile(PetId, "metadata sample", imageStream); - } - - /// - /// Test UploadFile with an existent Id. - /// - [Fact(Skip = "generates 500 code at the time of test")] - public void UploadFile_UploadFileAlone_UpdatesTheField() - { - var assembly = Assembly.GetExecutingAssembly(); - using Stream imageStream = assembly.GetManifestResourceStream("Org.OpenAPITools.Test.linux-logo.png"); - _petApi.UploadFile(petId: PetId, file: imageStream); - } - - #endregion - - #region UpdateAsync - - /// - /// Test UpdatePetAsync with an existent Id. - /// - [Fact] - public async Task UpdatePetAsync_GivenExistentId_UpdateThePet() - { - Pet pet = BuildSamplePet(); - - await _petApi.UpdatePetAsync(pet); - } - - /// - /// Test UpdatePetAsync with a not existent Id. The current server beavior is to create the Pet. - /// - [Fact] - public async Task UpdatePetAsync_GivenNotExistentId_UpdateThePet() - { - Pet pet = BuildSamplePet(i => i.Id = NotExistentId); - - await _petApi.UpdatePetAsync(pet); - } - - /// - /// Test UpdatePetWithFormAsync with an existent Id. - /// - [Fact] - public async Task UpdatePetWithFormAsync_GivenExistentId_UpdatesTheFields() - { - Pet expected = BuildSamplePet(pet => - { - pet.Name = "name updated"; - pet.Status = Pet.StatusEnum.Pending; - }); - - await _petApi.UpdatePetWithFormAsync(PetId, "name updated", "pending"); - - Pet response = await _petApi.GetPetByIdAsync(PetId); - - Assert.IsType(response); - Assert.Equal(expected.Name, response.Name); - Assert.Equal(expected.Status, response.Status); - Assert.IsType>(response.Tags); - Assert.Equal(expected.Tags[0].Id, response.Tags[0].Id); - Assert.Equal(expected.Tags[0].Name, response.Tags[0].Name); - Assert.IsType>(response.PhotoUrls); - Assert.Equal(expected.PhotoUrls[0], response.PhotoUrls[0]); - Assert.IsType(response.Category); - Assert.Equal(expected.Category.Id, response.Category.Id); - Assert.Equal(expected.Category.Name, response.Category.Name); - - await _petApi.UpdatePetWithFormAsync(PetId, "name updated twice"); - - response = await _petApi.GetPetByIdAsync(PetId); - - Assert.Equal("name updated twice", response.Name); - } - - /// - /// Test UploadFileAsync with an existent Id. - /// - [Fact(Skip = "generates 500 code at the time of test")] - public async Task UploadFileAsync_UploadFileUsingFormParameters_UpdatesTheFields() - { - var assembly = Assembly.GetExecutingAssembly(); - await using Stream imageStream = assembly.GetManifestResourceStream("Org.OpenAPITools.Test.linux-logo.png"); - await _petApi.UploadFileAsync(PetId, "metadata sample", imageStream); - } - - /// - /// Test UploadFileAsync with an existent Id. - /// - [Fact(Skip = "generates 500 code at the time of test")] - public async Task UploadFileAsync_UploadFileAlone_UpdatesTheField() - { - var assembly = Assembly.GetExecutingAssembly(); - await using Stream imageStream = assembly.GetManifestResourceStream("Org.OpenAPITools.Test.linux-logo.png"); - await _petApi.UploadFileAsync(petId: PetId, file: imageStream); - } - - #endregion - - #region Delete - - /// - /// Test DeletePet with an existent Id. - /// - [Fact] - public void DeletePet_GivenExistentId_DeleteThePet() - { - _petApi.DeletePet(PetId); - - var exception = Assert.Throws(() => _petApi.GetPetById(PetId)); - - Assert.IsType(exception); - Assert.Equal(404, exception.ErrorCode); - } - - /// - /// Test DeletePet with a not existent Id. The current server beavior is to return 404. - /// - [Fact] - public void DeletePet_GivenNotExistentId_ThrowsApiException() - { - var exception = Assert.Throws(() => _petApi.DeletePet(NotExistentId)); - - Assert.IsType(exception); - Assert.Equal(404, exception.ErrorCode); - } - - #endregion - - #region DeleteAsync - - /// - /// Test DeletePet with an existent Id. - /// - [Fact] - public async Task DeletePetAsync_GivenExistentId_DeleteThePet() - { - await _petApi.DeletePetAsync(PetId); - - var exception = Assert.Throws(() => _petApi.GetPetById(PetId)); - - Assert.IsType(exception); - Assert.Equal(404, exception.ErrorCode); - } - - /// - /// Test DeletePet with a not existent Id. The current server beavior is to return 404. - /// - [Fact] - public async Task DeletePetAsync_GivenNotExistentId_ThrowsApiException() - { - var exception = await Assert.ThrowsAsync(() => _petApi.DeletePetAsync(NotExistentId)); - - Assert.IsType(exception); - Assert.Equal(404, exception.ErrorCode); - } - - #endregion - - private static Pet BuildSamplePet(Action callback = null) - { - var pet = new Pet( - name: "csharp test", - photoUrls: new List { "http://petstore.com/csharp_test" }) - { - Id = PetId, - Status = Pet.StatusEnum.Available, - Category = new Category { Id = 10, Name = "sample category" }, - Tags = new List { new Tag { Id = 100, Name = "sample tag" } } - }; - - callback?.Invoke(pet); - - return pet; - } - - public void Dispose() - { - // remove the pet after testing - try - { - _petApi.DeletePet(PetId); - } - catch (ApiException ex) when (ex.ErrorCode == 404) { } - - _petApi.Dispose(); - _httpClient.Dispose(); - } - } -} diff --git a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 20f33144c2a7..8fd7adbef647 100644 --- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -3,25 +3,17 @@ Org.OpenAPITools.Test Org.OpenAPITools.Test - netcoreapp3.0 + net7.0 false - - - - - - + + + - - - - - diff --git a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 29cc7e0a7168..60f5fb785a72 100644 --- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - false netstandard2.0 @@ -20,18 +19,33 @@ false + + + true + + + true + + + + - + + + - + + + - + + diff --git a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 25b33d9899f1..a667b359173b 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -3,14 +3,14 @@ Org.OpenAPITools.Test Org.OpenAPITools.Test - net7.0;net47 + net7.0;net47;net8.0 false - - - + + + diff --git a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 29da5e099768..a0ee50902740 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,8 +1,7 @@ - false - netstandard2.1;net47 + netstandard2.1;net47;net8.0 Org.OpenAPITools Org.OpenAPITools Library @@ -20,19 +19,35 @@ false + + + true + + + true + + + + - - + + + + + - + + + - + + diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 6e2e462b8a72..ef4192ba81be 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj index d3b74c210251..093a6d321f81 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - false net47 @@ -20,19 +19,35 @@ false + + + true + + + true + + + + - - + + + + + - + + + - + + diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index a136411ab795..69917ecc99b1 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 31ed9dab8ebd..9a18b0070565 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - false net48 @@ -20,21 +19,35 @@ false + + + true + + + true + + + + - - + + + + + - + - + + - - + + diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index a381e6a2f3cf..3bc135471dba 100644 --- a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Org.OpenAPITools.csproj index a5a6bf6200b9..4a5f5a0cc9c3 100644 --- a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - false net6.0 @@ -21,15 +20,34 @@ false + + + true + + + true + + + + - - + + + - + + + + + + + + + diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 2bd81bb6826e..80c8073c29d7 100644 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Org.OpenAPITools.csproj index dff6798bca8b..88aeef57691f 100644 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - false net7.0 @@ -21,16 +20,35 @@ false + + + true + + + true + + + + - - + + + - + + + + + + + + + diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj index dff6798bca8b..88aeef57691f 100644 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - false net7.0 @@ -21,16 +20,35 @@ false + + + true + + + true + + + + - - + + + - + + + + + + + + + diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 2bd81bb6826e..80c8073c29d7 100644 --- a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 95d4b0a15bd3..34f952f24ea4 100644 --- a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - false net7.0 @@ -21,15 +20,34 @@ false + + + true + + + true + + + + - - + + + - + + + + + + + + + diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 66dc542c5c2c..8fd7adbef647 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,9 +8,9 @@ - - - + + + diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 05f8f0bf135f..ef7e07f7ec0d 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - false netstandard2.0 @@ -20,19 +19,35 @@ false + + + true + + + true + + + + - - + + + + + - + + + - + + diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 07e2634c313b..1392d9caf6b0 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -23,9 +23,9 @@ OpenAPI spec version: 1.0.0 - - - runtime; build; native; contentfiles; analyzers; buildtransitive + + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 05f8f0bf135f..ef7e07f7ec0d 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -1,5 +1,4 @@ - false netstandard2.0 @@ -20,19 +19,35 @@ false + + + true + + + true + + + + - - + + + + + - + + + - + + From 9c5780bc5438220611044ff2dc766ecf8644d48b Mon Sep 17 00:00:00 2001 From: Bryan Aldrich Date: Tue, 10 Dec 2024 12:12:31 -0500 Subject: [PATCH 4/4] Microsoft projects now reference the highest minor version of the same SDK they were released with. --- .../src/main/resources/csharp/netcore_project.mustache | 6 +++--- .../Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../net8/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../net8/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../net8/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- .../Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj | 6 +++--- 26 files changed, 78 insertions(+), 78 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/csharp/netcore_project.mustache b/modules/openapi-generator/src/main/resources/csharp/netcore_project.mustache index 1f3c37c0b4d7..0e551b95b9ab 100644 --- a/modules/openapi-generator/src/main/resources/csharp/netcore_project.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/netcore_project.mustache @@ -46,11 +46,11 @@ {{/useRestSharp}} {{#useGenericHost}} - - + + {{#supportsRetry}} - + {{/supportsRetry}} {{#net80OrLater}} diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj index a17cb4f5dad5..517c0d87662e 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -31,10 +31,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 3fb29411d2be..52391e3b0af2 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -31,10 +31,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 3fb29411d2be..52391e3b0af2 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -31,10 +31,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj index caadbe462ab4..846c8863b9ad 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -30,10 +30,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 3fb29411d2be..52391e3b0af2 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -31,10 +31,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 3fb29411d2be..52391e3b0af2 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -31,10 +31,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 3fb29411d2be..52391e3b0af2 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -31,10 +31,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj index caadbe462ab4..846c8863b9ad 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -30,10 +30,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 121628b7fea1..82e25ebb02e8 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -31,10 +31,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 121628b7fea1..82e25ebb02e8 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -31,10 +31,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 4a62f8f05df7..72af8fe62e8e 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -30,10 +30,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 121628b7fea1..82e25ebb02e8 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -31,10 +31,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 121628b7fea1..82e25ebb02e8 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -31,10 +31,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 121628b7fea1..82e25ebb02e8 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -31,10 +31,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 4a62f8f05df7..72af8fe62e8e 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -30,10 +30,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 10796985a422..a4490ac88b85 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -32,10 +32,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 10796985a422..a4490ac88b85 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -32,10 +32,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj index a17cb4f5dad5..517c0d87662e 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -31,10 +31,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 0ca474f3c8b8..87c24b6aece7 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -31,10 +31,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 10796985a422..a4490ac88b85 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -32,10 +32,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 10796985a422..a4490ac88b85 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -32,10 +32,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 0ca474f3c8b8..87c24b6aece7 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -31,10 +31,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 10796985a422..a4490ac88b85 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -32,10 +32,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj index a17cb4f5dad5..517c0d87662e 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -31,10 +31,10 @@ - - + + - + diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj index fcff276ad299..8e6b3023a4d6 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -31,10 +31,10 @@ - - + + - +