diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java index 4d3cd1fc6cb..4f6bc5486b4 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java @@ -40,6 +40,7 @@ import java.io.File; import java.io.IOException; import java.io.Writer; import java.util.*; +import java.util.stream.Collectors; import static org.openapitools.codegen.utils.CamelizeOption.LOWERCASE_FIRST_LETTER; import static org.openapitools.codegen.utils.StringUtils.camelize; @@ -835,6 +836,9 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co } } + Set referenceTypes = operation.allParams.stream().filter(p -> p.vendorExtensions.get("x-is-value-type") == null && !p.isNullable).collect(Collectors.toSet()); + operation.vendorExtensions.put("x-not-nullable-reference-types", referenceTypes); + operation.vendorExtensions.put("x-has-not-nullable-reference-types", referenceTypes.size() > 0); processOperation(operation); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java index 1cc82928e08..42242c27865 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java @@ -1028,6 +1028,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { supportingFiles.add(new SupportingFile("ApiResponseEventArgs.mustache", clientPackageDir, "ApiResponseEventArgs.cs")); supportingFiles.add(new SupportingFile("JsonSerializerOptionsProvider.mustache", clientPackageDir, "JsonSerializerOptionsProvider.cs")); supportingFiles.add(new SupportingFile("CookieContainer.mustache", clientPackageDir, "CookieContainer.cs")); + supportingFiles.add(new SupportingFile("Option.mustache", clientPackageDir, "Option.cs")); supportingFiles.add(new SupportingFile("IApi.mustache", sourceFolder + File.separator + packageName + File.separator + apiPackage(), getInterfacePrefix() + "Api.cs")); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/TrimTrailingWhiteSpaceLambda.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/TrimTrailingWhiteSpaceLambda.java index 9f39bdf3543..73c51726562 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/TrimTrailingWhiteSpaceLambda.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/TrimTrailingWhiteSpaceLambda.java @@ -38,6 +38,6 @@ import com.samskivert.mustache.Template.Fragment; public class TrimTrailingWhiteSpaceLambda implements Mustache.Lambda { @Override public void execute(Fragment fragment, Writer writer) throws IOException { - writer.write(fragment.execute().stripTrailing()); + writer.write(fragment.execute().stripTrailing() + "\n"); } } diff --git a/modules/openapi-generator/src/main/resources/csharp/NullConditionalParameter.mustache b/modules/openapi-generator/src/main/resources/csharp/NullConditionalParameter.mustache index da996f2383f..d8ad9266699 100644 --- a/modules/openapi-generator/src/main/resources/csharp/NullConditionalParameter.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/NullConditionalParameter.mustache @@ -1 +1 @@ -{{#notRequiredOrIsNullable}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}}{{/notRequiredOrIsNullable}} \ No newline at end of file +{{#isNullable}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}}{{/isNullable}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiTestsBase.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiTestsBase.mustache index 5bb3280186a..2fcd6049c3f 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiTestsBase.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ApiTestsBase.mustache @@ -57,7 +57,9 @@ namespace {{packageName}}.Test.{{apiPackage}} {{#hasOAuthMethods}} string oauthTokenValue = context.Configuration[""] ?? throw new Exception("Token not found."); OAuthToken oauthToken = new{{^net70OrLater}} OAuthToken{{/net70OrLater}}(oauthTokenValue, timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken);{{/hasOAuthMethods}}{{/lambda.trimTrailingWhiteSpace}} + options.AddTokens(oauthToken); + {{/hasOAuthMethods}} + {{/lambda.trimTrailingWhiteSpace}} }); } } diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache index 7eb0aa1c3bb..cf850596572 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache @@ -503,6 +503,16 @@ {{^isDate}} {{^isDateTime}} writer.WritePropertyName("{{baseName}}"); - JsonSerializer.Serialize(writer, {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}, jsonSerializerOptions);{{/isDateTime}}{{/isDate}}{{/isNumeric}}{{/isBoolean}}{{/isString}}{{/isEnum}}{{/isUuid}}{{/allVars}}{{/lambda.trimLineBreaks}}{{/lambda.trimTrailingWhiteSpace}} + JsonSerializer.Serialize(writer, {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}, jsonSerializerOptions); + {{/isDateTime}} + {{/isDate}} + {{/isNumeric}} + {{/isBoolean}} + {{/isString}} + {{/isEnum}} + {{/isUuid}} + {{/allVars}} + {{/lambda.trimLineBreaks}} + {{/lambda.trimTrailingWhiteSpace}} } } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/OperationSignature.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/OperationSignature.mustache index 3b2907d1ea6..83076f2b1eb 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/OperationSignature.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/OperationSignature.mustache @@ -1 +1 @@ -{{#lambda.joinWithComma}}{{#allParams}}{{{dataType}}}{{>NullConditionalParameter}} {{paramName}}{{#notRequiredOrIsNullable}} = null{{/notRequiredOrIsNullable}} {{/allParams}}System.Threading.CancellationToken cancellationToken = default{{^netstandard20OrLater}}(System.Threading.CancellationToken){{/netstandard20OrLater}}{{/lambda.joinWithComma}} \ No newline at end of file +{{#lambda.joinWithComma}}{{#allParams}}{{#required}}{{{dataType}}}{{>NullConditionalParameter}}{{/required}}{{^required}}Option<{{{dataType}}}{{>NullConditionalParameter}}>{{/required}} {{paramName}}{{#notRequiredOrIsNullable}} = default{{/notRequiredOrIsNullable}} {{/allParams}}System.Threading.CancellationToken cancellationToken = default{{^netstandard20OrLater}}(System.Threading.CancellationToken){{/netstandard20OrLater}}{{/lambda.joinWithComma}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/Option.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/Option.mustache new file mode 100644 index 00000000000..8e0d888a224 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/Option.mustache @@ -0,0 +1,35 @@ +// +{{>partial_header}} +{{#nrt}} +#nullable enable + +{{/nrt}} + +namespace {{packageName}}.{{clientPackage}} +{ + /// + /// A wrapper for operation parameters which are not required + /// + public struct Option + { + /// + /// The value to send to the server + /// + public TType Value { get; } + + /// + /// When true the value will be sent to the server + /// + internal bool IsSet { get; } + + /// + /// A wrapper for operation parameters which are not required + /// + /// + public Option(TType value) + { + IsSet = true; + Value = value; + } + } +} \ No newline at end of file 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 e5bfd5550a7..0c1856bfbf6 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 @@ -128,53 +128,41 @@ namespace {{packageName}}.{{apiPackage}} {{#allParams}} {{#-first}} - partial void Format{{operationId}}({{#allParams}}{{#isPrimitiveType}}ref {{/isPrimitiveType}}{{{dataType}}}{{>NullConditionalParameter}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + partial void Format{{operationId}}({{#allParams}}{{#isPrimitiveType}}ref {{/isPrimitiveType}}{{^required}}Option<{{/required}}{{{dataType}}}{{>NullConditionalParameter}}{{^required}}>{{/required}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); {{/-first}} {{/allParams}} - {{#notNullableParams}} - {{#-first}} + {{#vendorExtensions.x-has-not-nullable-reference-types}} /// /// Validates the request parameters /// - {{/-first}} + {{#vendorExtensions.x-not-nullable-reference-types}} /// - {{#-last}} + {{/vendorExtensions.x-not-nullable-reference-types}} /// - private void Validate{{operationId}}({{#notNullableParams}}{{{dataType}}}{{>NullConditionalParameter}} {{paramName}}{{^-last}}, {{/-last}}{{/notNullableParams}}) + private void Validate{{operationId}}({{#vendorExtensions.x-not-nullable-reference-types}}{{^required}}Option<{{/required}}{{{dataType}}}{{>NullConditionalParameter}}{{^required}}>{{/required}} {{paramName}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-not-nullable-reference-types}}) { - {{#notNullableParams}} - {{#-first}} - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - {{/-first}} - {{#nrt}} - if ({{paramName}} == null) - throw new ArgumentNullException(nameof({{paramName}})); - - {{/nrt}} - {{^nrt}} + {{#lambda.trimTrailingWhiteSpace}} + {{#vendorExtensions.x-not-nullable-reference-types}} + {{#required}} {{^vendorExtensions.x-is-value-type}} if ({{paramName}} == null) throw new ArgumentNullException(nameof({{paramName}})); {{/vendorExtensions.x-is-value-type}} - {{#vendorExtensions.x-is-value-type}} - if ({{paramName}} == null) + {{/required}} + {{^required}} + {{^vendorExtensions.x-is-value-type}} + if ({{paramName}}.IsSet && {{paramName}}.Value == null) throw new ArgumentNullException(nameof({{paramName}})); {{/vendorExtensions.x-is-value-type}} - {{/nrt}} - {{#-last}} - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - {{/-last}} - {{/notNullableParams}} + {{/required}} + {{/vendorExtensions.x-not-nullable-reference-types}} + {{/lambda.trimTrailingWhiteSpace}} } - {{/-last}} - {{/notNullableParams}} + {{/vendorExtensions.x-has-not-nullable-reference-types}} /// /// Processes the server response /// @@ -182,7 +170,7 @@ namespace {{packageName}}.{{apiPackage}} {{#allParams}} /// {{/allParams}} - private void After{{operationId}}DefaultImplementation({{#lambda.joinWithComma}}ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}object{{/returnType}}> apiResponseLocalVar {{#allParams}}{{{dataType}}}{{>NullConditionalParameter}} {{paramName}} {{/allParams}}{{/lambda.joinWithComma}}) + private void After{{operationId}}DefaultImplementation({{#lambda.joinWithComma}}ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}object{{/returnType}}> apiResponseLocalVar {{#allParams}}{{^required}}Option<{{/required}}{{{dataType}}}{{>NullConditionalParameter}}{{^required}}>{{/required}} {{paramName}} {{/allParams}}{{/lambda.joinWithComma}}) { bool suppressDefaultLog = false; After{{operationId}}({{#lambda.joinWithComma}}ref suppressDefaultLog apiResponseLocalVar {{#allParams}}{{paramName}} {{/allParams}}{{/lambda.joinWithComma}}); @@ -197,7 +185,7 @@ namespace {{packageName}}.{{apiPackage}} {{#allParams}} /// {{/allParams}} - partial void After{{operationId}}({{#lambda.joinWithComma}}ref bool suppressDefaultLog ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}object{{/returnType}}> apiResponseLocalVar {{#allParams}}{{{dataType}}}{{>NullConditionalParameter}} {{paramName}} {{/allParams}}{{/lambda.joinWithComma}}); + partial void After{{operationId}}({{#lambda.joinWithComma}}ref bool suppressDefaultLog ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}object{{/returnType}}> apiResponseLocalVar {{#allParams}}{{^required}}Option<{{/required}}{{{dataType}}}{{>NullConditionalParameter}}{{^required}}>{{/required}} {{paramName}} {{/allParams}}{{/lambda.joinWithComma}}); /// /// Logs exceptions that occur while retrieving the server response @@ -208,7 +196,7 @@ namespace {{packageName}}.{{apiPackage}} {{#allParams}} /// {{/allParams}} - private void OnError{{operationId}}DefaultImplementation({{#lambda.joinWithComma}}Exception exception string pathFormat string path {{#allParams}}{{{dataType}}}{{>NullConditionalParameter}} {{paramName}} {{/allParams}}{{/lambda.joinWithComma}}) + private void OnError{{operationId}}DefaultImplementation({{#lambda.joinWithComma}}Exception exception string pathFormat string path {{#allParams}}{{^required}}Option<{{/required}}{{{dataType}}}{{>NullConditionalParameter}}{{^required}}>{{/required}} {{paramName}} {{/allParams}}{{/lambda.joinWithComma}}) { {{>OnErrorDefaultImplementation}} OnError{{operationId}}({{#lambda.joinWithComma}}exception pathFormat path {{#allParams}}{{paramName}} {{/allParams}}{{/lambda.joinWithComma}}); @@ -223,7 +211,7 @@ namespace {{packageName}}.{{apiPackage}} {{#allParams}} /// {{/allParams}} - partial void OnError{{operationId}}({{#lambda.joinWithComma}}Exception exception string pathFormat string path {{#allParams}}{{{dataType}}}{{>NullConditionalParameter}} {{paramName}} {{/allParams}}{{/lambda.joinWithComma}}); + partial void OnError{{operationId}}({{#lambda.joinWithComma}}Exception exception string pathFormat string path {{#allParams}}{{^required}}Option<{{/required}}{{{dataType}}}{{>NullConditionalParameter}}{{^required}}>{{/required}} {{paramName}} {{/allParams}}{{/lambda.joinWithComma}}); /// /// {{summary}} {{notes}} @@ -261,12 +249,10 @@ namespace {{packageName}}.{{apiPackage}} try { - {{#notNullableParams}} - {{#-first}} - Validate{{operationId}}({{#notNullableParams}}{{paramName}}{{^-last}}, {{/-last}}{{/notNullableParams}}); + {{#vendorExtensions.x-has-not-nullable-reference-types}} + Validate{{operationId}}({{#vendorExtensions.x-not-nullable-reference-types}}{{paramName}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-not-nullable-reference-types}}); - {{/-first}} - {{/notNullableParams}} + {{/vendorExtensions.x-has-not-nullable-reference-types}} {{#allParams}} {{#-first}} Format{{operationId}}({{#allParams}}{{#isPrimitiveType}}ref {{/isPrimitiveType}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); @@ -295,8 +281,8 @@ namespace {{packageName}}.{{apiPackage}} {{/required}} {{^required}} - if ({{paramName}} != null) - uriBuilderLocalVar.Path = uriBuilderLocalVar.Path + $"/{ Uri.EscapeDataString({{paramName}}).ToString()) }"; + if ({{paramName}}.IsSet) + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path + $"/{ Uri.EscapeDataString({{paramName}}.Value).ToString()) }"; {{#-last}} {{/-last}} @@ -325,14 +311,14 @@ namespace {{packageName}}.{{apiPackage}} {{/-first}} {{/required}} {{#required}} - parseQueryStringLocalVar["{{baseName}}"] = {{paramName}}.ToString(); + parseQueryStringLocalVar["{{baseName}}"] = {{paramName}}{{#isNullable}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}}{{/isNullable}}.ToString(); {{/required}} {{/queryParams}} {{#queryParams}} {{^required}} - if ({{paramName}} != null) - parseQueryStringLocalVar["{{baseName}}"] = {{paramName}}.ToString(); + if ({{paramName}}.IsSet) + parseQueryStringLocalVar["{{baseName}}"] = {{paramName}}.Value{{#isNullable}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}}{{/isNullable}}.ToString(); {{/required}} {{#-last}} @@ -346,8 +332,8 @@ namespace {{packageName}}.{{apiPackage}} {{/required}} {{^required}} - if ({{paramName}} != null) - httpRequestMessageLocalVar.Headers.Add("{{baseName}}", ClientUtils.ParameterToString({{paramName}})); + if ({{paramName}}.IsSet) + httpRequestMessageLocalVar.Headers.Add("{{baseName}}", ClientUtils.ParameterToString({{paramName}}.Value)); {{/required}} {{/headerParams}} @@ -365,8 +351,8 @@ namespace {{packageName}}.{{apiPackage}} {{/required}} {{^required}} - if ({{paramName}} != null) - formParameterLocalVars.Add(new KeyValuePair("{{baseName}}", ClientUtils.ParameterToString({{paramName}}))); + if ({{paramName}}.IsSet) + formParameterLocalVars.Add(new KeyValuePair("{{baseName}}", ClientUtils.ParameterToString({{paramName}}.Value))); {{/required}} {{/isFile}} @@ -376,16 +362,24 @@ namespace {{packageName}}.{{apiPackage}} {{/required}} {{^required}} - if ({{paramName}} != null) - multipartContentLocalVar.Add(new StreamContent({{paramName}})); + if ({{paramName}}.IsSet) + multipartContentLocalVar.Add(new StreamContent({{paramName}}.Value)); {{/required}} {{/isFile}} {{/formParams}} {{#bodyParam}} - httpRequestMessageLocalVar.Content = ({{paramName}} as object) is System.IO.Stream stream + {{#required}} + httpRequestMessageLocalVar.Content = ({{paramName}}{{^required}}.Value{{/required}} as object) is System.IO.Stream stream ? httpRequestMessageLocalVar.Content = new StreamContent(stream) - : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize({{paramName}}, _jsonSerializerOptions)); + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize({{paramName}}{{^required}}.Value{{/required}}, _jsonSerializerOptions)); + {{/required}} + {{^required}} + if ({{paramName}}.IsSet) + httpRequestMessageLocalVar.Content = ({{paramName}}{{^required}}.Value{{/required}} as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize({{paramName}}{{^required}}.Value{{/required}}, _jsonSerializerOptions)); + {{/required}} {{/bodyParam}} {{#authMethods}} @@ -442,9 +436,11 @@ namespace {{packageName}}.{{apiPackage}} tokenBaseLocalVars.Add(httpSignatureTokenLocalVar); - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content{{nrt!}}.ReadAsStringAsync({{#net60OrLater}}cancellationToken{{/net60OrLater}}).ConfigureAwait(false); + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync({{#net60OrLater}}cancellationToken{{/net60OrLater}}).ConfigureAwait(false); - httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } {{/isHttpSignature}} {{/authMethods}} {{#consumes}} @@ -462,7 +458,7 @@ namespace {{packageName}}.{{apiPackage}} string{{nrt?}} contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); {{/-first}} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api_test.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api_test.mustache index 68931c3c14d..551bf2757af 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/api_test.mustache @@ -34,7 +34,7 @@ namespace {{packageName}}.Test.{{apiPackage}} public async Task {{operationId}}AsyncTest() { {{#allParams}} - {{{dataType}}} {{paramName}} = default{{nrt!}}; + {{^required}}Client.Option<{{/required}}{{{dataType}}}{{>NullConditionalParameter}}{{^required}}>{{/required}} {{paramName}} = default{{nrt!}}; {{/allParams}} {{#returnType}} var response = await _instance.{{operationId}}Async({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); diff --git a/modules/openapi-generator/src/main/resources/csharp/model_test.mustache b/modules/openapi-generator/src/main/resources/csharp/model_test.mustache index 28aac8f917a..5e0ac9fbea8 100644 --- a/modules/openapi-generator/src/main/resources/csharp/model_test.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/model_test.mustache @@ -77,7 +77,10 @@ namespace {{packageName}}.Test.Model public void {{name}}Test() { // TODO unit test for the property '{{name}}' - }{{/vars}}{{/lambda.trimLineBreaks}}{{/lambda.trimTrailingWhiteSpace}} + } + {{/vars}} + {{/lambda.trimLineBreaks}} + {{/lambda.trimTrailingWhiteSpace}} } } {{/model}} diff --git a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index ef87ff72dc3..53a54998aac 100644 --- a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -1067,6 +1067,34 @@ paths: type: array items: type: string + - name: requiredNotNullable + in: query + required: true + explode: true + schema: + type: string + nullable: false + - name: requiredNullable + in: query + required: true + explode: true + schema: + type: string + nullable: true + - name: notRequiredNotNullable + in: query + required: false + explode: true + schema: + type: string + nullable: false + - name: notRequiredNullable + in: query + required: false + explode: true + schema: + type: string + nullable: true responses: "200": description: Success diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml index 6be7f291ccc..c2398ea9992 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml @@ -1036,6 +1036,38 @@ paths: type: string type: array style: form + - explode: true + in: query + name: requiredNotNullable + required: true + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: requiredNullable + required: true + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: notRequiredNotNullable + required: false + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: notRequiredNullable + required: false + schema: + nullable: true + type: string + style: form responses: "200": description: Success diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/FakeApi.md index 7bdf5246aac..f2bf397505d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/FakeApi.md @@ -1301,7 +1301,7 @@ No authorization required # **TestQueryParameterCollectionFormat** -> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context) +> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = null, string notRequiredNullable = null) @@ -1329,10 +1329,14 @@ namespace Example var http = new List(); // List | var url = new List(); // List | var context = new List(); // List | + var requiredNotNullable = "requiredNotNullable_example"; // string | + var requiredNullable = "requiredNullable_example"; // string | + var notRequiredNotNullable = "notRequiredNotNullable_example"; // string | (optional) + var notRequiredNullable = "notRequiredNullable_example"; // string | (optional) try { - apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1351,7 +1355,7 @@ This returns an ApiResponse object which contains the response data, status code ```csharp try { - apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1370,6 +1374,10 @@ catch (ApiException e) | **http** | [**List<string>**](string.md) | | | | **url** | [**List<string>**](string.md) | | | | **context** | [**List<string>**](string.md) | | | +| **requiredNotNullable** | **string** | | | +| **requiredNullable** | **string** | | | +| **notRequiredNotNullable** | **string** | | [optional] | +| **notRequiredNullable** | **string** | | [optional] | ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Api/FakeApi.cs index db7210ad86f..aef969f7935 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Api/FakeApi.cs @@ -398,9 +398,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// - void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0); + void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0); /// /// @@ -414,9 +418,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// ApiResponse of Object(void) - ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0); + ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0); #endregion Synchronous Operations } @@ -840,10 +848,14 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of void - System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// @@ -857,10 +869,14 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of ApiResponse - System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); #endregion Asynchronous Operations } @@ -3246,11 +3262,15 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// - public void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0) + public void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0) { - TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } /// @@ -3262,9 +3282,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0) + public Org.OpenAPITools.Client.ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0) { // verify the required parameter 'pipe' is set if (pipe == null) @@ -3296,6 +3320,18 @@ namespace Org.OpenAPITools.Api throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); } + // verify the required parameter 'requiredNotNullable' is set + if (requiredNotNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'requiredNullable' is set + if (requiredNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); string[] _contentTypes = new string[] { @@ -3322,6 +3358,16 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); + if (notRequiredNotNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); + } + if (notRequiredNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); + } localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat"; localVarRequestOptions.OperationIndex = operationIndex; @@ -3350,12 +3396,16 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of void - public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, operationIndex, cancellationToken).ConfigureAwait(false); + await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable, operationIndex, cancellationToken).ConfigureAwait(false); } /// @@ -3367,10 +3417,14 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // verify the required parameter 'pipe' is set if (pipe == null) @@ -3402,6 +3456,18 @@ namespace Org.OpenAPITools.Api throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); } + // verify the required parameter 'requiredNotNullable' is set + if (requiredNotNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'requiredNullable' is set + if (requiredNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); @@ -3429,6 +3495,16 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); + if (notRequiredNotNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); + } + if (notRequiredNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); + } localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat"; localVarRequestOptions.OperationIndex = operationIndex; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES index 0ab733136b4..60c779c5ced 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES @@ -123,6 +123,7 @@ src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs src/Org.OpenAPITools/Client/HttpSigningToken.cs src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs src/Org.OpenAPITools/Client/OAuthToken.cs +src/Org.OpenAPITools/Client/Option.cs src/Org.OpenAPITools/Client/RateLimitProvider`1.cs src/Org.OpenAPITools/Client/TokenBase.cs src/Org.OpenAPITools/Client/TokenContainer`1.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml index 6be7f291ccc..c2398ea9992 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml @@ -1036,6 +1036,38 @@ paths: type: string type: array style: form + - explode: true + in: query + name: requiredNotNullable + required: true + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: requiredNullable + required: true + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: notRequiredNotNullable + required: false + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: notRequiredNullable + required: false + schema: + nullable: true + type: string + style: form responses: "200": description: Success diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/apis/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/apis/FakeApi.md index b49cfaa04e3..82106bd5206 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/apis/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/apis/FakeApi.md @@ -1301,7 +1301,7 @@ No authorization required # **TestQueryParameterCollectionFormat** -> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context) +> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = null, string notRequiredNullable = null) @@ -1329,10 +1329,14 @@ namespace Example var http = new List(); // List | var url = new List(); // List | var context = new List(); // List | + var requiredNotNullable = "requiredNotNullable_example"; // string | + var requiredNullable = "requiredNullable_example"; // string | + var notRequiredNotNullable = "notRequiredNotNullable_example"; // string | (optional) + var notRequiredNullable = "notRequiredNullable_example"; // string | (optional) try { - apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1351,7 +1355,7 @@ This returns an ApiResponse object which contains the response data, status code ```csharp try { - apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1370,6 +1374,10 @@ catch (ApiException e) | **http** | [**List<string>**](string.md) | | | | **url** | [**List<string>**](string.md) | | | | **context** | [**List<string>**](string.md) | | | +| **requiredNotNullable** | **string** | | | +| **requiredNullable** | **string** | | | +| **notRequiredNotNullable** | **string** | | [optional] | +| **notRequiredNullable** | **string** | | [optional] | ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs index bf581ec0e81..be1d929d1dd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs @@ -67,7 +67,7 @@ namespace Org.OpenAPITools.Test.Api [Fact (Skip = "not implemented")] public async Task FakeOuterBooleanSerializeAsyncTest() { - bool body = default!; + Client.Option body = default!; var response = await _instance.FakeOuterBooleanSerializeAsync(body); var model = response.AsModel(); Assert.IsType(model); @@ -79,7 +79,7 @@ namespace Org.OpenAPITools.Test.Api [Fact (Skip = "not implemented")] public async Task FakeOuterCompositeSerializeAsyncTest() { - OuterComposite outerComposite = default!; + Client.Option outerComposite = default!; var response = await _instance.FakeOuterCompositeSerializeAsync(outerComposite); var model = response.AsModel(); Assert.IsType(model); @@ -91,7 +91,7 @@ namespace Org.OpenAPITools.Test.Api [Fact (Skip = "not implemented")] public async Task FakeOuterNumberSerializeAsyncTest() { - decimal body = default!; + Client.Option body = default!; var response = await _instance.FakeOuterNumberSerializeAsync(body); var model = response.AsModel(); Assert.IsType(model); @@ -104,7 +104,7 @@ namespace Org.OpenAPITools.Test.Api public async Task FakeOuterStringSerializeAsyncTest() { Guid requiredStringUuid = default!; - string body = default!; + Client.Option body = default!; var response = await _instance.FakeOuterStringSerializeAsync(requiredStringUuid, body); var model = response.AsModel(); Assert.IsType(model); @@ -164,16 +164,16 @@ namespace Org.OpenAPITools.Test.Api decimal number = default!; double varDouble = default!; string patternWithoutDelimiter = default!; - DateTime date = default!; - System.IO.Stream binary = default!; - float varFloat = default!; - int integer = default!; - int int32 = default!; - long int64 = default!; - string varString = default!; - string password = default!; - string callback = default!; - DateTime dateTime = default!; + Client.Option date = default!; + Client.Option binary = default!; + Client.Option varFloat = default!; + Client.Option integer = default!; + Client.Option int32 = default!; + Client.Option int64 = default!; + Client.Option varString = default!; + Client.Option password = default!; + Client.Option callback = default!; + Client.Option dateTime = default!; await _instance.TestEndpointParametersAsync(varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime); } @@ -183,14 +183,14 @@ namespace Org.OpenAPITools.Test.Api [Fact (Skip = "not implemented")] public async Task TestEnumParametersAsyncTest() { - List enumHeaderStringArray = default!; - List enumQueryStringArray = default!; - double enumQueryDouble = default!; - int enumQueryInteger = default!; - List enumFormStringArray = default!; - string enumHeaderString = default!; - string enumQueryString = default!; - string enumFormString = default!; + Client.Option> enumHeaderStringArray = default!; + Client.Option> enumQueryStringArray = default!; + Client.Option enumQueryDouble = default!; + Client.Option enumQueryInteger = default!; + Client.Option> enumFormStringArray = default!; + Client.Option enumHeaderString = default!; + Client.Option enumQueryString = default!; + Client.Option enumFormString = default!; await _instance.TestEnumParametersAsync(enumHeaderStringArray, enumQueryStringArray, enumQueryDouble, enumQueryInteger, enumFormStringArray, enumHeaderString, enumQueryString, enumFormString); } @@ -203,9 +203,9 @@ namespace Org.OpenAPITools.Test.Api bool requiredBooleanGroup = default!; int requiredStringGroup = default!; long requiredInt64Group = default!; - bool booleanGroup = default!; - int stringGroup = default!; - long int64Group = default!; + Client.Option booleanGroup = default!; + Client.Option stringGroup = default!; + Client.Option int64Group = default!; await _instance.TestGroupParametersAsync(requiredBooleanGroup, requiredStringGroup, requiredInt64Group, booleanGroup, stringGroup, int64Group); } @@ -241,7 +241,11 @@ namespace Org.OpenAPITools.Test.Api List http = default!; List url = default!; List context = default!; - await _instance.TestQueryParameterCollectionFormatAsync(pipe, ioutil, http, url, context); + string requiredNotNullable = default!; + string? requiredNullable = default!; + Client.Option notRequiredNotNullable = default!; + Client.Option notRequiredNullable = default!; + await _instance.TestQueryParameterCollectionFormatAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/PetApiTests.cs index 02bfe3125da..4d9e0a32d2c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/PetApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/PetApiTests.cs @@ -67,7 +67,7 @@ namespace Org.OpenAPITools.Test.Api public async Task DeletePetAsyncTest() { long petId = default!; - string apiKey = default!; + Client.Option apiKey = default!; await _instance.DeletePetAsync(petId, apiKey); } @@ -124,8 +124,8 @@ namespace Org.OpenAPITools.Test.Api public async Task UpdatePetWithFormAsyncTest() { long petId = default!; - string name = default!; - string status = default!; + Client.Option name = default!; + Client.Option status = default!; await _instance.UpdatePetWithFormAsync(petId, name, status); } @@ -136,8 +136,8 @@ namespace Org.OpenAPITools.Test.Api public async Task UploadFileAsyncTest() { long petId = default!; - System.IO.Stream file = default!; - string additionalMetadata = default!; + Client.Option file = default!; + Client.Option additionalMetadata = default!; var response = await _instance.UploadFileAsync(petId, file, additionalMetadata); var model = response.AsModel(); Assert.IsType(model); @@ -151,7 +151,7 @@ namespace Org.OpenAPITools.Test.Api { System.IO.Stream requiredFile = default!; long petId = default!; - string additionalMetadata = default!; + Client.Option additionalMetadata = default!; var response = await _instance.UploadFileWithRequiredFileAsync(requiredFile, petId, additionalMetadata); var model = response.AsModel(); Assert.IsType(model); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 2d50aaed726..a0bfbba9827 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -128,14 +128,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateCall123TestSpecialTags(ModelClient modelClient) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (modelClient == null) throw new ArgumentNullException(nameof(modelClient)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -235,7 +229,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/DefaultApi.cs index c24a3ce8d7b..1324a529bd5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -279,14 +279,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateGetCountry(string country) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (country == null) throw new ArgumentNullException(nameof(country)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -392,7 +386,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Post; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeApi.cs index c7b62f6f179..14c0568e25f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeApi.cs @@ -60,7 +60,7 @@ namespace Org.OpenAPITools.IApi /// Input boolean as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<bool>> - Task> FakeOuterBooleanSerializeAsync(bool? body = null, System.Threading.CancellationToken cancellationToken = default); + Task> FakeOuterBooleanSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -71,7 +71,7 @@ namespace Org.OpenAPITools.IApi /// Input boolean as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>bool>?> - Task?> FakeOuterBooleanSerializeOrDefaultAsync(bool? body = null, System.Threading.CancellationToken cancellationToken = default); + Task?> FakeOuterBooleanSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -83,7 +83,7 @@ namespace Org.OpenAPITools.IApi /// Input composite as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<OuterComposite>> - Task> FakeOuterCompositeSerializeAsync(OuterComposite? outerComposite = null, System.Threading.CancellationToken cancellationToken = default); + Task> FakeOuterCompositeSerializeAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -94,7 +94,7 @@ namespace Org.OpenAPITools.IApi /// Input composite as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>OuterComposite>?> - Task?> FakeOuterCompositeSerializeOrDefaultAsync(OuterComposite? outerComposite = null, System.Threading.CancellationToken cancellationToken = default); + Task?> FakeOuterCompositeSerializeOrDefaultAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -106,7 +106,7 @@ namespace Org.OpenAPITools.IApi /// Input number as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<decimal>> - Task> FakeOuterNumberSerializeAsync(decimal? body = null, System.Threading.CancellationToken cancellationToken = default); + Task> FakeOuterNumberSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -117,7 +117,7 @@ namespace Org.OpenAPITools.IApi /// Input number as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>decimal>?> - Task?> FakeOuterNumberSerializeOrDefaultAsync(decimal? body = null, System.Threading.CancellationToken cancellationToken = default); + Task?> FakeOuterNumberSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -130,7 +130,7 @@ namespace Org.OpenAPITools.IApi /// Input string as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<string>> - Task> FakeOuterStringSerializeAsync(Guid requiredStringUuid, string? body = null, System.Threading.CancellationToken cancellationToken = default); + Task> FakeOuterStringSerializeAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -142,7 +142,7 @@ namespace Org.OpenAPITools.IApi /// Input string as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>string>?> - Task?> FakeOuterStringSerializeOrDefaultAsync(Guid requiredStringUuid, string? body = null, System.Threading.CancellationToken cancellationToken = default); + Task?> FakeOuterStringSerializeOrDefaultAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default); /// /// Array of Enums @@ -259,7 +259,7 @@ namespace Org.OpenAPITools.IApi /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") /// Cancellation Token to cancel the request. /// Task<ApiResponse<object>> - Task> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date = null, System.IO.Stream? binary = null, float? varFloat = null, int? integer = null, int? int32 = null, long? int64 = null, string? varString = null, string? password = null, string? callback = null, DateTime? dateTime = null, System.Threading.CancellationToken cancellationToken = default); + Task> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date = default, Option binary = default, Option varFloat = default, Option integer = default, Option int32 = default, Option int64 = default, Option varString = default, Option password = default, Option callback = default, Option dateTime = default, System.Threading.CancellationToken cancellationToken = default); /// /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -283,7 +283,7 @@ namespace Org.OpenAPITools.IApi /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") /// Cancellation Token to cancel the request. /// Task<ApiResponse>object>?> - Task?> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date = null, System.IO.Stream? binary = null, float? varFloat = null, int? integer = null, int? int32 = null, long? int64 = null, string? varString = null, string? password = null, string? callback = null, DateTime? dateTime = null, System.Threading.CancellationToken cancellationToken = default); + Task?> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date = default, Option binary = default, Option varFloat = default, Option integer = default, Option int32 = default, Option int64 = default, Option varString = default, Option password = default, Option callback = default, Option dateTime = default, System.Threading.CancellationToken cancellationToken = default); /// /// To test enum parameters @@ -302,7 +302,7 @@ namespace Org.OpenAPITools.IApi /// Form parameter enum test (string) (optional, default to -efg) /// Cancellation Token to cancel the request. /// Task<ApiResponse<object>> - Task> TestEnumParametersAsync(List? enumHeaderStringArray = null, List? enumQueryStringArray = null, double? enumQueryDouble = null, int? enumQueryInteger = null, List? enumFormStringArray = null, string? enumHeaderString = null, string? enumQueryString = null, string? enumFormString = null, System.Threading.CancellationToken cancellationToken = default); + Task> TestEnumParametersAsync(Option> enumHeaderStringArray = default, Option> enumQueryStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option enumQueryString = default, Option enumFormString = default, System.Threading.CancellationToken cancellationToken = default); /// /// To test enum parameters @@ -320,7 +320,7 @@ namespace Org.OpenAPITools.IApi /// Form parameter enum test (string) (optional, default to -efg) /// Cancellation Token to cancel the request. /// Task<ApiResponse>object>?> - Task?> TestEnumParametersOrDefaultAsync(List? enumHeaderStringArray = null, List? enumQueryStringArray = null, double? enumQueryDouble = null, int? enumQueryInteger = null, List? enumFormStringArray = null, string? enumHeaderString = null, string? enumQueryString = null, string? enumFormString = null, System.Threading.CancellationToken cancellationToken = default); + Task?> TestEnumParametersOrDefaultAsync(Option> enumHeaderStringArray = default, Option> enumQueryStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option enumQueryString = default, Option enumFormString = default, System.Threading.CancellationToken cancellationToken = default); /// /// Fake endpoint to test group parameters (optional) @@ -337,7 +337,7 @@ namespace Org.OpenAPITools.IApi /// Integer in group parameters (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<object>> - Task> TestGroupParametersAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup = null, int? stringGroup = null, long? int64Group = null, System.Threading.CancellationToken cancellationToken = default); + Task> TestGroupParametersAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup = default, Option stringGroup = default, Option int64Group = default, System.Threading.CancellationToken cancellationToken = default); /// /// Fake endpoint to test group parameters (optional) @@ -353,7 +353,7 @@ namespace Org.OpenAPITools.IApi /// Integer in group parameters (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>object>?> - Task?> TestGroupParametersOrDefaultAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup = null, int? stringGroup = null, long? int64Group = null, System.Threading.CancellationToken cancellationToken = default); + Task?> TestGroupParametersOrDefaultAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup = default, Option stringGroup = default, Option int64Group = default, System.Threading.CancellationToken cancellationToken = default); /// /// test inline additionalProperties @@ -415,9 +415,13 @@ namespace Org.OpenAPITools.IApi /// /// /// + /// + /// + /// (optional) + /// (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<object>> - Task> TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, System.Threading.CancellationToken cancellationToken = default); + Task> TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string? requiredNullable = default, Option notRequiredNotNullable = default, Option notRequiredNullable = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -430,9 +434,13 @@ namespace Org.OpenAPITools.IApi /// /// /// + /// + /// + /// (optional) + /// (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>object>?> - Task?> TestQueryParameterCollectionFormatOrDefaultAsync(List pipe, List ioutil, List http, List url, List context, System.Threading.CancellationToken cancellationToken = default); + Task?> TestQueryParameterCollectionFormatOrDefaultAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string? requiredNullable = default, Option notRequiredNotNullable = default, Option notRequiredNullable = default, System.Threading.CancellationToken cancellationToken = default); } } @@ -610,31 +618,14 @@ namespace Org.OpenAPITools.Api } } - partial void FormatFakeOuterBooleanSerialize(ref bool? body); - - /// - /// Validates the request parameters - /// - /// - /// - private void ValidateFakeOuterBooleanSerialize(bool? body) - { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (body == null) - throw new ArgumentNullException(nameof(body)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - } + partial void FormatFakeOuterBooleanSerialize(ref Option body); /// /// Processes the server response /// /// /// - private void AfterFakeOuterBooleanSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, bool? body) + private void AfterFakeOuterBooleanSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, Option body) { bool suppressDefaultLog = false; AfterFakeOuterBooleanSerialize(ref suppressDefaultLog, apiResponseLocalVar, body); @@ -648,7 +639,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterFakeOuterBooleanSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, bool? body); + partial void AfterFakeOuterBooleanSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, Option body); /// /// Logs exceptions that occur while retrieving the server response @@ -657,7 +648,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorFakeOuterBooleanSerializeDefaultImplementation(Exception exception, string pathFormat, string path, bool? body) + private void OnErrorFakeOuterBooleanSerializeDefaultImplementation(Exception exception, string pathFormat, string path, Option body) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorFakeOuterBooleanSerialize(exception, pathFormat, path, body); @@ -670,7 +661,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorFakeOuterBooleanSerialize(Exception exception, string pathFormat, string path, bool? body); + partial void OnErrorFakeOuterBooleanSerialize(Exception exception, string pathFormat, string path, Option body); /// /// Test serialization of outer boolean types @@ -678,7 +669,7 @@ namespace Org.OpenAPITools.Api /// Input boolean as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task?> FakeOuterBooleanSerializeOrDefaultAsync(bool? body = null, System.Threading.CancellationToken cancellationToken = default) + public async Task?> FakeOuterBooleanSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -697,14 +688,12 @@ namespace Org.OpenAPITools.Api /// Input boolean as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> FakeOuterBooleanSerializeAsync(bool? body = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> FakeOuterBooleanSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateFakeOuterBooleanSerialize(body); - FormatFakeOuterBooleanSerialize(ref body); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -714,9 +703,10 @@ namespace Org.OpenAPITools.Api uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/boolean"; - httpRequestMessageLocalVar.Content = (body as object) is System.IO.Stream stream - ? httpRequestMessageLocalVar.Content = new StreamContent(stream) - : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body, _jsonSerializerOptions)); + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; @@ -726,7 +716,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { @@ -761,23 +751,17 @@ namespace Org.OpenAPITools.Api } } - partial void FormatFakeOuterCompositeSerialize(OuterComposite? outerComposite); + partial void FormatFakeOuterCompositeSerialize(Option outerComposite); /// /// Validates the request parameters /// /// /// - private void ValidateFakeOuterCompositeSerialize(OuterComposite? outerComposite) + private void ValidateFakeOuterCompositeSerialize(Option outerComposite) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (outerComposite == null) + if (outerComposite.IsSet && outerComposite.Value == null) throw new ArgumentNullException(nameof(outerComposite)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -785,7 +769,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterFakeOuterCompositeSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, OuterComposite? outerComposite) + private void AfterFakeOuterCompositeSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, Option outerComposite) { bool suppressDefaultLog = false; AfterFakeOuterCompositeSerialize(ref suppressDefaultLog, apiResponseLocalVar, outerComposite); @@ -799,7 +783,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterFakeOuterCompositeSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, OuterComposite? outerComposite); + partial void AfterFakeOuterCompositeSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, Option outerComposite); /// /// Logs exceptions that occur while retrieving the server response @@ -808,7 +792,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorFakeOuterCompositeSerializeDefaultImplementation(Exception exception, string pathFormat, string path, OuterComposite? outerComposite) + private void OnErrorFakeOuterCompositeSerializeDefaultImplementation(Exception exception, string pathFormat, string path, Option outerComposite) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorFakeOuterCompositeSerialize(exception, pathFormat, path, outerComposite); @@ -821,7 +805,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorFakeOuterCompositeSerialize(Exception exception, string pathFormat, string path, OuterComposite? outerComposite); + partial void OnErrorFakeOuterCompositeSerialize(Exception exception, string pathFormat, string path, Option outerComposite); /// /// Test serialization of object with outer number type @@ -829,7 +813,7 @@ namespace Org.OpenAPITools.Api /// Input composite as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task?> FakeOuterCompositeSerializeOrDefaultAsync(OuterComposite? outerComposite = null, System.Threading.CancellationToken cancellationToken = default) + public async Task?> FakeOuterCompositeSerializeOrDefaultAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -848,7 +832,7 @@ namespace Org.OpenAPITools.Api /// Input composite as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> FakeOuterCompositeSerializeAsync(OuterComposite? outerComposite = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> FakeOuterCompositeSerializeAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); @@ -865,9 +849,10 @@ namespace Org.OpenAPITools.Api uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/composite"; - httpRequestMessageLocalVar.Content = (outerComposite as object) is System.IO.Stream stream - ? httpRequestMessageLocalVar.Content = new StreamContent(stream) - : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(outerComposite, _jsonSerializerOptions)); + if (outerComposite.IsSet) + httpRequestMessageLocalVar.Content = (outerComposite.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(outerComposite.Value, _jsonSerializerOptions)); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; @@ -877,7 +862,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { @@ -912,31 +897,14 @@ namespace Org.OpenAPITools.Api } } - partial void FormatFakeOuterNumberSerialize(ref decimal? body); - - /// - /// Validates the request parameters - /// - /// - /// - private void ValidateFakeOuterNumberSerialize(decimal? body) - { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (body == null) - throw new ArgumentNullException(nameof(body)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - } + partial void FormatFakeOuterNumberSerialize(ref Option body); /// /// Processes the server response /// /// /// - private void AfterFakeOuterNumberSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, decimal? body) + private void AfterFakeOuterNumberSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, Option body) { bool suppressDefaultLog = false; AfterFakeOuterNumberSerialize(ref suppressDefaultLog, apiResponseLocalVar, body); @@ -950,7 +918,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterFakeOuterNumberSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, decimal? body); + partial void AfterFakeOuterNumberSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, Option body); /// /// Logs exceptions that occur while retrieving the server response @@ -959,7 +927,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorFakeOuterNumberSerializeDefaultImplementation(Exception exception, string pathFormat, string path, decimal? body) + private void OnErrorFakeOuterNumberSerializeDefaultImplementation(Exception exception, string pathFormat, string path, Option body) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorFakeOuterNumberSerialize(exception, pathFormat, path, body); @@ -972,7 +940,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorFakeOuterNumberSerialize(Exception exception, string pathFormat, string path, decimal? body); + partial void OnErrorFakeOuterNumberSerialize(Exception exception, string pathFormat, string path, Option body); /// /// Test serialization of outer number types @@ -980,7 +948,7 @@ namespace Org.OpenAPITools.Api /// Input number as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task?> FakeOuterNumberSerializeOrDefaultAsync(decimal? body = null, System.Threading.CancellationToken cancellationToken = default) + public async Task?> FakeOuterNumberSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -999,14 +967,12 @@ namespace Org.OpenAPITools.Api /// Input number as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> FakeOuterNumberSerializeAsync(decimal? body = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> FakeOuterNumberSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateFakeOuterNumberSerialize(body); - FormatFakeOuterNumberSerialize(ref body); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -1016,9 +982,10 @@ namespace Org.OpenAPITools.Api uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/number"; - httpRequestMessageLocalVar.Content = (body as object) is System.IO.Stream stream - ? httpRequestMessageLocalVar.Content = new StreamContent(stream) - : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body, _jsonSerializerOptions)); + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; @@ -1028,7 +995,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { @@ -1063,27 +1030,17 @@ namespace Org.OpenAPITools.Api } } - partial void FormatFakeOuterStringSerialize(ref Guid requiredStringUuid, ref string? body); + partial void FormatFakeOuterStringSerialize(ref Guid requiredStringUuid, ref Option body); /// /// Validates the request parameters /// - /// /// /// - private void ValidateFakeOuterStringSerialize(Guid requiredStringUuid, string? body) + private void ValidateFakeOuterStringSerialize(Option body) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (requiredStringUuid == null) - throw new ArgumentNullException(nameof(requiredStringUuid)); - - if (body == null) + if (body.IsSet && body.Value == null) throw new ArgumentNullException(nameof(body)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1092,7 +1049,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterFakeOuterStringSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, Guid requiredStringUuid, string? body) + private void AfterFakeOuterStringSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, Guid requiredStringUuid, Option body) { bool suppressDefaultLog = false; AfterFakeOuterStringSerialize(ref suppressDefaultLog, apiResponseLocalVar, requiredStringUuid, body); @@ -1107,7 +1064,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterFakeOuterStringSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, Guid requiredStringUuid, string? body); + partial void AfterFakeOuterStringSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, Guid requiredStringUuid, Option body); /// /// Logs exceptions that occur while retrieving the server response @@ -1117,7 +1074,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorFakeOuterStringSerializeDefaultImplementation(Exception exception, string pathFormat, string path, Guid requiredStringUuid, string? body) + private void OnErrorFakeOuterStringSerializeDefaultImplementation(Exception exception, string pathFormat, string path, Guid requiredStringUuid, Option body) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorFakeOuterStringSerialize(exception, pathFormat, path, requiredStringUuid, body); @@ -1131,7 +1088,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorFakeOuterStringSerialize(Exception exception, string pathFormat, string path, Guid requiredStringUuid, string? body); + partial void OnErrorFakeOuterStringSerialize(Exception exception, string pathFormat, string path, Guid requiredStringUuid, Option body); /// /// Test serialization of outer string types @@ -1140,7 +1097,7 @@ namespace Org.OpenAPITools.Api /// Input string as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task?> FakeOuterStringSerializeOrDefaultAsync(Guid requiredStringUuid, string? body = null, System.Threading.CancellationToken cancellationToken = default) + public async Task?> FakeOuterStringSerializeOrDefaultAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -1160,13 +1117,13 @@ namespace Org.OpenAPITools.Api /// Input string as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> FakeOuterStringSerializeAsync(Guid requiredStringUuid, string? body = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> FakeOuterStringSerializeAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateFakeOuterStringSerialize(requiredStringUuid, body); + ValidateFakeOuterStringSerialize(body); FormatFakeOuterStringSerialize(ref requiredStringUuid, ref body); @@ -1183,9 +1140,10 @@ namespace Org.OpenAPITools.Api uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); - httpRequestMessageLocalVar.Content = (body as object) is System.IO.Stream stream - ? httpRequestMessageLocalVar.Content = new StreamContent(stream) - : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body, _jsonSerializerOptions)); + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; @@ -1195,7 +1153,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { @@ -1348,14 +1306,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateTestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (fileSchemaTestClass == null) throw new ArgumentNullException(nameof(fileSchemaTestClass)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1455,7 +1407,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Put; @@ -1486,22 +1438,16 @@ namespace Org.OpenAPITools.Api /// /// Validates the request parameters /// - /// /// + /// /// - private void ValidateTestBodyWithQueryParams(User user, string query) + private void ValidateTestBodyWithQueryParams(string query, User user) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (user == null) - throw new ArgumentNullException(nameof(user)); - if (query == null) throw new ArgumentNullException(nameof(query)); - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + if (user == null) + throw new ArgumentNullException(nameof(user)); } /// @@ -1584,7 +1530,7 @@ namespace Org.OpenAPITools.Api try { - ValidateTestBodyWithQueryParams(user, query); + ValidateTestBodyWithQueryParams(query, user); FormatTestBodyWithQueryParams(user, ref query); @@ -1613,7 +1559,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Put; @@ -1648,14 +1594,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateTestClientModel(ModelClient modelClient) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (modelClient == null) throw new ArgumentNullException(nameof(modelClient)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1755,7 +1695,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { @@ -1790,75 +1730,37 @@ namespace Org.OpenAPITools.Api } } - partial void FormatTestEndpointParameters(ref byte[] varByte, ref decimal number, ref double varDouble, ref string patternWithoutDelimiter, ref DateTime? date, ref System.IO.Stream? binary, ref float? varFloat, ref int? integer, ref int? int32, ref long? int64, ref string? varString, ref string? password, ref string? callback, ref DateTime? dateTime); + partial void FormatTestEndpointParameters(ref byte[] varByte, ref decimal number, ref double varDouble, ref string patternWithoutDelimiter, ref Option date, ref Option binary, ref Option varFloat, ref Option integer, ref Option int32, ref Option int64, ref Option varString, ref Option password, ref Option callback, ref Option dateTime); /// /// Validates the request parameters /// /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// /// - /// + /// + /// + /// + /// /// - private void ValidateTestEndpointParameters(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date, System.IO.Stream? binary, float? varFloat, int? integer, int? int32, long? int64, string? varString, string? password, string? callback, DateTime? dateTime) + private void ValidateTestEndpointParameters(byte[] varByte, Option callback, Option binary, Option password, string patternWithoutDelimiter, Option varString) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (varByte == null) throw new ArgumentNullException(nameof(varByte)); - if (number == null) - throw new ArgumentNullException(nameof(number)); + if (callback.IsSet && callback.Value == null) + throw new ArgumentNullException(nameof(callback)); - if (varDouble == null) - throw new ArgumentNullException(nameof(varDouble)); + if (binary.IsSet && binary.Value == null) + throw new ArgumentNullException(nameof(binary)); + + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password)); if (patternWithoutDelimiter == null) throw new ArgumentNullException(nameof(patternWithoutDelimiter)); - if (date == null) - throw new ArgumentNullException(nameof(date)); - - if (binary == null) - throw new ArgumentNullException(nameof(binary)); - - if (varFloat == null) - throw new ArgumentNullException(nameof(varFloat)); - - if (integer == null) - throw new ArgumentNullException(nameof(integer)); - - if (int32 == null) - throw new ArgumentNullException(nameof(int32)); - - if (int64 == null) - throw new ArgumentNullException(nameof(int64)); - - if (varString == null) + if (varString.IsSet && varString.Value == null) throw new ArgumentNullException(nameof(varString)); - - if (password == null) - throw new ArgumentNullException(nameof(password)); - - if (callback == null) - throw new ArgumentNullException(nameof(callback)); - - if (dateTime == null) - throw new ArgumentNullException(nameof(dateTime)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1879,7 +1781,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterTestEndpointParametersDefaultImplementation(ApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date, System.IO.Stream? binary, float? varFloat, int? integer, int? int32, long? int64, string? varString, string? password, string? callback, DateTime? dateTime) + private void AfterTestEndpointParametersDefaultImplementation(ApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date, Option binary, Option varFloat, Option integer, Option int32, Option int64, Option varString, Option password, Option callback, Option dateTime) { bool suppressDefaultLog = false; AfterTestEndpointParameters(ref suppressDefaultLog, apiResponseLocalVar, varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime); @@ -1906,7 +1808,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterTestEndpointParameters(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date, System.IO.Stream? binary, float? varFloat, int? integer, int? int32, long? int64, string? varString, string? password, string? callback, DateTime? dateTime); + partial void AfterTestEndpointParameters(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date, Option binary, Option varFloat, Option integer, Option int32, Option int64, Option varString, Option password, Option callback, Option dateTime); /// /// Logs exceptions that occur while retrieving the server response @@ -1928,7 +1830,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorTestEndpointParametersDefaultImplementation(Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date, System.IO.Stream? binary, float? varFloat, int? integer, int? int32, long? int64, string? varString, string? password, string? callback, DateTime? dateTime) + private void OnErrorTestEndpointParametersDefaultImplementation(Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date, Option binary, Option varFloat, Option integer, Option int32, Option int64, Option varString, Option password, Option callback, Option dateTime) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorTestEndpointParameters(exception, pathFormat, path, varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime); @@ -1954,7 +1856,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorTestEndpointParameters(Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date, System.IO.Stream? binary, float? varFloat, int? integer, int? int32, long? int64, string? varString, string? password, string? callback, DateTime? dateTime); + partial void OnErrorTestEndpointParameters(Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date, Option binary, Option varFloat, Option integer, Option int32, Option int64, Option varString, Option password, Option callback, Option dateTime); /// /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -1975,7 +1877,7 @@ namespace Org.OpenAPITools.Api /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") /// Cancellation Token to cancel the request. /// <> where T : - public async Task?> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date = null, System.IO.Stream? binary = null, float? varFloat = null, int? integer = null, int? int32 = null, long? int64 = null, string? varString = null, string? password = null, string? callback = null, DateTime? dateTime = null, System.Threading.CancellationToken cancellationToken = default) + public async Task?> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date = default, Option binary = default, Option varFloat = default, Option integer = default, Option int32 = default, Option int64 = default, Option varString = default, Option password = default, Option callback = default, Option dateTime = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -2007,13 +1909,13 @@ namespace Org.OpenAPITools.Api /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") /// Cancellation Token to cancel the request. /// <> where T : - public async Task> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date = null, System.IO.Stream? binary = null, float? varFloat = null, int? integer = null, int? int32 = null, long? int64 = null, string? varString = null, string? password = null, string? callback = null, DateTime? dateTime = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date = default, Option binary = default, Option varFloat = default, Option integer = default, Option int32 = default, Option int64 = default, Option varString = default, Option password = default, Option callback = default, Option dateTime = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateTestEndpointParameters(varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime); + ValidateTestEndpointParameters(varByte, callback, binary, password, patternWithoutDelimiter, varString); FormatTestEndpointParameters(ref varByte, ref number, ref varDouble, ref patternWithoutDelimiter, ref date, ref binary, ref varFloat, ref integer, ref int32, ref int64, ref varString, ref password, ref callback, ref dateTime); @@ -2040,35 +1942,35 @@ namespace Org.OpenAPITools.Api formParameterLocalVars.Add(new KeyValuePair("pattern_without_delimiter", ClientUtils.ParameterToString(patternWithoutDelimiter))); - if (date != null) - formParameterLocalVars.Add(new KeyValuePair("date", ClientUtils.ParameterToString(date))); + if (date.IsSet) + formParameterLocalVars.Add(new KeyValuePair("date", ClientUtils.ParameterToString(date.Value))); - if (binary != null) - multipartContentLocalVar.Add(new StreamContent(binary)); + if (binary.IsSet) + multipartContentLocalVar.Add(new StreamContent(binary.Value)); - if (varFloat != null) - formParameterLocalVars.Add(new KeyValuePair("float", ClientUtils.ParameterToString(varFloat))); + if (varFloat.IsSet) + formParameterLocalVars.Add(new KeyValuePair("float", ClientUtils.ParameterToString(varFloat.Value))); - if (integer != null) - formParameterLocalVars.Add(new KeyValuePair("integer", ClientUtils.ParameterToString(integer))); + if (integer.IsSet) + formParameterLocalVars.Add(new KeyValuePair("integer", ClientUtils.ParameterToString(integer.Value))); - if (int32 != null) - formParameterLocalVars.Add(new KeyValuePair("int32", ClientUtils.ParameterToString(int32))); + if (int32.IsSet) + formParameterLocalVars.Add(new KeyValuePair("int32", ClientUtils.ParameterToString(int32.Value))); - if (int64 != null) - formParameterLocalVars.Add(new KeyValuePair("int64", ClientUtils.ParameterToString(int64))); + if (int64.IsSet) + formParameterLocalVars.Add(new KeyValuePair("int64", ClientUtils.ParameterToString(int64.Value))); - if (varString != null) - formParameterLocalVars.Add(new KeyValuePair("string", ClientUtils.ParameterToString(varString))); + if (varString.IsSet) + formParameterLocalVars.Add(new KeyValuePair("string", ClientUtils.ParameterToString(varString.Value))); - if (password != null) - formParameterLocalVars.Add(new KeyValuePair("password", ClientUtils.ParameterToString(password))); + if (password.IsSet) + formParameterLocalVars.Add(new KeyValuePair("password", ClientUtils.ParameterToString(password.Value))); - if (callback != null) - formParameterLocalVars.Add(new KeyValuePair("callback", ClientUtils.ParameterToString(callback))); + if (callback.IsSet) + formParameterLocalVars.Add(new KeyValuePair("callback", ClientUtils.ParameterToString(callback.Value))); - if (dateTime != null) - formParameterLocalVars.Add(new KeyValuePair("dateTime", ClientUtils.ParameterToString(dateTime))); + if (dateTime.IsSet) + formParameterLocalVars.Add(new KeyValuePair("dateTime", ClientUtils.ParameterToString(dateTime.Value))); List tokenBaseLocalVars = new List(); @@ -2086,7 +1988,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Post; @@ -2116,51 +2018,37 @@ namespace Org.OpenAPITools.Api } } - partial void FormatTestEnumParameters(List? enumHeaderStringArray, List? enumQueryStringArray, ref double? enumQueryDouble, ref int? enumQueryInteger, List? enumFormStringArray, ref string? enumHeaderString, ref string? enumQueryString, ref string? enumFormString); + partial void FormatTestEnumParameters(Option> enumHeaderStringArray, Option> enumQueryStringArray, ref Option enumQueryDouble, ref Option enumQueryInteger, Option> enumFormStringArray, ref Option enumHeaderString, ref Option enumQueryString, ref Option enumFormString); /// /// Validates the request parameters /// + /// /// /// - /// - /// /// - /// - /// /// + /// /// - private void ValidateTestEnumParameters(List? enumHeaderStringArray, List? enumQueryStringArray, double? enumQueryDouble, int? enumQueryInteger, List? enumFormStringArray, string? enumHeaderString, string? enumQueryString, string? enumFormString) + private void ValidateTestEnumParameters(Option enumHeaderString, Option> enumHeaderStringArray, Option> enumQueryStringArray, Option> enumFormStringArray, Option enumFormString, Option enumQueryString) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (enumHeaderStringArray == null) - throw new ArgumentNullException(nameof(enumHeaderStringArray)); - - if (enumQueryStringArray == null) - throw new ArgumentNullException(nameof(enumQueryStringArray)); - - if (enumQueryDouble == null) - throw new ArgumentNullException(nameof(enumQueryDouble)); - - if (enumQueryInteger == null) - throw new ArgumentNullException(nameof(enumQueryInteger)); - - if (enumFormStringArray == null) - throw new ArgumentNullException(nameof(enumFormStringArray)); - - if (enumHeaderString == null) + if (enumHeaderString.IsSet && enumHeaderString.Value == null) throw new ArgumentNullException(nameof(enumHeaderString)); - if (enumQueryString == null) - throw new ArgumentNullException(nameof(enumQueryString)); + if (enumHeaderStringArray.IsSet && enumHeaderStringArray.Value == null) + throw new ArgumentNullException(nameof(enumHeaderStringArray)); - if (enumFormString == null) + if (enumQueryStringArray.IsSet && enumQueryStringArray.Value == null) + throw new ArgumentNullException(nameof(enumQueryStringArray)); + + if (enumFormStringArray.IsSet && enumFormStringArray.Value == null) + throw new ArgumentNullException(nameof(enumFormStringArray)); + + if (enumFormString.IsSet && enumFormString.Value == null) throw new ArgumentNullException(nameof(enumFormString)); - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + if (enumQueryString.IsSet && enumQueryString.Value == null) + throw new ArgumentNullException(nameof(enumQueryString)); } /// @@ -2175,7 +2063,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterTestEnumParametersDefaultImplementation(ApiResponse apiResponseLocalVar, List? enumHeaderStringArray, List? enumQueryStringArray, double? enumQueryDouble, int? enumQueryInteger, List? enumFormStringArray, string? enumHeaderString, string? enumQueryString, string? enumFormString) + private void AfterTestEnumParametersDefaultImplementation(ApiResponse apiResponseLocalVar, Option> enumHeaderStringArray, Option> enumQueryStringArray, Option enumQueryDouble, Option enumQueryInteger, Option> enumFormStringArray, Option enumHeaderString, Option enumQueryString, Option enumFormString) { bool suppressDefaultLog = false; AfterTestEnumParameters(ref suppressDefaultLog, apiResponseLocalVar, enumHeaderStringArray, enumQueryStringArray, enumQueryDouble, enumQueryInteger, enumFormStringArray, enumHeaderString, enumQueryString, enumFormString); @@ -2196,7 +2084,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterTestEnumParameters(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, List? enumHeaderStringArray, List? enumQueryStringArray, double? enumQueryDouble, int? enumQueryInteger, List? enumFormStringArray, string? enumHeaderString, string? enumQueryString, string? enumFormString); + partial void AfterTestEnumParameters(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, Option> enumHeaderStringArray, Option> enumQueryStringArray, Option enumQueryDouble, Option enumQueryInteger, Option> enumFormStringArray, Option enumHeaderString, Option enumQueryString, Option enumFormString); /// /// Logs exceptions that occur while retrieving the server response @@ -2212,7 +2100,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorTestEnumParametersDefaultImplementation(Exception exception, string pathFormat, string path, List? enumHeaderStringArray, List? enumQueryStringArray, double? enumQueryDouble, int? enumQueryInteger, List? enumFormStringArray, string? enumHeaderString, string? enumQueryString, string? enumFormString) + private void OnErrorTestEnumParametersDefaultImplementation(Exception exception, string pathFormat, string path, Option> enumHeaderStringArray, Option> enumQueryStringArray, Option enumQueryDouble, Option enumQueryInteger, Option> enumFormStringArray, Option enumHeaderString, Option enumQueryString, Option enumFormString) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorTestEnumParameters(exception, pathFormat, path, enumHeaderStringArray, enumQueryStringArray, enumQueryDouble, enumQueryInteger, enumFormStringArray, enumHeaderString, enumQueryString, enumFormString); @@ -2232,7 +2120,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorTestEnumParameters(Exception exception, string pathFormat, string path, List? enumHeaderStringArray, List? enumQueryStringArray, double? enumQueryDouble, int? enumQueryInteger, List? enumFormStringArray, string? enumHeaderString, string? enumQueryString, string? enumFormString); + partial void OnErrorTestEnumParameters(Exception exception, string pathFormat, string path, Option> enumHeaderStringArray, Option> enumQueryStringArray, Option enumQueryDouble, Option enumQueryInteger, Option> enumFormStringArray, Option enumHeaderString, Option enumQueryString, Option enumFormString); /// /// To test enum parameters To test enum parameters @@ -2247,7 +2135,7 @@ namespace Org.OpenAPITools.Api /// Form parameter enum test (string) (optional, default to -efg) /// Cancellation Token to cancel the request. /// <> where T : - public async Task?> TestEnumParametersOrDefaultAsync(List? enumHeaderStringArray = null, List? enumQueryStringArray = null, double? enumQueryDouble = null, int? enumQueryInteger = null, List? enumFormStringArray = null, string? enumHeaderString = null, string? enumQueryString = null, string? enumFormString = null, System.Threading.CancellationToken cancellationToken = default) + public async Task?> TestEnumParametersOrDefaultAsync(Option> enumHeaderStringArray = default, Option> enumQueryStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option enumQueryString = default, Option enumFormString = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -2273,13 +2161,13 @@ namespace Org.OpenAPITools.Api /// Form parameter enum test (string) (optional, default to -efg) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> TestEnumParametersAsync(List? enumHeaderStringArray = null, List? enumQueryStringArray = null, double? enumQueryDouble = null, int? enumQueryInteger = null, List? enumFormStringArray = null, string? enumHeaderString = null, string? enumQueryString = null, string? enumFormString = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> TestEnumParametersAsync(Option> enumHeaderStringArray = default, Option> enumQueryStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option enumQueryString = default, Option enumFormString = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateTestEnumParameters(enumHeaderStringArray, enumQueryStringArray, enumQueryDouble, enumQueryInteger, enumFormStringArray, enumHeaderString, enumQueryString, enumFormString); + ValidateTestEnumParameters(enumHeaderString, enumHeaderStringArray, enumQueryStringArray, enumFormStringArray, enumFormString, enumQueryString); FormatTestEnumParameters(enumHeaderStringArray, enumQueryStringArray, ref enumQueryDouble, ref enumQueryInteger, enumFormStringArray, ref enumHeaderString, ref enumQueryString, ref enumFormString); @@ -2292,25 +2180,25 @@ namespace Org.OpenAPITools.Api System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); - if (enumQueryStringArray != null) - parseQueryStringLocalVar["enum_query_string_array"] = enumQueryStringArray.ToString(); + if (enumQueryStringArray.IsSet) + parseQueryStringLocalVar["enum_query_string_array"] = enumQueryStringArray.Value.ToString(); - if (enumQueryDouble != null) - parseQueryStringLocalVar["enum_query_double"] = enumQueryDouble.ToString(); + if (enumQueryDouble.IsSet) + parseQueryStringLocalVar["enum_query_double"] = enumQueryDouble.Value.ToString(); - if (enumQueryInteger != null) - parseQueryStringLocalVar["enum_query_integer"] = enumQueryInteger.ToString(); + if (enumQueryInteger.IsSet) + parseQueryStringLocalVar["enum_query_integer"] = enumQueryInteger.Value.ToString(); - if (enumQueryString != null) - parseQueryStringLocalVar["enum_query_string"] = enumQueryString.ToString(); + if (enumQueryString.IsSet) + parseQueryStringLocalVar["enum_query_string"] = enumQueryString.Value.ToString(); uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); - if (enumHeaderStringArray != null) - httpRequestMessageLocalVar.Headers.Add("enum_header_string_array", ClientUtils.ParameterToString(enumHeaderStringArray)); + if (enumHeaderStringArray.IsSet) + httpRequestMessageLocalVar.Headers.Add("enum_header_string_array", ClientUtils.ParameterToString(enumHeaderStringArray.Value)); - if (enumHeaderString != null) - httpRequestMessageLocalVar.Headers.Add("enum_header_string", ClientUtils.ParameterToString(enumHeaderString)); + if (enumHeaderString.IsSet) + httpRequestMessageLocalVar.Headers.Add("enum_header_string", ClientUtils.ParameterToString(enumHeaderString.Value)); MultipartContent multipartContentLocalVar = new MultipartContent(); @@ -2318,11 +2206,11 @@ namespace Org.OpenAPITools.Api List> formParameterLocalVars = new List>(); - multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (enumFormStringArray != null) - formParameterLocalVars.Add(new KeyValuePair("enum_form_string_array", ClientUtils.ParameterToString(enumFormStringArray))); + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (enumFormStringArray.IsSet) + formParameterLocalVars.Add(new KeyValuePair("enum_form_string_array", ClientUtils.ParameterToString(enumFormStringArray.Value))); - if (enumFormString != null) - formParameterLocalVars.Add(new KeyValuePair("enum_form_string", ClientUtils.ParameterToString(enumFormString))); + if (enumFormString.IsSet) + formParameterLocalVars.Add(new KeyValuePair("enum_form_string", ClientUtils.ParameterToString(enumFormString.Value))); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; @@ -2332,7 +2220,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Get; @@ -2358,44 +2246,7 @@ namespace Org.OpenAPITools.Api } } - partial void FormatTestGroupParameters(ref bool requiredBooleanGroup, ref int requiredStringGroup, ref long requiredInt64Group, ref bool? booleanGroup, ref int? stringGroup, ref long? int64Group); - - /// - /// Validates the request parameters - /// - /// - /// - /// - /// - /// - /// - /// - private void ValidateTestGroupParameters(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup, int? stringGroup, long? int64Group) - { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (requiredBooleanGroup == null) - throw new ArgumentNullException(nameof(requiredBooleanGroup)); - - if (requiredStringGroup == null) - throw new ArgumentNullException(nameof(requiredStringGroup)); - - if (requiredInt64Group == null) - throw new ArgumentNullException(nameof(requiredInt64Group)); - - if (booleanGroup == null) - throw new ArgumentNullException(nameof(booleanGroup)); - - if (stringGroup == null) - throw new ArgumentNullException(nameof(stringGroup)); - - if (int64Group == null) - throw new ArgumentNullException(nameof(int64Group)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - } + partial void FormatTestGroupParameters(ref bool requiredBooleanGroup, ref int requiredStringGroup, ref long requiredInt64Group, ref Option booleanGroup, ref Option stringGroup, ref Option int64Group); /// /// Processes the server response @@ -2407,7 +2258,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterTestGroupParametersDefaultImplementation(ApiResponse apiResponseLocalVar, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup, int? stringGroup, long? int64Group) + private void AfterTestGroupParametersDefaultImplementation(ApiResponse apiResponseLocalVar, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup, Option stringGroup, Option int64Group) { bool suppressDefaultLog = false; AfterTestGroupParameters(ref suppressDefaultLog, apiResponseLocalVar, requiredBooleanGroup, requiredStringGroup, requiredInt64Group, booleanGroup, stringGroup, int64Group); @@ -2426,7 +2277,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterTestGroupParameters(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup, int? stringGroup, long? int64Group); + partial void AfterTestGroupParameters(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup, Option stringGroup, Option int64Group); /// /// Logs exceptions that occur while retrieving the server response @@ -2440,7 +2291,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorTestGroupParametersDefaultImplementation(Exception exception, string pathFormat, string path, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup, int? stringGroup, long? int64Group) + private void OnErrorTestGroupParametersDefaultImplementation(Exception exception, string pathFormat, string path, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup, Option stringGroup, Option int64Group) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorTestGroupParameters(exception, pathFormat, path, requiredBooleanGroup, requiredStringGroup, requiredInt64Group, booleanGroup, stringGroup, int64Group); @@ -2458,7 +2309,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorTestGroupParameters(Exception exception, string pathFormat, string path, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup, int? stringGroup, long? int64Group); + partial void OnErrorTestGroupParameters(Exception exception, string pathFormat, string path, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup, Option stringGroup, Option int64Group); /// /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) @@ -2471,7 +2322,7 @@ namespace Org.OpenAPITools.Api /// Integer in group parameters (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task?> TestGroupParametersOrDefaultAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup = null, int? stringGroup = null, long? int64Group = null, System.Threading.CancellationToken cancellationToken = default) + public async Task?> TestGroupParametersOrDefaultAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup = default, Option stringGroup = default, Option int64Group = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -2495,14 +2346,12 @@ namespace Org.OpenAPITools.Api /// Integer in group parameters (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> TestGroupParametersAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup = null, int? stringGroup = null, long? int64Group = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> TestGroupParametersAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup = default, Option stringGroup = default, Option int64Group = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateTestGroupParameters(requiredBooleanGroup, requiredStringGroup, requiredInt64Group, booleanGroup, stringGroup, int64Group); - FormatTestGroupParameters(ref requiredBooleanGroup, ref requiredStringGroup, ref requiredInt64Group, ref booleanGroup, ref stringGroup, ref int64Group); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -2517,18 +2366,18 @@ namespace Org.OpenAPITools.Api parseQueryStringLocalVar["required_string_group"] = requiredStringGroup.ToString(); parseQueryStringLocalVar["required_int64_group"] = requiredInt64Group.ToString(); - if (stringGroup != null) - parseQueryStringLocalVar["string_group"] = stringGroup.ToString(); + if (stringGroup.IsSet) + parseQueryStringLocalVar["string_group"] = stringGroup.Value.ToString(); - if (int64Group != null) - parseQueryStringLocalVar["int64_group"] = int64Group.ToString(); + if (int64Group.IsSet) + parseQueryStringLocalVar["int64_group"] = int64Group.Value.ToString(); uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); httpRequestMessageLocalVar.Headers.Add("required_boolean_group", ClientUtils.ParameterToString(requiredBooleanGroup)); - if (booleanGroup != null) - httpRequestMessageLocalVar.Headers.Add("boolean_group", ClientUtils.ParameterToString(booleanGroup)); + if (booleanGroup.IsSet) + httpRequestMessageLocalVar.Headers.Add("boolean_group", ClientUtils.ParameterToString(booleanGroup.Value)); List tokenBaseLocalVars = new List(); @@ -2576,14 +2425,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateTestInlineAdditionalProperties(Dictionary requestBody) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (requestBody == null) throw new ArgumentNullException(nameof(requestBody)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -2683,7 +2526,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Post; @@ -2719,17 +2562,11 @@ namespace Org.OpenAPITools.Api /// private void ValidateTestJsonFormData(string param, string param2) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (param == null) throw new ArgumentNullException(nameof(param)); if (param2 == null) throw new ArgumentNullException(nameof(param2)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -2843,7 +2680,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Get; @@ -2869,21 +2706,29 @@ namespace Org.OpenAPITools.Api } } - partial void FormatTestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context); + partial void FormatTestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, ref string requiredNotNullable, ref string? requiredNullable, ref Option notRequiredNotNullable, ref Option notRequiredNullable); /// /// Validates the request parameters /// + /// + /// + /// /// /// - /// /// - /// + /// /// - private void ValidateTestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) + private void ValidateTestQueryParameterCollectionFormat(List context, string requiredNotNullable, Option notRequiredNotNullable, List pipe, List ioutil, List url, List http) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + if (context == null) + throw new ArgumentNullException(nameof(context)); + + if (requiredNotNullable == null) + throw new ArgumentNullException(nameof(requiredNotNullable)); + + if (notRequiredNotNullable.IsSet && notRequiredNotNullable.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotNullable)); if (pipe == null) throw new ArgumentNullException(nameof(pipe)); @@ -2891,17 +2736,11 @@ namespace Org.OpenAPITools.Api if (ioutil == null) throw new ArgumentNullException(nameof(ioutil)); - if (http == null) - throw new ArgumentNullException(nameof(http)); - if (url == null) throw new ArgumentNullException(nameof(url)); - if (context == null) - throw new ArgumentNullException(nameof(context)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + if (http == null) + throw new ArgumentNullException(nameof(http)); } /// @@ -2913,10 +2752,14 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterTestQueryParameterCollectionFormatDefaultImplementation(ApiResponse apiResponseLocalVar, List pipe, List ioutil, List http, List url, List context) + /// + /// + /// + /// + private void AfterTestQueryParameterCollectionFormatDefaultImplementation(ApiResponse apiResponseLocalVar, List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string? requiredNullable, Option notRequiredNotNullable, Option notRequiredNullable) { bool suppressDefaultLog = false; - AfterTestQueryParameterCollectionFormat(ref suppressDefaultLog, apiResponseLocalVar, pipe, ioutil, http, url, context); + AfterTestQueryParameterCollectionFormat(ref suppressDefaultLog, apiResponseLocalVar, pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); if (!suppressDefaultLog) Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); } @@ -2931,7 +2774,11 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterTestQueryParameterCollectionFormat(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, List pipe, List ioutil, List http, List url, List context); + /// + /// + /// + /// + partial void AfterTestQueryParameterCollectionFormat(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string? requiredNullable, Option notRequiredNotNullable, Option notRequiredNullable); /// /// Logs exceptions that occur while retrieving the server response @@ -2944,10 +2791,14 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorTestQueryParameterCollectionFormatDefaultImplementation(Exception exception, string pathFormat, string path, List pipe, List ioutil, List http, List url, List context) + /// + /// + /// + /// + private void OnErrorTestQueryParameterCollectionFormatDefaultImplementation(Exception exception, string pathFormat, string path, List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string? requiredNullable, Option notRequiredNotNullable, Option notRequiredNullable) { Logger.LogError(exception, "An error occurred while sending the request to the server."); - OnErrorTestQueryParameterCollectionFormat(exception, pathFormat, path, pipe, ioutil, http, url, context); + OnErrorTestQueryParameterCollectionFormat(exception, pathFormat, path, pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } /// @@ -2961,7 +2812,11 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorTestQueryParameterCollectionFormat(Exception exception, string pathFormat, string path, List pipe, List ioutil, List http, List url, List context); + /// + /// + /// + /// + partial void OnErrorTestQueryParameterCollectionFormat(Exception exception, string pathFormat, string path, List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string? requiredNullable, Option notRequiredNotNullable, Option notRequiredNullable); /// /// To test the collection format in query parameters @@ -2971,13 +2826,17 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task?> TestQueryParameterCollectionFormatOrDefaultAsync(List pipe, List ioutil, List http, List url, List context, System.Threading.CancellationToken cancellationToken = default) + public async Task?> TestQueryParameterCollectionFormatOrDefaultAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string? requiredNullable = default, Option notRequiredNotNullable = default, Option notRequiredNullable = default, System.Threading.CancellationToken cancellationToken = default) { try { - return await TestQueryParameterCollectionFormatAsync(pipe, ioutil, http, url, context, cancellationToken).ConfigureAwait(false); + return await TestQueryParameterCollectionFormatAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable, cancellationToken).ConfigureAwait(false); } catch (Exception) { @@ -2994,17 +2853,21 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, System.Threading.CancellationToken cancellationToken = default) + public async Task> TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string? requiredNullable = default, Option notRequiredNotNullable = default, Option notRequiredNullable = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + ValidateTestQueryParameterCollectionFormat(context, requiredNotNullable, notRequiredNotNullable, pipe, ioutil, url, http); - FormatTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + FormatTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, ref requiredNotNullable, ref requiredNullable, ref notRequiredNotNullable, ref notRequiredNullable); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) { @@ -3020,6 +2883,14 @@ namespace Org.OpenAPITools.Api parseQueryStringLocalVar["http"] = http.ToString(); parseQueryStringLocalVar["url"] = url.ToString(); parseQueryStringLocalVar["context"] = context.ToString(); + parseQueryStringLocalVar["requiredNotNullable"] = requiredNotNullable.ToString(); + parseQueryStringLocalVar["requiredNullable"] = requiredNullable?.ToString(); + + if (notRequiredNotNullable.IsSet) + parseQueryStringLocalVar["notRequiredNotNullable"] = notRequiredNotNullable.Value.ToString(); + + if (notRequiredNullable.IsSet) + parseQueryStringLocalVar["notRequiredNullable"] = notRequiredNullable.Value?.ToString(); uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); @@ -3035,7 +2906,7 @@ namespace Org.OpenAPITools.Api ApiResponse apiResponseLocalVar = new ApiResponse(httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/test-query-parameters", requestedAtLocalVar, _jsonSerializerOptions); - AfterTestQueryParameterCollectionFormatDefaultImplementation(apiResponseLocalVar, pipe, ioutil, http, url, context); + AfterTestQueryParameterCollectionFormatDefaultImplementation(apiResponseLocalVar, pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); return apiResponseLocalVar; } @@ -3043,7 +2914,7 @@ namespace Org.OpenAPITools.Api } catch(Exception e) { - OnErrorTestQueryParameterCollectionFormatDefaultImplementation(e, "/fake/test-query-parameters", uriBuilderLocalVar.Path, pipe, ioutil, http, url, context); + OnErrorTestQueryParameterCollectionFormatDefaultImplementation(e, "/fake/test-query-parameters", uriBuilderLocalVar.Path, pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); throw; } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index 1cb7db1b9bb..25cfbfa8aec 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -128,14 +128,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateTestClassname(ModelClient modelClient) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (modelClient == null) throw new ArgumentNullException(nameof(modelClient)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -246,7 +240,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs index c5f1ff93455..b1cedb94aa2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs @@ -63,7 +63,7 @@ namespace Org.OpenAPITools.IApi /// (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<object>> - Task> DeletePetAsync(long petId, string? apiKey = null, System.Threading.CancellationToken cancellationToken = default); + Task> DeletePetAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default); /// /// Deletes a pet @@ -75,7 +75,7 @@ namespace Org.OpenAPITools.IApi /// (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>object>?> - Task?> DeletePetOrDefaultAsync(long petId, string? apiKey = null, System.Threading.CancellationToken cancellationToken = default); + Task?> DeletePetOrDefaultAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default); /// /// Finds Pets by status @@ -181,7 +181,7 @@ namespace Org.OpenAPITools.IApi /// Updated status of the pet (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<object>> - Task> UpdatePetWithFormAsync(long petId, string? name = null, string? status = null, System.Threading.CancellationToken cancellationToken = default); + Task> UpdatePetWithFormAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default); /// /// Updates a pet in the store with form data @@ -194,7 +194,7 @@ namespace Org.OpenAPITools.IApi /// Updated status of the pet (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>object>?> - Task?> UpdatePetWithFormOrDefaultAsync(long petId, string? name = null, string? status = null, System.Threading.CancellationToken cancellationToken = default); + Task?> UpdatePetWithFormOrDefaultAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default); /// /// uploads an image @@ -208,7 +208,7 @@ namespace Org.OpenAPITools.IApi /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<ApiResponse>> - Task> UploadFileAsync(long petId, System.IO.Stream? file = null, string? additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default); + Task> UploadFileAsync(long petId, Option file = default, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default); /// /// uploads an image @@ -221,7 +221,7 @@ namespace Org.OpenAPITools.IApi /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>ApiResponse>?> - Task?> UploadFileOrDefaultAsync(long petId, System.IO.Stream? file = null, string? additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default); + Task?> UploadFileOrDefaultAsync(long petId, Option file = default, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default); /// /// uploads an image (required) @@ -235,7 +235,7 @@ namespace Org.OpenAPITools.IApi /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<ApiResponse>> - Task> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, string? additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default); + Task> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default); /// /// uploads an image (required) @@ -248,7 +248,7 @@ namespace Org.OpenAPITools.IApi /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>ApiResponse>?> - Task?> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, string? additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default); + Task?> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default); } } @@ -326,14 +326,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateAddPet(Pet pet) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (pet == null) throw new ArgumentNullException(nameof(pet)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -439,9 +433,11 @@ namespace Org.OpenAPITools.Api tokenBaseLocalVars.Add(httpSignatureTokenLocalVar); - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content!.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } string[] contentTypes = new string[] { "application/json", @@ -450,7 +446,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Post; @@ -484,27 +480,17 @@ namespace Org.OpenAPITools.Api } } - partial void FormatDeletePet(ref long petId, ref string? apiKey); + partial void FormatDeletePet(ref long petId, ref Option apiKey); /// /// Validates the request parameters /// - /// /// /// - private void ValidateDeletePet(long petId, string? apiKey) + private void ValidateDeletePet(Option apiKey) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (petId == null) - throw new ArgumentNullException(nameof(petId)); - - if (apiKey == null) + if (apiKey.IsSet && apiKey.Value == null) throw new ArgumentNullException(nameof(apiKey)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -513,7 +499,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterDeletePetDefaultImplementation(ApiResponse apiResponseLocalVar, long petId, string? apiKey) + private void AfterDeletePetDefaultImplementation(ApiResponse apiResponseLocalVar, long petId, Option apiKey) { bool suppressDefaultLog = false; AfterDeletePet(ref suppressDefaultLog, apiResponseLocalVar, petId, apiKey); @@ -528,7 +514,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterDeletePet(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, long petId, string? apiKey); + partial void AfterDeletePet(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, long petId, Option apiKey); /// /// Logs exceptions that occur while retrieving the server response @@ -538,7 +524,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorDeletePetDefaultImplementation(Exception exception, string pathFormat, string path, long petId, string? apiKey) + private void OnErrorDeletePetDefaultImplementation(Exception exception, string pathFormat, string path, long petId, Option apiKey) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorDeletePet(exception, pathFormat, path, petId, apiKey); @@ -552,7 +538,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorDeletePet(Exception exception, string pathFormat, string path, long petId, string? apiKey); + partial void OnErrorDeletePet(Exception exception, string pathFormat, string path, long petId, Option apiKey); /// /// Deletes a pet @@ -561,7 +547,7 @@ namespace Org.OpenAPITools.Api /// (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task?> DeletePetOrDefaultAsync(long petId, string? apiKey = null, System.Threading.CancellationToken cancellationToken = default) + public async Task?> DeletePetOrDefaultAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -581,13 +567,13 @@ namespace Org.OpenAPITools.Api /// (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> DeletePetAsync(long petId, string? apiKey = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> DeletePetAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateDeletePet(petId, apiKey); + ValidateDeletePet(apiKey); FormatDeletePet(ref petId, ref apiKey); @@ -599,8 +585,8 @@ namespace Org.OpenAPITools.Api uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/{petId}"; uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); - if (apiKey != null) - httpRequestMessageLocalVar.Headers.Add("api_key", ClientUtils.ParameterToString(apiKey)); + if (apiKey.IsSet) + httpRequestMessageLocalVar.Headers.Add("api_key", ClientUtils.ParameterToString(apiKey.Value)); List tokenBaseLocalVars = new List(); @@ -648,14 +634,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateFindPetsByStatus(List status) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (status == null) throw new ArgumentNullException(nameof(status)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -763,9 +743,11 @@ namespace Org.OpenAPITools.Api tokenBaseLocalVars.Add(httpSignatureTokenLocalVar); - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content!.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } string[] acceptLocalVars = new string[] { "application/xml", @@ -817,14 +799,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateFindPetsByTags(List tags) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (tags == null) throw new ArgumentNullException(nameof(tags)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -932,9 +908,11 @@ namespace Org.OpenAPITools.Api tokenBaseLocalVars.Add(httpSignatureTokenLocalVar); - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content!.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } string[] acceptLocalVars = new string[] { "application/xml", @@ -979,23 +957,6 @@ namespace Org.OpenAPITools.Api partial void FormatGetPetById(ref long petId); - /// - /// Validates the request parameters - /// - /// - /// - private void ValidateGetPetById(long petId) - { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (petId == null) - throw new ArgumentNullException(nameof(petId)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - } - /// /// Processes the server response /// @@ -1070,8 +1031,6 @@ namespace Org.OpenAPITools.Api try { - ValidateGetPetById(petId); - FormatGetPetById(ref petId); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -1138,14 +1097,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateUpdatePet(Pet pet) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (pet == null) throw new ArgumentNullException(nameof(pet)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1251,9 +1204,11 @@ namespace Org.OpenAPITools.Api tokenBaseLocalVars.Add(httpSignatureTokenLocalVar); - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content!.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } string[] contentTypes = new string[] { "application/json", @@ -1262,7 +1217,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Put; @@ -1296,31 +1251,21 @@ namespace Org.OpenAPITools.Api } } - partial void FormatUpdatePetWithForm(ref long petId, ref string? name, ref string? status); + partial void FormatUpdatePetWithForm(ref long petId, ref Option name, ref Option status); /// /// Validates the request parameters /// - /// /// /// /// - private void ValidateUpdatePetWithForm(long petId, string? name, string? status) + private void ValidateUpdatePetWithForm(Option name, Option status) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (petId == null) - throw new ArgumentNullException(nameof(petId)); - - if (name == null) + if (name.IsSet && name.Value == null) throw new ArgumentNullException(nameof(name)); - if (status == null) + if (status.IsSet && status.Value == null) throw new ArgumentNullException(nameof(status)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1330,7 +1275,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterUpdatePetWithFormDefaultImplementation(ApiResponse apiResponseLocalVar, long petId, string? name, string? status) + private void AfterUpdatePetWithFormDefaultImplementation(ApiResponse apiResponseLocalVar, long petId, Option name, Option status) { bool suppressDefaultLog = false; AfterUpdatePetWithForm(ref suppressDefaultLog, apiResponseLocalVar, petId, name, status); @@ -1346,7 +1291,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterUpdatePetWithForm(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, long petId, string? name, string? status); + partial void AfterUpdatePetWithForm(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, long petId, Option name, Option status); /// /// Logs exceptions that occur while retrieving the server response @@ -1357,7 +1302,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorUpdatePetWithFormDefaultImplementation(Exception exception, string pathFormat, string path, long petId, string? name, string? status) + private void OnErrorUpdatePetWithFormDefaultImplementation(Exception exception, string pathFormat, string path, long petId, Option name, Option status) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorUpdatePetWithForm(exception, pathFormat, path, petId, name, status); @@ -1372,7 +1317,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorUpdatePetWithForm(Exception exception, string pathFormat, string path, long petId, string? name, string? status); + partial void OnErrorUpdatePetWithForm(Exception exception, string pathFormat, string path, long petId, Option name, Option status); /// /// Updates a pet in the store with form data @@ -1382,7 +1327,7 @@ namespace Org.OpenAPITools.Api /// Updated status of the pet (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task?> UpdatePetWithFormOrDefaultAsync(long petId, string? name = null, string? status = null, System.Threading.CancellationToken cancellationToken = default) + public async Task?> UpdatePetWithFormOrDefaultAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -1403,13 +1348,13 @@ namespace Org.OpenAPITools.Api /// Updated status of the pet (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> UpdatePetWithFormAsync(long petId, string? name = null, string? status = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> UpdatePetWithFormAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateUpdatePetWithForm(petId, name, status); + ValidateUpdatePetWithForm(name, status); FormatUpdatePetWithForm(ref petId, ref name, ref status); @@ -1427,11 +1372,11 @@ namespace Org.OpenAPITools.Api List> formParameterLocalVars = new List>(); - multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (name != null) - formParameterLocalVars.Add(new KeyValuePair("name", ClientUtils.ParameterToString(name))); + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (name.IsSet) + formParameterLocalVars.Add(new KeyValuePair("name", ClientUtils.ParameterToString(name.Value))); - if (status != null) - formParameterLocalVars.Add(new KeyValuePair("status", ClientUtils.ParameterToString(status))); + if (status.IsSet) + formParameterLocalVars.Add(new KeyValuePair("status", ClientUtils.ParameterToString(status.Value))); List tokenBaseLocalVars = new List(); @@ -1449,7 +1394,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Post; @@ -1479,31 +1424,21 @@ namespace Org.OpenAPITools.Api } } - partial void FormatUploadFile(ref long petId, ref System.IO.Stream? file, ref string? additionalMetadata); + partial void FormatUploadFile(ref long petId, ref Option file, ref Option additionalMetadata); /// /// Validates the request parameters /// - /// - /// /// + /// /// - private void ValidateUploadFile(long petId, System.IO.Stream? file, string? additionalMetadata) + private void ValidateUploadFile(Option additionalMetadata, Option file) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (petId == null) - throw new ArgumentNullException(nameof(petId)); - - if (file == null) - throw new ArgumentNullException(nameof(file)); - - if (additionalMetadata == null) + if (additionalMetadata.IsSet && additionalMetadata.Value == null) throw new ArgumentNullException(nameof(additionalMetadata)); - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + if (file.IsSet && file.Value == null) + throw new ArgumentNullException(nameof(file)); } /// @@ -1513,7 +1448,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterUploadFileDefaultImplementation(ApiResponse apiResponseLocalVar, long petId, System.IO.Stream? file, string? additionalMetadata) + private void AfterUploadFileDefaultImplementation(ApiResponse apiResponseLocalVar, long petId, Option file, Option additionalMetadata) { bool suppressDefaultLog = false; AfterUploadFile(ref suppressDefaultLog, apiResponseLocalVar, petId, file, additionalMetadata); @@ -1529,7 +1464,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterUploadFile(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, long petId, System.IO.Stream? file, string? additionalMetadata); + partial void AfterUploadFile(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, long petId, Option file, Option additionalMetadata); /// /// Logs exceptions that occur while retrieving the server response @@ -1540,7 +1475,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorUploadFileDefaultImplementation(Exception exception, string pathFormat, string path, long petId, System.IO.Stream? file, string? additionalMetadata) + private void OnErrorUploadFileDefaultImplementation(Exception exception, string pathFormat, string path, long petId, Option file, Option additionalMetadata) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorUploadFile(exception, pathFormat, path, petId, file, additionalMetadata); @@ -1555,7 +1490,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorUploadFile(Exception exception, string pathFormat, string path, long petId, System.IO.Stream? file, string? additionalMetadata); + partial void OnErrorUploadFile(Exception exception, string pathFormat, string path, long petId, Option file, Option additionalMetadata); /// /// uploads an image @@ -1565,7 +1500,7 @@ namespace Org.OpenAPITools.Api /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task?> UploadFileOrDefaultAsync(long petId, System.IO.Stream? file = null, string? additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default) + public async Task?> UploadFileOrDefaultAsync(long petId, Option file = default, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -1586,13 +1521,13 @@ namespace Org.OpenAPITools.Api /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> UploadFileAsync(long petId, System.IO.Stream? file = null, string? additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> UploadFileAsync(long petId, Option file = default, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateUploadFile(petId, file, additionalMetadata); + ValidateUploadFile(additionalMetadata, file); FormatUploadFile(ref petId, ref file, ref additionalMetadata); @@ -1610,11 +1545,11 @@ namespace Org.OpenAPITools.Api List> formParameterLocalVars = new List>(); - multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (file != null) - multipartContentLocalVar.Add(new StreamContent(file)); + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (file.IsSet) + multipartContentLocalVar.Add(new StreamContent(file.Value)); - if (additionalMetadata != null) - formParameterLocalVars.Add(new KeyValuePair("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata))); + if (additionalMetadata.IsSet) + formParameterLocalVars.Add(new KeyValuePair("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata.Value))); List tokenBaseLocalVars = new List(); @@ -1632,7 +1567,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { @@ -1671,31 +1606,21 @@ namespace Org.OpenAPITools.Api } } - partial void FormatUploadFileWithRequiredFile(ref System.IO.Stream requiredFile, ref long petId, ref string? additionalMetadata); + partial void FormatUploadFileWithRequiredFile(ref System.IO.Stream requiredFile, ref long petId, ref Option additionalMetadata); /// /// Validates the request parameters /// /// - /// /// /// - private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, long petId, string? additionalMetadata) + private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, Option additionalMetadata) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (requiredFile == null) throw new ArgumentNullException(nameof(requiredFile)); - if (petId == null) - throw new ArgumentNullException(nameof(petId)); - - if (additionalMetadata == null) + if (additionalMetadata.IsSet && additionalMetadata.Value == null) throw new ArgumentNullException(nameof(additionalMetadata)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1705,7 +1630,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterUploadFileWithRequiredFileDefaultImplementation(ApiResponse apiResponseLocalVar, System.IO.Stream requiredFile, long petId, string? additionalMetadata) + private void AfterUploadFileWithRequiredFileDefaultImplementation(ApiResponse apiResponseLocalVar, System.IO.Stream requiredFile, long petId, Option additionalMetadata) { bool suppressDefaultLog = false; AfterUploadFileWithRequiredFile(ref suppressDefaultLog, apiResponseLocalVar, requiredFile, petId, additionalMetadata); @@ -1721,7 +1646,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterUploadFileWithRequiredFile(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, System.IO.Stream requiredFile, long petId, string? additionalMetadata); + partial void AfterUploadFileWithRequiredFile(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, System.IO.Stream requiredFile, long petId, Option additionalMetadata); /// /// Logs exceptions that occur while retrieving the server response @@ -1732,7 +1657,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorUploadFileWithRequiredFileDefaultImplementation(Exception exception, string pathFormat, string path, System.IO.Stream requiredFile, long petId, string? additionalMetadata) + private void OnErrorUploadFileWithRequiredFileDefaultImplementation(Exception exception, string pathFormat, string path, System.IO.Stream requiredFile, long petId, Option additionalMetadata) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorUploadFileWithRequiredFile(exception, pathFormat, path, requiredFile, petId, additionalMetadata); @@ -1747,7 +1672,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorUploadFileWithRequiredFile(Exception exception, string pathFormat, string path, System.IO.Stream requiredFile, long petId, string? additionalMetadata); + partial void OnErrorUploadFileWithRequiredFile(Exception exception, string pathFormat, string path, System.IO.Stream requiredFile, long petId, Option additionalMetadata); /// /// uploads an image (required) @@ -1757,7 +1682,7 @@ namespace Org.OpenAPITools.Api /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task?> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, string? additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default) + public async Task?> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -1778,13 +1703,13 @@ namespace Org.OpenAPITools.Api /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, string? additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateUploadFileWithRequiredFile(requiredFile, petId, additionalMetadata); + ValidateUploadFileWithRequiredFile(requiredFile, additionalMetadata); FormatUploadFileWithRequiredFile(ref requiredFile, ref petId, ref additionalMetadata); @@ -1804,8 +1729,8 @@ namespace Org.OpenAPITools.Api multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); multipartContentLocalVar.Add(new StreamContent(requiredFile)); - if (additionalMetadata != null) - formParameterLocalVars.Add(new KeyValuePair("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata))); + if (additionalMetadata.IsSet) + formParameterLocalVars.Add(new KeyValuePair("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata.Value))); List tokenBaseLocalVars = new List(); @@ -1823,7 +1748,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/StoreApi.cs index e7966918821..b8951868180 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/StoreApi.cs @@ -195,14 +195,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateDeleteOrder(string orderId) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (orderId == null) throw new ArgumentNullException(nameof(orderId)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -439,23 +433,6 @@ namespace Org.OpenAPITools.Api partial void FormatGetOrderById(ref long orderId); - /// - /// Validates the request parameters - /// - /// - /// - private void ValidateGetOrderById(long orderId) - { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (orderId == null) - throw new ArgumentNullException(nameof(orderId)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - } - /// /// Processes the server response /// @@ -530,8 +507,6 @@ namespace Org.OpenAPITools.Api try { - ValidateGetOrderById(orderId); - FormatGetOrderById(ref orderId); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -586,14 +561,8 @@ namespace Org.OpenAPITools.Api /// private void ValidatePlaceOrder(Order order) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (order == null) throw new ArgumentNullException(nameof(order)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -693,7 +662,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/UserApi.cs index ab4caea726f..7116456ad0a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/UserApi.cs @@ -291,14 +291,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateCreateUser(User user) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (user == null) throw new ArgumentNullException(nameof(user)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -398,7 +392,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Post; @@ -433,14 +427,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateCreateUsersWithArrayInput(List user) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (user == null) throw new ArgumentNullException(nameof(user)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -540,7 +528,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Post; @@ -575,14 +563,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateCreateUsersWithListInput(List user) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (user == null) throw new ArgumentNullException(nameof(user)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -682,7 +664,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Post; @@ -717,14 +699,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateDeleteUser(string username) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (username == null) throw new ArgumentNullException(nameof(username)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -847,14 +823,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateGetUserByName(string username) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (username == null) throw new ArgumentNullException(nameof(username)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -988,17 +958,11 @@ namespace Org.OpenAPITools.Api /// private void ValidateLoginUser(string username, string password) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (username == null) throw new ArgumentNullException(nameof(username)); if (password == null) throw new ArgumentNullException(nameof(password)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1244,17 +1208,11 @@ namespace Org.OpenAPITools.Api /// private void ValidateUpdateUser(User user, string username) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (user == null) throw new ArgumentNullException(nameof(user)); if (username == null) throw new ArgumentNullException(nameof(username)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1361,7 +1319,7 @@ namespace Org.OpenAPITools.Api string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Put; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/Option.cs new file mode 100644 index 00000000000..7aa655c9b81 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/Option.cs @@ -0,0 +1,41 @@ +// +/* + * 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + + +namespace Org.OpenAPITools.Client +{ + /// + /// A wrapper for operation parameters which are not required + /// + public struct Option + { + /// + /// The value to send to the server + /// + public TType Value { get; } + + /// + /// When true the value will be sent to the server + /// + internal bool IsSet { get; } + + /// + /// A wrapper for operation parameters which are not required + /// + /// + public Option(TType value) + { + IsSet = true; + Value = value; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 0dd2d6157c5..3358c8310f7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -277,13 +277,20 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("empty_map"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); writer.WritePropertyName("map_of_map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); writer.WritePropertyName("map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); writer.WritePropertyName("map_with_undeclared_properties_string"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + writer.WritePropertyName("map_of_map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + writer.WritePropertyName("map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_string"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + writer.WritePropertyName("anytype_1"); JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs index 18561289dc5..d826b73dba1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -194,8 +194,10 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("array_array_of_integer"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); writer.WritePropertyName("array_array_of_model"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); writer.WritePropertyName("array_of_string"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + writer.WritePropertyName("array_array_of_model"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + writer.WritePropertyName("array_of_string"); JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs index 51151ad6e91..2a834851af5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs @@ -199,9 +199,12 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("mainShape"); - JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); writer.WritePropertyName("shapes"); - JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); writer.WritePropertyName("nullableShape"); - JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); writer.WritePropertyName("shapeOrNull"); + JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + writer.WritePropertyName("nullableShape"); + JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); + writer.WritePropertyName("shapeOrNull"); JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs index 9804fa1bb42..b5e300dc533 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -312,6 +312,7 @@ namespace Org.OpenAPITools.Model { writer.WritePropertyName("array_enum"); JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol); if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index c2fcd0965fc..e308c68303e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -177,7 +177,8 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("file"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); writer.WritePropertyName("files"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + writer.WritePropertyName("files"); JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs index b358d35548b..0f5af70f4c6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs @@ -589,11 +589,14 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("binary"); - JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); writer.WritePropertyName("byte"); - JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); + JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + writer.WritePropertyName("byte"); + JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); writer.WriteString("dateTime", formatTest.DateTime.ToString(DateTimeFormat)); writer.WritePropertyName("decimal"); - JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); writer.WriteNumber("double", formatTest.VarDouble); + JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); + writer.WriteNumber("double", formatTest.VarDouble); writer.WriteNumber("float", formatTest.VarFloat); writer.WriteNumber("int32", formatTest.Int32); writer.WriteNumber("int64", formatTest.Int64); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs index 7f284acddca..ee4a45d7fb2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs @@ -277,9 +277,12 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("direct_map"); - JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); writer.WritePropertyName("indirect_map"); - JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); writer.WritePropertyName("map_map_of_string"); - JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); writer.WritePropertyName("map_of_enum_string"); + JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + writer.WritePropertyName("indirect_map"); + JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + writer.WritePropertyName("map_map_of_string"); + JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + writer.WritePropertyName("map_of_enum_string"); JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 4c8d2b9115f..66f86e8c06e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -224,7 +224,8 @@ namespace Org.OpenAPITools.Model { writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.ToString(DateTimeFormat)); writer.WritePropertyName("map"); - JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid); + JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid); writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs index ca89e8a8f79..76103cf884f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs @@ -320,10 +320,14 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("array_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); writer.WritePropertyName("object_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); writer.WritePropertyName("array_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); writer.WritePropertyName("array_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + writer.WritePropertyName("array_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); + writer.WritePropertyName("array_nullable_prop"); JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); + if (nullableClass.BooleanProp != null) writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value); else @@ -350,8 +354,10 @@ namespace Org.OpenAPITools.Model writer.WriteNull("number_prop"); writer.WritePropertyName("object_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); writer.WritePropertyName("object_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); writer.WriteString("string_prop", nullableClass.StringProp); + JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); + writer.WritePropertyName("object_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); + writer.WriteString("string_prop", nullableClass.StringProp); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 2e956371cce..75f4722f8b1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -213,8 +213,10 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("bars"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); writer.WritePropertyName("deprecatedRef"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); writer.WriteNumber("id", objectWithDeprecatedFields.Id); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + writer.WritePropertyName("deprecatedRef"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + writer.WriteNumber("id", objectWithDeprecatedFields.Id); writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs index 09d4c9b1313..cc304f1e1b9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs @@ -329,10 +329,12 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("category"); - JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); writer.WriteNumber("id", pet.Id); + JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + writer.WriteNumber("id", pet.Id); writer.WriteString("name", pet.Name); writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); + var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status); if (statusRawValue != null) writer.WriteString("status", statusRawValue); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs index 91e3622e796..dc893bd6a97 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs @@ -341,13 +341,16 @@ namespace Org.OpenAPITools.Model writer.WriteNumber("id", user.Id); writer.WriteString("lastName", user.LastName); writer.WritePropertyName("objectWithNoDeclaredProps"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); writer.WriteString("password", user.Password); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + writer.WriteString("password", user.Password); writer.WriteString("phone", user.Phone); writer.WriteNumber("userStatus", user.UserStatus); writer.WriteString("username", user.Username); writer.WritePropertyName("anyTypeProp"); - JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); writer.WritePropertyName("anyTypePropNullable"); - JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES index 0ab733136b4..60c779c5ced 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES @@ -123,6 +123,7 @@ src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs src/Org.OpenAPITools/Client/HttpSigningToken.cs src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs src/Org.OpenAPITools/Client/OAuthToken.cs +src/Org.OpenAPITools/Client/Option.cs src/Org.OpenAPITools/Client/RateLimitProvider`1.cs src/Org.OpenAPITools/Client/TokenBase.cs src/Org.OpenAPITools/Client/TokenContainer`1.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml index 6be7f291ccc..c2398ea9992 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml @@ -1036,6 +1036,38 @@ paths: type: string type: array style: form + - explode: true + in: query + name: requiredNotNullable + required: true + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: requiredNullable + required: true + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: notRequiredNotNullable + required: false + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: notRequiredNullable + required: false + schema: + nullable: true + type: string + style: form responses: "200": description: Success diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/apis/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/apis/FakeApi.md index b49cfaa04e3..82106bd5206 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/apis/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/apis/FakeApi.md @@ -1301,7 +1301,7 @@ No authorization required # **TestQueryParameterCollectionFormat** -> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context) +> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = null, string notRequiredNullable = null) @@ -1329,10 +1329,14 @@ namespace Example var http = new List(); // List | var url = new List(); // List | var context = new List(); // List | + var requiredNotNullable = "requiredNotNullable_example"; // string | + var requiredNullable = "requiredNullable_example"; // string | + var notRequiredNotNullable = "notRequiredNotNullable_example"; // string | (optional) + var notRequiredNullable = "notRequiredNullable_example"; // string | (optional) try { - apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1351,7 +1355,7 @@ This returns an ApiResponse object which contains the response data, status code ```csharp try { - apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1370,6 +1374,10 @@ catch (ApiException e) | **http** | [**List<string>**](string.md) | | | | **url** | [**List<string>**](string.md) | | | | **context** | [**List<string>**](string.md) | | | +| **requiredNotNullable** | **string** | | | +| **requiredNullable** | **string** | | | +| **notRequiredNotNullable** | **string** | | [optional] | +| **notRequiredNullable** | **string** | | [optional] | ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs index 1a3378ebdd0..73b87f569ac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs @@ -67,7 +67,7 @@ namespace Org.OpenAPITools.Test.Api [Fact (Skip = "not implemented")] public async Task FakeOuterBooleanSerializeAsyncTest() { - bool body = default; + Client.Option body = default; var response = await _instance.FakeOuterBooleanSerializeAsync(body); var model = response.AsModel(); Assert.IsType(model); @@ -79,7 +79,7 @@ namespace Org.OpenAPITools.Test.Api [Fact (Skip = "not implemented")] public async Task FakeOuterCompositeSerializeAsyncTest() { - OuterComposite outerComposite = default; + Client.Option outerComposite = default; var response = await _instance.FakeOuterCompositeSerializeAsync(outerComposite); var model = response.AsModel(); Assert.IsType(model); @@ -91,7 +91,7 @@ namespace Org.OpenAPITools.Test.Api [Fact (Skip = "not implemented")] public async Task FakeOuterNumberSerializeAsyncTest() { - decimal body = default; + Client.Option body = default; var response = await _instance.FakeOuterNumberSerializeAsync(body); var model = response.AsModel(); Assert.IsType(model); @@ -104,7 +104,7 @@ namespace Org.OpenAPITools.Test.Api public async Task FakeOuterStringSerializeAsyncTest() { Guid requiredStringUuid = default; - string body = default; + Client.Option body = default; var response = await _instance.FakeOuterStringSerializeAsync(requiredStringUuid, body); var model = response.AsModel(); Assert.IsType(model); @@ -164,16 +164,16 @@ namespace Org.OpenAPITools.Test.Api decimal number = default; double varDouble = default; string patternWithoutDelimiter = default; - DateTime date = default; - System.IO.Stream binary = default; - float varFloat = default; - int integer = default; - int int32 = default; - long int64 = default; - string varString = default; - string password = default; - string callback = default; - DateTime dateTime = default; + Client.Option date = default; + Client.Option binary = default; + Client.Option varFloat = default; + Client.Option integer = default; + Client.Option int32 = default; + Client.Option int64 = default; + Client.Option varString = default; + Client.Option password = default; + Client.Option callback = default; + Client.Option dateTime = default; await _instance.TestEndpointParametersAsync(varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime); } @@ -183,14 +183,14 @@ namespace Org.OpenAPITools.Test.Api [Fact (Skip = "not implemented")] public async Task TestEnumParametersAsyncTest() { - List enumHeaderStringArray = default; - List enumQueryStringArray = default; - double enumQueryDouble = default; - int enumQueryInteger = default; - List enumFormStringArray = default; - string enumHeaderString = default; - string enumQueryString = default; - string enumFormString = default; + Client.Option> enumHeaderStringArray = default; + Client.Option> enumQueryStringArray = default; + Client.Option enumQueryDouble = default; + Client.Option enumQueryInteger = default; + Client.Option> enumFormStringArray = default; + Client.Option enumHeaderString = default; + Client.Option enumQueryString = default; + Client.Option enumFormString = default; await _instance.TestEnumParametersAsync(enumHeaderStringArray, enumQueryStringArray, enumQueryDouble, enumQueryInteger, enumFormStringArray, enumHeaderString, enumQueryString, enumFormString); } @@ -203,9 +203,9 @@ namespace Org.OpenAPITools.Test.Api bool requiredBooleanGroup = default; int requiredStringGroup = default; long requiredInt64Group = default; - bool booleanGroup = default; - int stringGroup = default; - long int64Group = default; + Client.Option booleanGroup = default; + Client.Option stringGroup = default; + Client.Option int64Group = default; await _instance.TestGroupParametersAsync(requiredBooleanGroup, requiredStringGroup, requiredInt64Group, booleanGroup, stringGroup, int64Group); } @@ -241,7 +241,11 @@ namespace Org.OpenAPITools.Test.Api List http = default; List url = default; List context = default; - await _instance.TestQueryParameterCollectionFormatAsync(pipe, ioutil, http, url, context); + string requiredNotNullable = default; + string requiredNullable = default; + Client.Option notRequiredNotNullable = default; + Client.Option notRequiredNullable = default; + await _instance.TestQueryParameterCollectionFormatAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/PetApiTests.cs index 5f43e98fd32..e1c54f8f129 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/PetApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/PetApiTests.cs @@ -67,7 +67,7 @@ namespace Org.OpenAPITools.Test.Api public async Task DeletePetAsyncTest() { long petId = default; - string apiKey = default; + Client.Option apiKey = default; await _instance.DeletePetAsync(petId, apiKey); } @@ -124,8 +124,8 @@ namespace Org.OpenAPITools.Test.Api public async Task UpdatePetWithFormAsyncTest() { long petId = default; - string name = default; - string status = default; + Client.Option name = default; + Client.Option status = default; await _instance.UpdatePetWithFormAsync(petId, name, status); } @@ -136,8 +136,8 @@ namespace Org.OpenAPITools.Test.Api public async Task UploadFileAsyncTest() { long petId = default; - System.IO.Stream file = default; - string additionalMetadata = default; + Client.Option file = default; + Client.Option additionalMetadata = default; var response = await _instance.UploadFileAsync(petId, file, additionalMetadata); var model = response.AsModel(); Assert.IsType(model); @@ -151,7 +151,7 @@ namespace Org.OpenAPITools.Test.Api { System.IO.Stream requiredFile = default; long petId = default; - string additionalMetadata = default; + Client.Option additionalMetadata = default; var response = await _instance.UploadFileWithRequiredFileAsync(requiredFile, petId, additionalMetadata); var model = response.AsModel(); Assert.IsType(model); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index d4c6b9eec3d..ecb7abdccb0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -126,14 +126,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateCall123TestSpecialTags(ModelClient modelClient) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (modelClient == null) throw new ArgumentNullException(nameof(modelClient)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -233,7 +227,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/DefaultApi.cs index aea4292878d..49e2c84365f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -277,14 +277,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateGetCountry(string country) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (country == null) throw new ArgumentNullException(nameof(country)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -390,7 +384,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Post; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeApi.cs index 8087e1bc4a8..99d28891c26 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeApi.cs @@ -58,7 +58,7 @@ namespace Org.OpenAPITools.IApi /// Input boolean as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<bool>> - Task> FakeOuterBooleanSerializeAsync(bool? body = null, System.Threading.CancellationToken cancellationToken = default); + Task> FakeOuterBooleanSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -69,7 +69,7 @@ namespace Org.OpenAPITools.IApi /// Input boolean as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>bool>> - Task> FakeOuterBooleanSerializeOrDefaultAsync(bool? body = null, System.Threading.CancellationToken cancellationToken = default); + Task> FakeOuterBooleanSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -81,7 +81,7 @@ namespace Org.OpenAPITools.IApi /// Input composite as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<OuterComposite>> - Task> FakeOuterCompositeSerializeAsync(OuterComposite outerComposite = null, System.Threading.CancellationToken cancellationToken = default); + Task> FakeOuterCompositeSerializeAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -92,7 +92,7 @@ namespace Org.OpenAPITools.IApi /// Input composite as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>OuterComposite>> - Task> FakeOuterCompositeSerializeOrDefaultAsync(OuterComposite outerComposite = null, System.Threading.CancellationToken cancellationToken = default); + Task> FakeOuterCompositeSerializeOrDefaultAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -104,7 +104,7 @@ namespace Org.OpenAPITools.IApi /// Input number as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<decimal>> - Task> FakeOuterNumberSerializeAsync(decimal? body = null, System.Threading.CancellationToken cancellationToken = default); + Task> FakeOuterNumberSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -115,7 +115,7 @@ namespace Org.OpenAPITools.IApi /// Input number as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>decimal>> - Task> FakeOuterNumberSerializeOrDefaultAsync(decimal? body = null, System.Threading.CancellationToken cancellationToken = default); + Task> FakeOuterNumberSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -128,7 +128,7 @@ namespace Org.OpenAPITools.IApi /// Input string as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<string>> - Task> FakeOuterStringSerializeAsync(Guid requiredStringUuid, string body = null, System.Threading.CancellationToken cancellationToken = default); + Task> FakeOuterStringSerializeAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -140,7 +140,7 @@ namespace Org.OpenAPITools.IApi /// Input string as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>string>> - Task> FakeOuterStringSerializeOrDefaultAsync(Guid requiredStringUuid, string body = null, System.Threading.CancellationToken cancellationToken = default); + Task> FakeOuterStringSerializeOrDefaultAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default); /// /// Array of Enums @@ -257,7 +257,7 @@ namespace Org.OpenAPITools.IApi /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") /// Cancellation Token to cancel the request. /// Task<ApiResponse<object>> - Task> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date = null, System.IO.Stream binary = null, float? varFloat = null, int? integer = null, int? int32 = null, long? int64 = null, string varString = null, string password = null, string callback = null, DateTime? dateTime = null, System.Threading.CancellationToken cancellationToken = default); + Task> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date = default, Option binary = default, Option varFloat = default, Option integer = default, Option int32 = default, Option int64 = default, Option varString = default, Option password = default, Option callback = default, Option dateTime = default, System.Threading.CancellationToken cancellationToken = default); /// /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -281,7 +281,7 @@ namespace Org.OpenAPITools.IApi /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") /// Cancellation Token to cancel the request. /// Task<ApiResponse>object>> - Task> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date = null, System.IO.Stream binary = null, float? varFloat = null, int? integer = null, int? int32 = null, long? int64 = null, string varString = null, string password = null, string callback = null, DateTime? dateTime = null, System.Threading.CancellationToken cancellationToken = default); + Task> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date = default, Option binary = default, Option varFloat = default, Option integer = default, Option int32 = default, Option int64 = default, Option varString = default, Option password = default, Option callback = default, Option dateTime = default, System.Threading.CancellationToken cancellationToken = default); /// /// To test enum parameters @@ -300,7 +300,7 @@ namespace Org.OpenAPITools.IApi /// Form parameter enum test (string) (optional, default to -efg) /// Cancellation Token to cancel the request. /// Task<ApiResponse<object>> - Task> TestEnumParametersAsync(List enumHeaderStringArray = null, List enumQueryStringArray = null, double? enumQueryDouble = null, int? enumQueryInteger = null, List enumFormStringArray = null, string enumHeaderString = null, string enumQueryString = null, string enumFormString = null, System.Threading.CancellationToken cancellationToken = default); + Task> TestEnumParametersAsync(Option> enumHeaderStringArray = default, Option> enumQueryStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option enumQueryString = default, Option enumFormString = default, System.Threading.CancellationToken cancellationToken = default); /// /// To test enum parameters @@ -318,7 +318,7 @@ namespace Org.OpenAPITools.IApi /// Form parameter enum test (string) (optional, default to -efg) /// Cancellation Token to cancel the request. /// Task<ApiResponse>object>> - Task> TestEnumParametersOrDefaultAsync(List enumHeaderStringArray = null, List enumQueryStringArray = null, double? enumQueryDouble = null, int? enumQueryInteger = null, List enumFormStringArray = null, string enumHeaderString = null, string enumQueryString = null, string enumFormString = null, System.Threading.CancellationToken cancellationToken = default); + Task> TestEnumParametersOrDefaultAsync(Option> enumHeaderStringArray = default, Option> enumQueryStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option enumQueryString = default, Option enumFormString = default, System.Threading.CancellationToken cancellationToken = default); /// /// Fake endpoint to test group parameters (optional) @@ -335,7 +335,7 @@ namespace Org.OpenAPITools.IApi /// Integer in group parameters (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<object>> - Task> TestGroupParametersAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup = null, int? stringGroup = null, long? int64Group = null, System.Threading.CancellationToken cancellationToken = default); + Task> TestGroupParametersAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup = default, Option stringGroup = default, Option int64Group = default, System.Threading.CancellationToken cancellationToken = default); /// /// Fake endpoint to test group parameters (optional) @@ -351,7 +351,7 @@ namespace Org.OpenAPITools.IApi /// Integer in group parameters (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>object>> - Task> TestGroupParametersOrDefaultAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup = null, int? stringGroup = null, long? int64Group = null, System.Threading.CancellationToken cancellationToken = default); + Task> TestGroupParametersOrDefaultAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup = default, Option stringGroup = default, Option int64Group = default, System.Threading.CancellationToken cancellationToken = default); /// /// test inline additionalProperties @@ -413,9 +413,13 @@ namespace Org.OpenAPITools.IApi /// /// /// + /// + /// + /// (optional) + /// (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<object>> - Task> TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, System.Threading.CancellationToken cancellationToken = default); + Task> TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable = default, Option notRequiredNotNullable = default, Option notRequiredNullable = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -428,9 +432,13 @@ namespace Org.OpenAPITools.IApi /// /// /// + /// + /// + /// (optional) + /// (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>object>> - Task> TestQueryParameterCollectionFormatOrDefaultAsync(List pipe, List ioutil, List http, List url, List context, System.Threading.CancellationToken cancellationToken = default); + Task> TestQueryParameterCollectionFormatOrDefaultAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable = default, Option notRequiredNotNullable = default, Option notRequiredNullable = default, System.Threading.CancellationToken cancellationToken = default); } } @@ -608,31 +616,14 @@ namespace Org.OpenAPITools.Api } } - partial void FormatFakeOuterBooleanSerialize(ref bool? body); - - /// - /// Validates the request parameters - /// - /// - /// - private void ValidateFakeOuterBooleanSerialize(bool? body) - { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (body == null) - throw new ArgumentNullException(nameof(body)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - } + partial void FormatFakeOuterBooleanSerialize(ref Option body); /// /// Processes the server response /// /// /// - private void AfterFakeOuterBooleanSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, bool? body) + private void AfterFakeOuterBooleanSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, Option body) { bool suppressDefaultLog = false; AfterFakeOuterBooleanSerialize(ref suppressDefaultLog, apiResponseLocalVar, body); @@ -646,7 +637,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterFakeOuterBooleanSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, bool? body); + partial void AfterFakeOuterBooleanSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, Option body); /// /// Logs exceptions that occur while retrieving the server response @@ -655,7 +646,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorFakeOuterBooleanSerializeDefaultImplementation(Exception exception, string pathFormat, string path, bool? body) + private void OnErrorFakeOuterBooleanSerializeDefaultImplementation(Exception exception, string pathFormat, string path, Option body) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorFakeOuterBooleanSerialize(exception, pathFormat, path, body); @@ -668,7 +659,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorFakeOuterBooleanSerialize(Exception exception, string pathFormat, string path, bool? body); + partial void OnErrorFakeOuterBooleanSerialize(Exception exception, string pathFormat, string path, Option body); /// /// Test serialization of outer boolean types @@ -676,7 +667,7 @@ namespace Org.OpenAPITools.Api /// Input boolean as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> FakeOuterBooleanSerializeOrDefaultAsync(bool? body = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> FakeOuterBooleanSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -695,14 +686,12 @@ namespace Org.OpenAPITools.Api /// Input boolean as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> FakeOuterBooleanSerializeAsync(bool? body = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> FakeOuterBooleanSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateFakeOuterBooleanSerialize(body); - FormatFakeOuterBooleanSerialize(ref body); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -712,9 +701,10 @@ namespace Org.OpenAPITools.Api uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/boolean"; - httpRequestMessageLocalVar.Content = (body as object) is System.IO.Stream stream - ? httpRequestMessageLocalVar.Content = new StreamContent(stream) - : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body, _jsonSerializerOptions)); + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; @@ -724,7 +714,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { @@ -759,23 +749,17 @@ namespace Org.OpenAPITools.Api } } - partial void FormatFakeOuterCompositeSerialize(OuterComposite outerComposite); + partial void FormatFakeOuterCompositeSerialize(Option outerComposite); /// /// Validates the request parameters /// /// /// - private void ValidateFakeOuterCompositeSerialize(OuterComposite outerComposite) + private void ValidateFakeOuterCompositeSerialize(Option outerComposite) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (outerComposite == null) + if (outerComposite.IsSet && outerComposite.Value == null) throw new ArgumentNullException(nameof(outerComposite)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -783,7 +767,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterFakeOuterCompositeSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, OuterComposite outerComposite) + private void AfterFakeOuterCompositeSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, Option outerComposite) { bool suppressDefaultLog = false; AfterFakeOuterCompositeSerialize(ref suppressDefaultLog, apiResponseLocalVar, outerComposite); @@ -797,7 +781,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterFakeOuterCompositeSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, OuterComposite outerComposite); + partial void AfterFakeOuterCompositeSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, Option outerComposite); /// /// Logs exceptions that occur while retrieving the server response @@ -806,7 +790,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorFakeOuterCompositeSerializeDefaultImplementation(Exception exception, string pathFormat, string path, OuterComposite outerComposite) + private void OnErrorFakeOuterCompositeSerializeDefaultImplementation(Exception exception, string pathFormat, string path, Option outerComposite) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorFakeOuterCompositeSerialize(exception, pathFormat, path, outerComposite); @@ -819,7 +803,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorFakeOuterCompositeSerialize(Exception exception, string pathFormat, string path, OuterComposite outerComposite); + partial void OnErrorFakeOuterCompositeSerialize(Exception exception, string pathFormat, string path, Option outerComposite); /// /// Test serialization of object with outer number type @@ -827,7 +811,7 @@ namespace Org.OpenAPITools.Api /// Input composite as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> FakeOuterCompositeSerializeOrDefaultAsync(OuterComposite outerComposite = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> FakeOuterCompositeSerializeOrDefaultAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -846,7 +830,7 @@ namespace Org.OpenAPITools.Api /// Input composite as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> FakeOuterCompositeSerializeAsync(OuterComposite outerComposite = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> FakeOuterCompositeSerializeAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); @@ -863,9 +847,10 @@ namespace Org.OpenAPITools.Api uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/composite"; - httpRequestMessageLocalVar.Content = (outerComposite as object) is System.IO.Stream stream - ? httpRequestMessageLocalVar.Content = new StreamContent(stream) - : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(outerComposite, _jsonSerializerOptions)); + if (outerComposite.IsSet) + httpRequestMessageLocalVar.Content = (outerComposite.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(outerComposite.Value, _jsonSerializerOptions)); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; @@ -875,7 +860,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { @@ -910,31 +895,14 @@ namespace Org.OpenAPITools.Api } } - partial void FormatFakeOuterNumberSerialize(ref decimal? body); - - /// - /// Validates the request parameters - /// - /// - /// - private void ValidateFakeOuterNumberSerialize(decimal? body) - { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (body == null) - throw new ArgumentNullException(nameof(body)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - } + partial void FormatFakeOuterNumberSerialize(ref Option body); /// /// Processes the server response /// /// /// - private void AfterFakeOuterNumberSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, decimal? body) + private void AfterFakeOuterNumberSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, Option body) { bool suppressDefaultLog = false; AfterFakeOuterNumberSerialize(ref suppressDefaultLog, apiResponseLocalVar, body); @@ -948,7 +916,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterFakeOuterNumberSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, decimal? body); + partial void AfterFakeOuterNumberSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, Option body); /// /// Logs exceptions that occur while retrieving the server response @@ -957,7 +925,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorFakeOuterNumberSerializeDefaultImplementation(Exception exception, string pathFormat, string path, decimal? body) + private void OnErrorFakeOuterNumberSerializeDefaultImplementation(Exception exception, string pathFormat, string path, Option body) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorFakeOuterNumberSerialize(exception, pathFormat, path, body); @@ -970,7 +938,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorFakeOuterNumberSerialize(Exception exception, string pathFormat, string path, decimal? body); + partial void OnErrorFakeOuterNumberSerialize(Exception exception, string pathFormat, string path, Option body); /// /// Test serialization of outer number types @@ -978,7 +946,7 @@ namespace Org.OpenAPITools.Api /// Input number as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> FakeOuterNumberSerializeOrDefaultAsync(decimal? body = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> FakeOuterNumberSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -997,14 +965,12 @@ namespace Org.OpenAPITools.Api /// Input number as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> FakeOuterNumberSerializeAsync(decimal? body = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> FakeOuterNumberSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateFakeOuterNumberSerialize(body); - FormatFakeOuterNumberSerialize(ref body); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -1014,9 +980,10 @@ namespace Org.OpenAPITools.Api uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/number"; - httpRequestMessageLocalVar.Content = (body as object) is System.IO.Stream stream - ? httpRequestMessageLocalVar.Content = new StreamContent(stream) - : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body, _jsonSerializerOptions)); + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; @@ -1026,7 +993,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { @@ -1061,27 +1028,17 @@ namespace Org.OpenAPITools.Api } } - partial void FormatFakeOuterStringSerialize(ref Guid requiredStringUuid, ref string body); + partial void FormatFakeOuterStringSerialize(ref Guid requiredStringUuid, ref Option body); /// /// Validates the request parameters /// - /// /// /// - private void ValidateFakeOuterStringSerialize(Guid requiredStringUuid, string body) + private void ValidateFakeOuterStringSerialize(Option body) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (requiredStringUuid == null) - throw new ArgumentNullException(nameof(requiredStringUuid)); - - if (body == null) + if (body.IsSet && body.Value == null) throw new ArgumentNullException(nameof(body)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1090,7 +1047,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterFakeOuterStringSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, Guid requiredStringUuid, string body) + private void AfterFakeOuterStringSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, Guid requiredStringUuid, Option body) { bool suppressDefaultLog = false; AfterFakeOuterStringSerialize(ref suppressDefaultLog, apiResponseLocalVar, requiredStringUuid, body); @@ -1105,7 +1062,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterFakeOuterStringSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, Guid requiredStringUuid, string body); + partial void AfterFakeOuterStringSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, Guid requiredStringUuid, Option body); /// /// Logs exceptions that occur while retrieving the server response @@ -1115,7 +1072,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorFakeOuterStringSerializeDefaultImplementation(Exception exception, string pathFormat, string path, Guid requiredStringUuid, string body) + private void OnErrorFakeOuterStringSerializeDefaultImplementation(Exception exception, string pathFormat, string path, Guid requiredStringUuid, Option body) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorFakeOuterStringSerialize(exception, pathFormat, path, requiredStringUuid, body); @@ -1129,7 +1086,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorFakeOuterStringSerialize(Exception exception, string pathFormat, string path, Guid requiredStringUuid, string body); + partial void OnErrorFakeOuterStringSerialize(Exception exception, string pathFormat, string path, Guid requiredStringUuid, Option body); /// /// Test serialization of outer string types @@ -1138,7 +1095,7 @@ namespace Org.OpenAPITools.Api /// Input string as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> FakeOuterStringSerializeOrDefaultAsync(Guid requiredStringUuid, string body = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> FakeOuterStringSerializeOrDefaultAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -1158,13 +1115,13 @@ namespace Org.OpenAPITools.Api /// Input string as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> FakeOuterStringSerializeAsync(Guid requiredStringUuid, string body = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> FakeOuterStringSerializeAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateFakeOuterStringSerialize(requiredStringUuid, body); + ValidateFakeOuterStringSerialize(body); FormatFakeOuterStringSerialize(ref requiredStringUuid, ref body); @@ -1181,9 +1138,10 @@ namespace Org.OpenAPITools.Api uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); - httpRequestMessageLocalVar.Content = (body as object) is System.IO.Stream stream - ? httpRequestMessageLocalVar.Content = new StreamContent(stream) - : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body, _jsonSerializerOptions)); + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; @@ -1193,7 +1151,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { @@ -1346,14 +1304,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateTestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (fileSchemaTestClass == null) throw new ArgumentNullException(nameof(fileSchemaTestClass)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1453,7 +1405,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Put; @@ -1484,22 +1436,16 @@ namespace Org.OpenAPITools.Api /// /// Validates the request parameters /// - /// /// + /// /// - private void ValidateTestBodyWithQueryParams(User user, string query) + private void ValidateTestBodyWithQueryParams(string query, User user) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (user == null) - throw new ArgumentNullException(nameof(user)); - if (query == null) throw new ArgumentNullException(nameof(query)); - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + if (user == null) + throw new ArgumentNullException(nameof(user)); } /// @@ -1582,7 +1528,7 @@ namespace Org.OpenAPITools.Api try { - ValidateTestBodyWithQueryParams(user, query); + ValidateTestBodyWithQueryParams(query, user); FormatTestBodyWithQueryParams(user, ref query); @@ -1611,7 +1557,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Put; @@ -1646,14 +1592,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateTestClientModel(ModelClient modelClient) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (modelClient == null) throw new ArgumentNullException(nameof(modelClient)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1753,7 +1693,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { @@ -1788,75 +1728,37 @@ namespace Org.OpenAPITools.Api } } - partial void FormatTestEndpointParameters(ref byte[] varByte, ref decimal number, ref double varDouble, ref string patternWithoutDelimiter, ref DateTime? date, ref System.IO.Stream binary, ref float? varFloat, ref int? integer, ref int? int32, ref long? int64, ref string varString, ref string password, ref string callback, ref DateTime? dateTime); + partial void FormatTestEndpointParameters(ref byte[] varByte, ref decimal number, ref double varDouble, ref string patternWithoutDelimiter, ref Option date, ref Option binary, ref Option varFloat, ref Option integer, ref Option int32, ref Option int64, ref Option varString, ref Option password, ref Option callback, ref Option dateTime); /// /// Validates the request parameters /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// /// + /// + /// + /// /// - /// + /// /// - private void ValidateTestEndpointParameters(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date, System.IO.Stream binary, float? varFloat, int? integer, int? int32, long? int64, string varString, string password, string callback, DateTime? dateTime) + private void ValidateTestEndpointParameters(Option password, string patternWithoutDelimiter, Option binary, Option varString, Option callback, byte[] varByte) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (varByte == null) - throw new ArgumentNullException(nameof(varByte)); - - if (number == null) - throw new ArgumentNullException(nameof(number)); - - if (varDouble == null) - throw new ArgumentNullException(nameof(varDouble)); + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password)); if (patternWithoutDelimiter == null) throw new ArgumentNullException(nameof(patternWithoutDelimiter)); - if (date == null) - throw new ArgumentNullException(nameof(date)); - - if (binary == null) + if (binary.IsSet && binary.Value == null) throw new ArgumentNullException(nameof(binary)); - if (varFloat == null) - throw new ArgumentNullException(nameof(varFloat)); - - if (integer == null) - throw new ArgumentNullException(nameof(integer)); - - if (int32 == null) - throw new ArgumentNullException(nameof(int32)); - - if (int64 == null) - throw new ArgumentNullException(nameof(int64)); - - if (varString == null) + if (varString.IsSet && varString.Value == null) throw new ArgumentNullException(nameof(varString)); - if (password == null) - throw new ArgumentNullException(nameof(password)); - - if (callback == null) + if (callback.IsSet && callback.Value == null) throw new ArgumentNullException(nameof(callback)); - if (dateTime == null) - throw new ArgumentNullException(nameof(dateTime)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + if (varByte == null) + throw new ArgumentNullException(nameof(varByte)); } /// @@ -1877,7 +1779,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterTestEndpointParametersDefaultImplementation(ApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date, System.IO.Stream binary, float? varFloat, int? integer, int? int32, long? int64, string varString, string password, string callback, DateTime? dateTime) + private void AfterTestEndpointParametersDefaultImplementation(ApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date, Option binary, Option varFloat, Option integer, Option int32, Option int64, Option varString, Option password, Option callback, Option dateTime) { bool suppressDefaultLog = false; AfterTestEndpointParameters(ref suppressDefaultLog, apiResponseLocalVar, varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime); @@ -1904,7 +1806,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterTestEndpointParameters(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date, System.IO.Stream binary, float? varFloat, int? integer, int? int32, long? int64, string varString, string password, string callback, DateTime? dateTime); + partial void AfterTestEndpointParameters(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date, Option binary, Option varFloat, Option integer, Option int32, Option int64, Option varString, Option password, Option callback, Option dateTime); /// /// Logs exceptions that occur while retrieving the server response @@ -1926,7 +1828,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorTestEndpointParametersDefaultImplementation(Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date, System.IO.Stream binary, float? varFloat, int? integer, int? int32, long? int64, string varString, string password, string callback, DateTime? dateTime) + private void OnErrorTestEndpointParametersDefaultImplementation(Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date, Option binary, Option varFloat, Option integer, Option int32, Option int64, Option varString, Option password, Option callback, Option dateTime) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorTestEndpointParameters(exception, pathFormat, path, varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime); @@ -1952,7 +1854,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorTestEndpointParameters(Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date, System.IO.Stream binary, float? varFloat, int? integer, int? int32, long? int64, string varString, string password, string callback, DateTime? dateTime); + partial void OnErrorTestEndpointParameters(Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date, Option binary, Option varFloat, Option integer, Option int32, Option int64, Option varString, Option password, Option callback, Option dateTime); /// /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -1973,7 +1875,7 @@ namespace Org.OpenAPITools.Api /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") /// Cancellation Token to cancel the request. /// <> where T : - public async Task> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date = null, System.IO.Stream binary = null, float? varFloat = null, int? integer = null, int? int32 = null, long? int64 = null, string varString = null, string password = null, string callback = null, DateTime? dateTime = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date = default, Option binary = default, Option varFloat = default, Option integer = default, Option int32 = default, Option int64 = default, Option varString = default, Option password = default, Option callback = default, Option dateTime = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -2005,13 +1907,13 @@ namespace Org.OpenAPITools.Api /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") /// Cancellation Token to cancel the request. /// <> where T : - public async Task> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date = null, System.IO.Stream binary = null, float? varFloat = null, int? integer = null, int? int32 = null, long? int64 = null, string varString = null, string password = null, string callback = null, DateTime? dateTime = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date = default, Option binary = default, Option varFloat = default, Option integer = default, Option int32 = default, Option int64 = default, Option varString = default, Option password = default, Option callback = default, Option dateTime = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateTestEndpointParameters(varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime); + ValidateTestEndpointParameters(password, patternWithoutDelimiter, binary, varString, callback, varByte); FormatTestEndpointParameters(ref varByte, ref number, ref varDouble, ref patternWithoutDelimiter, ref date, ref binary, ref varFloat, ref integer, ref int32, ref int64, ref varString, ref password, ref callback, ref dateTime); @@ -2038,35 +1940,35 @@ namespace Org.OpenAPITools.Api formParameterLocalVars.Add(new KeyValuePair("pattern_without_delimiter", ClientUtils.ParameterToString(patternWithoutDelimiter))); - if (date != null) - formParameterLocalVars.Add(new KeyValuePair("date", ClientUtils.ParameterToString(date))); + if (date.IsSet) + formParameterLocalVars.Add(new KeyValuePair("date", ClientUtils.ParameterToString(date.Value))); - if (binary != null) - multipartContentLocalVar.Add(new StreamContent(binary)); + if (binary.IsSet) + multipartContentLocalVar.Add(new StreamContent(binary.Value)); - if (varFloat != null) - formParameterLocalVars.Add(new KeyValuePair("float", ClientUtils.ParameterToString(varFloat))); + if (varFloat.IsSet) + formParameterLocalVars.Add(new KeyValuePair("float", ClientUtils.ParameterToString(varFloat.Value))); - if (integer != null) - formParameterLocalVars.Add(new KeyValuePair("integer", ClientUtils.ParameterToString(integer))); + if (integer.IsSet) + formParameterLocalVars.Add(new KeyValuePair("integer", ClientUtils.ParameterToString(integer.Value))); - if (int32 != null) - formParameterLocalVars.Add(new KeyValuePair("int32", ClientUtils.ParameterToString(int32))); + if (int32.IsSet) + formParameterLocalVars.Add(new KeyValuePair("int32", ClientUtils.ParameterToString(int32.Value))); - if (int64 != null) - formParameterLocalVars.Add(new KeyValuePair("int64", ClientUtils.ParameterToString(int64))); + if (int64.IsSet) + formParameterLocalVars.Add(new KeyValuePair("int64", ClientUtils.ParameterToString(int64.Value))); - if (varString != null) - formParameterLocalVars.Add(new KeyValuePair("string", ClientUtils.ParameterToString(varString))); + if (varString.IsSet) + formParameterLocalVars.Add(new KeyValuePair("string", ClientUtils.ParameterToString(varString.Value))); - if (password != null) - formParameterLocalVars.Add(new KeyValuePair("password", ClientUtils.ParameterToString(password))); + if (password.IsSet) + formParameterLocalVars.Add(new KeyValuePair("password", ClientUtils.ParameterToString(password.Value))); - if (callback != null) - formParameterLocalVars.Add(new KeyValuePair("callback", ClientUtils.ParameterToString(callback))); + if (callback.IsSet) + formParameterLocalVars.Add(new KeyValuePair("callback", ClientUtils.ParameterToString(callback.Value))); - if (dateTime != null) - formParameterLocalVars.Add(new KeyValuePair("dateTime", ClientUtils.ParameterToString(dateTime))); + if (dateTime.IsSet) + formParameterLocalVars.Add(new KeyValuePair("dateTime", ClientUtils.ParameterToString(dateTime.Value))); List tokenBaseLocalVars = new List(); @@ -2084,7 +1986,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Post; @@ -2114,51 +2016,37 @@ namespace Org.OpenAPITools.Api } } - partial void FormatTestEnumParameters(List enumHeaderStringArray, List enumQueryStringArray, ref double? enumQueryDouble, ref int? enumQueryInteger, List enumFormStringArray, ref string enumHeaderString, ref string enumQueryString, ref string enumFormString); + partial void FormatTestEnumParameters(Option> enumHeaderStringArray, Option> enumQueryStringArray, ref Option enumQueryDouble, ref Option enumQueryInteger, Option> enumFormStringArray, ref Option enumHeaderString, ref Option enumQueryString, ref Option enumFormString); /// /// Validates the request parameters /// - /// /// - /// - /// /// /// - /// + /// /// + /// /// - private void ValidateTestEnumParameters(List enumHeaderStringArray, List enumQueryStringArray, double? enumQueryDouble, int? enumQueryInteger, List enumFormStringArray, string enumHeaderString, string enumQueryString, string enumFormString) + private void ValidateTestEnumParameters(Option> enumQueryStringArray, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumFormString, Option enumQueryString) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (enumHeaderStringArray == null) - throw new ArgumentNullException(nameof(enumHeaderStringArray)); - - if (enumQueryStringArray == null) + if (enumQueryStringArray.IsSet && enumQueryStringArray.Value == null) throw new ArgumentNullException(nameof(enumQueryStringArray)); - if (enumQueryDouble == null) - throw new ArgumentNullException(nameof(enumQueryDouble)); - - if (enumQueryInteger == null) - throw new ArgumentNullException(nameof(enumQueryInteger)); - - if (enumFormStringArray == null) + if (enumFormStringArray.IsSet && enumFormStringArray.Value == null) throw new ArgumentNullException(nameof(enumFormStringArray)); - if (enumHeaderString == null) + if (enumHeaderString.IsSet && enumHeaderString.Value == null) throw new ArgumentNullException(nameof(enumHeaderString)); - if (enumQueryString == null) - throw new ArgumentNullException(nameof(enumQueryString)); + if (enumHeaderStringArray.IsSet && enumHeaderStringArray.Value == null) + throw new ArgumentNullException(nameof(enumHeaderStringArray)); - if (enumFormString == null) + if (enumFormString.IsSet && enumFormString.Value == null) throw new ArgumentNullException(nameof(enumFormString)); - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + if (enumQueryString.IsSet && enumQueryString.Value == null) + throw new ArgumentNullException(nameof(enumQueryString)); } /// @@ -2173,7 +2061,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterTestEnumParametersDefaultImplementation(ApiResponse apiResponseLocalVar, List enumHeaderStringArray, List enumQueryStringArray, double? enumQueryDouble, int? enumQueryInteger, List enumFormStringArray, string enumHeaderString, string enumQueryString, string enumFormString) + private void AfterTestEnumParametersDefaultImplementation(ApiResponse apiResponseLocalVar, Option> enumHeaderStringArray, Option> enumQueryStringArray, Option enumQueryDouble, Option enumQueryInteger, Option> enumFormStringArray, Option enumHeaderString, Option enumQueryString, Option enumFormString) { bool suppressDefaultLog = false; AfterTestEnumParameters(ref suppressDefaultLog, apiResponseLocalVar, enumHeaderStringArray, enumQueryStringArray, enumQueryDouble, enumQueryInteger, enumFormStringArray, enumHeaderString, enumQueryString, enumFormString); @@ -2194,7 +2082,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterTestEnumParameters(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, List enumHeaderStringArray, List enumQueryStringArray, double? enumQueryDouble, int? enumQueryInteger, List enumFormStringArray, string enumHeaderString, string enumQueryString, string enumFormString); + partial void AfterTestEnumParameters(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, Option> enumHeaderStringArray, Option> enumQueryStringArray, Option enumQueryDouble, Option enumQueryInteger, Option> enumFormStringArray, Option enumHeaderString, Option enumQueryString, Option enumFormString); /// /// Logs exceptions that occur while retrieving the server response @@ -2210,7 +2098,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorTestEnumParametersDefaultImplementation(Exception exception, string pathFormat, string path, List enumHeaderStringArray, List enumQueryStringArray, double? enumQueryDouble, int? enumQueryInteger, List enumFormStringArray, string enumHeaderString, string enumQueryString, string enumFormString) + private void OnErrorTestEnumParametersDefaultImplementation(Exception exception, string pathFormat, string path, Option> enumHeaderStringArray, Option> enumQueryStringArray, Option enumQueryDouble, Option enumQueryInteger, Option> enumFormStringArray, Option enumHeaderString, Option enumQueryString, Option enumFormString) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorTestEnumParameters(exception, pathFormat, path, enumHeaderStringArray, enumQueryStringArray, enumQueryDouble, enumQueryInteger, enumFormStringArray, enumHeaderString, enumQueryString, enumFormString); @@ -2230,7 +2118,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorTestEnumParameters(Exception exception, string pathFormat, string path, List enumHeaderStringArray, List enumQueryStringArray, double? enumQueryDouble, int? enumQueryInteger, List enumFormStringArray, string enumHeaderString, string enumQueryString, string enumFormString); + partial void OnErrorTestEnumParameters(Exception exception, string pathFormat, string path, Option> enumHeaderStringArray, Option> enumQueryStringArray, Option enumQueryDouble, Option enumQueryInteger, Option> enumFormStringArray, Option enumHeaderString, Option enumQueryString, Option enumFormString); /// /// To test enum parameters To test enum parameters @@ -2245,7 +2133,7 @@ namespace Org.OpenAPITools.Api /// Form parameter enum test (string) (optional, default to -efg) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> TestEnumParametersOrDefaultAsync(List enumHeaderStringArray = null, List enumQueryStringArray = null, double? enumQueryDouble = null, int? enumQueryInteger = null, List enumFormStringArray = null, string enumHeaderString = null, string enumQueryString = null, string enumFormString = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> TestEnumParametersOrDefaultAsync(Option> enumHeaderStringArray = default, Option> enumQueryStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option enumQueryString = default, Option enumFormString = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -2271,13 +2159,13 @@ namespace Org.OpenAPITools.Api /// Form parameter enum test (string) (optional, default to -efg) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> TestEnumParametersAsync(List enumHeaderStringArray = null, List enumQueryStringArray = null, double? enumQueryDouble = null, int? enumQueryInteger = null, List enumFormStringArray = null, string enumHeaderString = null, string enumQueryString = null, string enumFormString = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> TestEnumParametersAsync(Option> enumHeaderStringArray = default, Option> enumQueryStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option enumQueryString = default, Option enumFormString = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateTestEnumParameters(enumHeaderStringArray, enumQueryStringArray, enumQueryDouble, enumQueryInteger, enumFormStringArray, enumHeaderString, enumQueryString, enumFormString); + ValidateTestEnumParameters(enumQueryStringArray, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumFormString, enumQueryString); FormatTestEnumParameters(enumHeaderStringArray, enumQueryStringArray, ref enumQueryDouble, ref enumQueryInteger, enumFormStringArray, ref enumHeaderString, ref enumQueryString, ref enumFormString); @@ -2290,25 +2178,25 @@ namespace Org.OpenAPITools.Api System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); - if (enumQueryStringArray != null) - parseQueryStringLocalVar["enum_query_string_array"] = enumQueryStringArray.ToString(); + if (enumQueryStringArray.IsSet) + parseQueryStringLocalVar["enum_query_string_array"] = enumQueryStringArray.Value.ToString(); - if (enumQueryDouble != null) - parseQueryStringLocalVar["enum_query_double"] = enumQueryDouble.ToString(); + if (enumQueryDouble.IsSet) + parseQueryStringLocalVar["enum_query_double"] = enumQueryDouble.Value.ToString(); - if (enumQueryInteger != null) - parseQueryStringLocalVar["enum_query_integer"] = enumQueryInteger.ToString(); + if (enumQueryInteger.IsSet) + parseQueryStringLocalVar["enum_query_integer"] = enumQueryInteger.Value.ToString(); - if (enumQueryString != null) - parseQueryStringLocalVar["enum_query_string"] = enumQueryString.ToString(); + if (enumQueryString.IsSet) + parseQueryStringLocalVar["enum_query_string"] = enumQueryString.Value.ToString(); uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); - if (enumHeaderStringArray != null) - httpRequestMessageLocalVar.Headers.Add("enum_header_string_array", ClientUtils.ParameterToString(enumHeaderStringArray)); + if (enumHeaderStringArray.IsSet) + httpRequestMessageLocalVar.Headers.Add("enum_header_string_array", ClientUtils.ParameterToString(enumHeaderStringArray.Value)); - if (enumHeaderString != null) - httpRequestMessageLocalVar.Headers.Add("enum_header_string", ClientUtils.ParameterToString(enumHeaderString)); + if (enumHeaderString.IsSet) + httpRequestMessageLocalVar.Headers.Add("enum_header_string", ClientUtils.ParameterToString(enumHeaderString.Value)); MultipartContent multipartContentLocalVar = new MultipartContent(); @@ -2316,11 +2204,11 @@ namespace Org.OpenAPITools.Api List> formParameterLocalVars = new List>(); - multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (enumFormStringArray != null) - formParameterLocalVars.Add(new KeyValuePair("enum_form_string_array", ClientUtils.ParameterToString(enumFormStringArray))); + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (enumFormStringArray.IsSet) + formParameterLocalVars.Add(new KeyValuePair("enum_form_string_array", ClientUtils.ParameterToString(enumFormStringArray.Value))); - if (enumFormString != null) - formParameterLocalVars.Add(new KeyValuePair("enum_form_string", ClientUtils.ParameterToString(enumFormString))); + if (enumFormString.IsSet) + formParameterLocalVars.Add(new KeyValuePair("enum_form_string", ClientUtils.ParameterToString(enumFormString.Value))); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; @@ -2330,7 +2218,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Get; @@ -2356,44 +2244,7 @@ namespace Org.OpenAPITools.Api } } - partial void FormatTestGroupParameters(ref bool requiredBooleanGroup, ref int requiredStringGroup, ref long requiredInt64Group, ref bool? booleanGroup, ref int? stringGroup, ref long? int64Group); - - /// - /// Validates the request parameters - /// - /// - /// - /// - /// - /// - /// - /// - private void ValidateTestGroupParameters(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup, int? stringGroup, long? int64Group) - { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (requiredBooleanGroup == null) - throw new ArgumentNullException(nameof(requiredBooleanGroup)); - - if (requiredStringGroup == null) - throw new ArgumentNullException(nameof(requiredStringGroup)); - - if (requiredInt64Group == null) - throw new ArgumentNullException(nameof(requiredInt64Group)); - - if (booleanGroup == null) - throw new ArgumentNullException(nameof(booleanGroup)); - - if (stringGroup == null) - throw new ArgumentNullException(nameof(stringGroup)); - - if (int64Group == null) - throw new ArgumentNullException(nameof(int64Group)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - } + partial void FormatTestGroupParameters(ref bool requiredBooleanGroup, ref int requiredStringGroup, ref long requiredInt64Group, ref Option booleanGroup, ref Option stringGroup, ref Option int64Group); /// /// Processes the server response @@ -2405,7 +2256,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterTestGroupParametersDefaultImplementation(ApiResponse apiResponseLocalVar, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup, int? stringGroup, long? int64Group) + private void AfterTestGroupParametersDefaultImplementation(ApiResponse apiResponseLocalVar, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup, Option stringGroup, Option int64Group) { bool suppressDefaultLog = false; AfterTestGroupParameters(ref suppressDefaultLog, apiResponseLocalVar, requiredBooleanGroup, requiredStringGroup, requiredInt64Group, booleanGroup, stringGroup, int64Group); @@ -2424,7 +2275,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterTestGroupParameters(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup, int? stringGroup, long? int64Group); + partial void AfterTestGroupParameters(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup, Option stringGroup, Option int64Group); /// /// Logs exceptions that occur while retrieving the server response @@ -2438,7 +2289,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorTestGroupParametersDefaultImplementation(Exception exception, string pathFormat, string path, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup, int? stringGroup, long? int64Group) + private void OnErrorTestGroupParametersDefaultImplementation(Exception exception, string pathFormat, string path, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup, Option stringGroup, Option int64Group) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorTestGroupParameters(exception, pathFormat, path, requiredBooleanGroup, requiredStringGroup, requiredInt64Group, booleanGroup, stringGroup, int64Group); @@ -2456,7 +2307,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorTestGroupParameters(Exception exception, string pathFormat, string path, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup, int? stringGroup, long? int64Group); + partial void OnErrorTestGroupParameters(Exception exception, string pathFormat, string path, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup, Option stringGroup, Option int64Group); /// /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) @@ -2469,7 +2320,7 @@ namespace Org.OpenAPITools.Api /// Integer in group parameters (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> TestGroupParametersOrDefaultAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup = null, int? stringGroup = null, long? int64Group = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> TestGroupParametersOrDefaultAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup = default, Option stringGroup = default, Option int64Group = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -2493,14 +2344,12 @@ namespace Org.OpenAPITools.Api /// Integer in group parameters (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> TestGroupParametersAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup = null, int? stringGroup = null, long? int64Group = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> TestGroupParametersAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup = default, Option stringGroup = default, Option int64Group = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateTestGroupParameters(requiredBooleanGroup, requiredStringGroup, requiredInt64Group, booleanGroup, stringGroup, int64Group); - FormatTestGroupParameters(ref requiredBooleanGroup, ref requiredStringGroup, ref requiredInt64Group, ref booleanGroup, ref stringGroup, ref int64Group); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -2515,18 +2364,18 @@ namespace Org.OpenAPITools.Api parseQueryStringLocalVar["required_string_group"] = requiredStringGroup.ToString(); parseQueryStringLocalVar["required_int64_group"] = requiredInt64Group.ToString(); - if (stringGroup != null) - parseQueryStringLocalVar["string_group"] = stringGroup.ToString(); + if (stringGroup.IsSet) + parseQueryStringLocalVar["string_group"] = stringGroup.Value.ToString(); - if (int64Group != null) - parseQueryStringLocalVar["int64_group"] = int64Group.ToString(); + if (int64Group.IsSet) + parseQueryStringLocalVar["int64_group"] = int64Group.Value.ToString(); uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); httpRequestMessageLocalVar.Headers.Add("required_boolean_group", ClientUtils.ParameterToString(requiredBooleanGroup)); - if (booleanGroup != null) - httpRequestMessageLocalVar.Headers.Add("boolean_group", ClientUtils.ParameterToString(booleanGroup)); + if (booleanGroup.IsSet) + httpRequestMessageLocalVar.Headers.Add("boolean_group", ClientUtils.ParameterToString(booleanGroup.Value)); List tokenBaseLocalVars = new List(); @@ -2574,14 +2423,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateTestInlineAdditionalProperties(Dictionary requestBody) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (requestBody == null) throw new ArgumentNullException(nameof(requestBody)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -2681,7 +2524,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Post; @@ -2717,17 +2560,11 @@ namespace Org.OpenAPITools.Api /// private void ValidateTestJsonFormData(string param, string param2) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (param == null) throw new ArgumentNullException(nameof(param)); if (param2 == null) throw new ArgumentNullException(nameof(param2)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -2841,7 +2678,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Get; @@ -2867,39 +2704,41 @@ namespace Org.OpenAPITools.Api } } - partial void FormatTestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context); + partial void FormatTestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, ref string requiredNotNullable, ref string requiredNullable, ref Option notRequiredNotNullable, ref Option notRequiredNullable); /// /// Validates the request parameters /// /// - /// /// - /// + /// /// + /// + /// + /// /// - private void ValidateTestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) + private void ValidateTestQueryParameterCollectionFormat(List pipe, List http, Option notRequiredNotNullable, List context, List ioutil, string requiredNotNullable, List url) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (pipe == null) throw new ArgumentNullException(nameof(pipe)); - if (ioutil == null) - throw new ArgumentNullException(nameof(ioutil)); - if (http == null) throw new ArgumentNullException(nameof(http)); - if (url == null) - throw new ArgumentNullException(nameof(url)); + if (notRequiredNotNullable.IsSet && notRequiredNotNullable.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotNullable)); if (context == null) throw new ArgumentNullException(nameof(context)); - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + if (ioutil == null) + throw new ArgumentNullException(nameof(ioutil)); + + if (requiredNotNullable == null) + throw new ArgumentNullException(nameof(requiredNotNullable)); + + if (url == null) + throw new ArgumentNullException(nameof(url)); } /// @@ -2911,10 +2750,14 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterTestQueryParameterCollectionFormatDefaultImplementation(ApiResponse apiResponseLocalVar, List pipe, List ioutil, List http, List url, List context) + /// + /// + /// + /// + private void AfterTestQueryParameterCollectionFormatDefaultImplementation(ApiResponse apiResponseLocalVar, List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, Option notRequiredNotNullable, Option notRequiredNullable) { bool suppressDefaultLog = false; - AfterTestQueryParameterCollectionFormat(ref suppressDefaultLog, apiResponseLocalVar, pipe, ioutil, http, url, context); + AfterTestQueryParameterCollectionFormat(ref suppressDefaultLog, apiResponseLocalVar, pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); if (!suppressDefaultLog) Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); } @@ -2929,7 +2772,11 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterTestQueryParameterCollectionFormat(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, List pipe, List ioutil, List http, List url, List context); + /// + /// + /// + /// + partial void AfterTestQueryParameterCollectionFormat(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, Option notRequiredNotNullable, Option notRequiredNullable); /// /// Logs exceptions that occur while retrieving the server response @@ -2942,10 +2789,14 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorTestQueryParameterCollectionFormatDefaultImplementation(Exception exception, string pathFormat, string path, List pipe, List ioutil, List http, List url, List context) + /// + /// + /// + /// + private void OnErrorTestQueryParameterCollectionFormatDefaultImplementation(Exception exception, string pathFormat, string path, List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, Option notRequiredNotNullable, Option notRequiredNullable) { Logger.LogError(exception, "An error occurred while sending the request to the server."); - OnErrorTestQueryParameterCollectionFormat(exception, pathFormat, path, pipe, ioutil, http, url, context); + OnErrorTestQueryParameterCollectionFormat(exception, pathFormat, path, pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } /// @@ -2959,7 +2810,11 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorTestQueryParameterCollectionFormat(Exception exception, string pathFormat, string path, List pipe, List ioutil, List http, List url, List context); + /// + /// + /// + /// + partial void OnErrorTestQueryParameterCollectionFormat(Exception exception, string pathFormat, string path, List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, Option notRequiredNotNullable, Option notRequiredNullable); /// /// To test the collection format in query parameters @@ -2969,13 +2824,17 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> TestQueryParameterCollectionFormatOrDefaultAsync(List pipe, List ioutil, List http, List url, List context, System.Threading.CancellationToken cancellationToken = default) + public async Task> TestQueryParameterCollectionFormatOrDefaultAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable = default, Option notRequiredNotNullable = default, Option notRequiredNullable = default, System.Threading.CancellationToken cancellationToken = default) { try { - return await TestQueryParameterCollectionFormatAsync(pipe, ioutil, http, url, context, cancellationToken).ConfigureAwait(false); + return await TestQueryParameterCollectionFormatAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable, cancellationToken).ConfigureAwait(false); } catch (Exception) { @@ -2992,17 +2851,21 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, System.Threading.CancellationToken cancellationToken = default) + public async Task> TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable = default, Option notRequiredNotNullable = default, Option notRequiredNullable = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + ValidateTestQueryParameterCollectionFormat(pipe, http, notRequiredNotNullable, context, ioutil, requiredNotNullable, url); - FormatTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + FormatTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, ref requiredNotNullable, ref requiredNullable, ref notRequiredNotNullable, ref notRequiredNullable); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) { @@ -3018,6 +2881,14 @@ namespace Org.OpenAPITools.Api parseQueryStringLocalVar["http"] = http.ToString(); parseQueryStringLocalVar["url"] = url.ToString(); parseQueryStringLocalVar["context"] = context.ToString(); + parseQueryStringLocalVar["requiredNotNullable"] = requiredNotNullable.ToString(); + parseQueryStringLocalVar["requiredNullable"] = requiredNullable.ToString(); + + if (notRequiredNotNullable.IsSet) + parseQueryStringLocalVar["notRequiredNotNullable"] = notRequiredNotNullable.Value.ToString(); + + if (notRequiredNullable.IsSet) + parseQueryStringLocalVar["notRequiredNullable"] = notRequiredNullable.Value.ToString(); uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); @@ -3033,7 +2904,7 @@ namespace Org.OpenAPITools.Api ApiResponse apiResponseLocalVar = new ApiResponse(httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/test-query-parameters", requestedAtLocalVar, _jsonSerializerOptions); - AfterTestQueryParameterCollectionFormatDefaultImplementation(apiResponseLocalVar, pipe, ioutil, http, url, context); + AfterTestQueryParameterCollectionFormatDefaultImplementation(apiResponseLocalVar, pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); return apiResponseLocalVar; } @@ -3041,7 +2912,7 @@ namespace Org.OpenAPITools.Api } catch(Exception e) { - OnErrorTestQueryParameterCollectionFormatDefaultImplementation(e, "/fake/test-query-parameters", uriBuilderLocalVar.Path, pipe, ioutil, http, url, context); + OnErrorTestQueryParameterCollectionFormatDefaultImplementation(e, "/fake/test-query-parameters", uriBuilderLocalVar.Path, pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); throw; } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index f4621102adb..229a39450b5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -126,14 +126,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateTestClassname(ModelClient modelClient) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (modelClient == null) throw new ArgumentNullException(nameof(modelClient)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -244,7 +238,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs index b2d54ca9696..6321536be53 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs @@ -61,7 +61,7 @@ namespace Org.OpenAPITools.IApi /// (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<object>> - Task> DeletePetAsync(long petId, string apiKey = null, System.Threading.CancellationToken cancellationToken = default); + Task> DeletePetAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default); /// /// Deletes a pet @@ -73,7 +73,7 @@ namespace Org.OpenAPITools.IApi /// (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>object>> - Task> DeletePetOrDefaultAsync(long petId, string apiKey = null, System.Threading.CancellationToken cancellationToken = default); + Task> DeletePetOrDefaultAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default); /// /// Finds Pets by status @@ -179,7 +179,7 @@ namespace Org.OpenAPITools.IApi /// Updated status of the pet (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<object>> - Task> UpdatePetWithFormAsync(long petId, string name = null, string status = null, System.Threading.CancellationToken cancellationToken = default); + Task> UpdatePetWithFormAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default); /// /// Updates a pet in the store with form data @@ -192,7 +192,7 @@ namespace Org.OpenAPITools.IApi /// Updated status of the pet (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>object>> - Task> UpdatePetWithFormOrDefaultAsync(long petId, string name = null, string status = null, System.Threading.CancellationToken cancellationToken = default); + Task> UpdatePetWithFormOrDefaultAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default); /// /// uploads an image @@ -206,7 +206,7 @@ namespace Org.OpenAPITools.IApi /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<ApiResponse>> - Task> UploadFileAsync(long petId, System.IO.Stream file = null, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default); + Task> UploadFileAsync(long petId, Option file = default, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default); /// /// uploads an image @@ -219,7 +219,7 @@ namespace Org.OpenAPITools.IApi /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>ApiResponse>> - Task> UploadFileOrDefaultAsync(long petId, System.IO.Stream file = null, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default); + Task> UploadFileOrDefaultAsync(long petId, Option file = default, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default); /// /// uploads an image (required) @@ -233,7 +233,7 @@ namespace Org.OpenAPITools.IApi /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<ApiResponse>> - Task> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default); + Task> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default); /// /// uploads an image (required) @@ -246,7 +246,7 @@ namespace Org.OpenAPITools.IApi /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>ApiResponse>> - Task> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default); + Task> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default); } } @@ -324,14 +324,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateAddPet(Pet pet) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (pet == null) throw new ArgumentNullException(nameof(pet)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -437,9 +431,11 @@ namespace Org.OpenAPITools.Api tokenBaseLocalVars.Add(httpSignatureTokenLocalVar); - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } string[] contentTypes = new string[] { "application/json", @@ -448,7 +444,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Post; @@ -482,27 +478,17 @@ namespace Org.OpenAPITools.Api } } - partial void FormatDeletePet(ref long petId, ref string apiKey); + partial void FormatDeletePet(ref long petId, ref Option apiKey); /// /// Validates the request parameters /// - /// /// /// - private void ValidateDeletePet(long petId, string apiKey) + private void ValidateDeletePet(Option apiKey) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (petId == null) - throw new ArgumentNullException(nameof(petId)); - - if (apiKey == null) + if (apiKey.IsSet && apiKey.Value == null) throw new ArgumentNullException(nameof(apiKey)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -511,7 +497,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterDeletePetDefaultImplementation(ApiResponse apiResponseLocalVar, long petId, string apiKey) + private void AfterDeletePetDefaultImplementation(ApiResponse apiResponseLocalVar, long petId, Option apiKey) { bool suppressDefaultLog = false; AfterDeletePet(ref suppressDefaultLog, apiResponseLocalVar, petId, apiKey); @@ -526,7 +512,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterDeletePet(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, long petId, string apiKey); + partial void AfterDeletePet(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, long petId, Option apiKey); /// /// Logs exceptions that occur while retrieving the server response @@ -536,7 +522,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorDeletePetDefaultImplementation(Exception exception, string pathFormat, string path, long petId, string apiKey) + private void OnErrorDeletePetDefaultImplementation(Exception exception, string pathFormat, string path, long petId, Option apiKey) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorDeletePet(exception, pathFormat, path, petId, apiKey); @@ -550,7 +536,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorDeletePet(Exception exception, string pathFormat, string path, long petId, string apiKey); + partial void OnErrorDeletePet(Exception exception, string pathFormat, string path, long petId, Option apiKey); /// /// Deletes a pet @@ -559,7 +545,7 @@ namespace Org.OpenAPITools.Api /// (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> DeletePetOrDefaultAsync(long petId, string apiKey = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> DeletePetOrDefaultAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -579,13 +565,13 @@ namespace Org.OpenAPITools.Api /// (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> DeletePetAsync(long petId, string apiKey = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> DeletePetAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateDeletePet(petId, apiKey); + ValidateDeletePet(apiKey); FormatDeletePet(ref petId, ref apiKey); @@ -597,8 +583,8 @@ namespace Org.OpenAPITools.Api uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/{petId}"; uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); - if (apiKey != null) - httpRequestMessageLocalVar.Headers.Add("api_key", ClientUtils.ParameterToString(apiKey)); + if (apiKey.IsSet) + httpRequestMessageLocalVar.Headers.Add("api_key", ClientUtils.ParameterToString(apiKey.Value)); List tokenBaseLocalVars = new List(); @@ -646,14 +632,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateFindPetsByStatus(List status) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (status == null) throw new ArgumentNullException(nameof(status)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -761,9 +741,11 @@ namespace Org.OpenAPITools.Api tokenBaseLocalVars.Add(httpSignatureTokenLocalVar); - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } string[] acceptLocalVars = new string[] { "application/xml", @@ -815,14 +797,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateFindPetsByTags(List tags) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (tags == null) throw new ArgumentNullException(nameof(tags)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -930,9 +906,11 @@ namespace Org.OpenAPITools.Api tokenBaseLocalVars.Add(httpSignatureTokenLocalVar); - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } string[] acceptLocalVars = new string[] { "application/xml", @@ -977,23 +955,6 @@ namespace Org.OpenAPITools.Api partial void FormatGetPetById(ref long petId); - /// - /// Validates the request parameters - /// - /// - /// - private void ValidateGetPetById(long petId) - { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (petId == null) - throw new ArgumentNullException(nameof(petId)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - } - /// /// Processes the server response /// @@ -1068,8 +1029,6 @@ namespace Org.OpenAPITools.Api try { - ValidateGetPetById(petId); - FormatGetPetById(ref petId); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -1136,14 +1095,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateUpdatePet(Pet pet) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (pet == null) throw new ArgumentNullException(nameof(pet)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1249,9 +1202,11 @@ namespace Org.OpenAPITools.Api tokenBaseLocalVars.Add(httpSignatureTokenLocalVar); - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } string[] contentTypes = new string[] { "application/json", @@ -1260,7 +1215,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Put; @@ -1294,31 +1249,21 @@ namespace Org.OpenAPITools.Api } } - partial void FormatUpdatePetWithForm(ref long petId, ref string name, ref string status); + partial void FormatUpdatePetWithForm(ref long petId, ref Option name, ref Option status); /// /// Validates the request parameters /// - /// - /// /// + /// /// - private void ValidateUpdatePetWithForm(long petId, string name, string status) + private void ValidateUpdatePetWithForm(Option status, Option name) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (petId == null) - throw new ArgumentNullException(nameof(petId)); - - if (name == null) - throw new ArgumentNullException(nameof(name)); - - if (status == null) + if (status.IsSet && status.Value == null) throw new ArgumentNullException(nameof(status)); - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name)); } /// @@ -1328,7 +1273,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterUpdatePetWithFormDefaultImplementation(ApiResponse apiResponseLocalVar, long petId, string name, string status) + private void AfterUpdatePetWithFormDefaultImplementation(ApiResponse apiResponseLocalVar, long petId, Option name, Option status) { bool suppressDefaultLog = false; AfterUpdatePetWithForm(ref suppressDefaultLog, apiResponseLocalVar, petId, name, status); @@ -1344,7 +1289,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterUpdatePetWithForm(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, long petId, string name, string status); + partial void AfterUpdatePetWithForm(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, long petId, Option name, Option status); /// /// Logs exceptions that occur while retrieving the server response @@ -1355,7 +1300,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorUpdatePetWithFormDefaultImplementation(Exception exception, string pathFormat, string path, long petId, string name, string status) + private void OnErrorUpdatePetWithFormDefaultImplementation(Exception exception, string pathFormat, string path, long petId, Option name, Option status) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorUpdatePetWithForm(exception, pathFormat, path, petId, name, status); @@ -1370,7 +1315,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorUpdatePetWithForm(Exception exception, string pathFormat, string path, long petId, string name, string status); + partial void OnErrorUpdatePetWithForm(Exception exception, string pathFormat, string path, long petId, Option name, Option status); /// /// Updates a pet in the store with form data @@ -1380,7 +1325,7 @@ namespace Org.OpenAPITools.Api /// Updated status of the pet (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> UpdatePetWithFormOrDefaultAsync(long petId, string name = null, string status = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> UpdatePetWithFormOrDefaultAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -1401,13 +1346,13 @@ namespace Org.OpenAPITools.Api /// Updated status of the pet (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> UpdatePetWithFormAsync(long petId, string name = null, string status = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> UpdatePetWithFormAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateUpdatePetWithForm(petId, name, status); + ValidateUpdatePetWithForm(status, name); FormatUpdatePetWithForm(ref petId, ref name, ref status); @@ -1425,11 +1370,11 @@ namespace Org.OpenAPITools.Api List> formParameterLocalVars = new List>(); - multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (name != null) - formParameterLocalVars.Add(new KeyValuePair("name", ClientUtils.ParameterToString(name))); + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (name.IsSet) + formParameterLocalVars.Add(new KeyValuePair("name", ClientUtils.ParameterToString(name.Value))); - if (status != null) - formParameterLocalVars.Add(new KeyValuePair("status", ClientUtils.ParameterToString(status))); + if (status.IsSet) + formParameterLocalVars.Add(new KeyValuePair("status", ClientUtils.ParameterToString(status.Value))); List tokenBaseLocalVars = new List(); @@ -1447,7 +1392,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Post; @@ -1477,31 +1422,21 @@ namespace Org.OpenAPITools.Api } } - partial void FormatUploadFile(ref long petId, ref System.IO.Stream file, ref string additionalMetadata); + partial void FormatUploadFile(ref long petId, ref Option file, ref Option additionalMetadata); /// /// Validates the request parameters /// - /// /// /// /// - private void ValidateUploadFile(long petId, System.IO.Stream file, string additionalMetadata) + private void ValidateUploadFile(Option file, Option additionalMetadata) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (petId == null) - throw new ArgumentNullException(nameof(petId)); - - if (file == null) + if (file.IsSet && file.Value == null) throw new ArgumentNullException(nameof(file)); - if (additionalMetadata == null) + if (additionalMetadata.IsSet && additionalMetadata.Value == null) throw new ArgumentNullException(nameof(additionalMetadata)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1511,7 +1446,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterUploadFileDefaultImplementation(ApiResponse apiResponseLocalVar, long petId, System.IO.Stream file, string additionalMetadata) + private void AfterUploadFileDefaultImplementation(ApiResponse apiResponseLocalVar, long petId, Option file, Option additionalMetadata) { bool suppressDefaultLog = false; AfterUploadFile(ref suppressDefaultLog, apiResponseLocalVar, petId, file, additionalMetadata); @@ -1527,7 +1462,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterUploadFile(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, long petId, System.IO.Stream file, string additionalMetadata); + partial void AfterUploadFile(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, long petId, Option file, Option additionalMetadata); /// /// Logs exceptions that occur while retrieving the server response @@ -1538,7 +1473,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorUploadFileDefaultImplementation(Exception exception, string pathFormat, string path, long petId, System.IO.Stream file, string additionalMetadata) + private void OnErrorUploadFileDefaultImplementation(Exception exception, string pathFormat, string path, long petId, Option file, Option additionalMetadata) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorUploadFile(exception, pathFormat, path, petId, file, additionalMetadata); @@ -1553,7 +1488,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorUploadFile(Exception exception, string pathFormat, string path, long petId, System.IO.Stream file, string additionalMetadata); + partial void OnErrorUploadFile(Exception exception, string pathFormat, string path, long petId, Option file, Option additionalMetadata); /// /// uploads an image @@ -1563,7 +1498,7 @@ namespace Org.OpenAPITools.Api /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> UploadFileOrDefaultAsync(long petId, System.IO.Stream file = null, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> UploadFileOrDefaultAsync(long petId, Option file = default, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -1584,13 +1519,13 @@ namespace Org.OpenAPITools.Api /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> UploadFileAsync(long petId, System.IO.Stream file = null, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> UploadFileAsync(long petId, Option file = default, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateUploadFile(petId, file, additionalMetadata); + ValidateUploadFile(file, additionalMetadata); FormatUploadFile(ref petId, ref file, ref additionalMetadata); @@ -1608,11 +1543,11 @@ namespace Org.OpenAPITools.Api List> formParameterLocalVars = new List>(); - multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (file != null) - multipartContentLocalVar.Add(new StreamContent(file)); + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (file.IsSet) + multipartContentLocalVar.Add(new StreamContent(file.Value)); - if (additionalMetadata != null) - formParameterLocalVars.Add(new KeyValuePair("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata))); + if (additionalMetadata.IsSet) + formParameterLocalVars.Add(new KeyValuePair("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata.Value))); List tokenBaseLocalVars = new List(); @@ -1630,7 +1565,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { @@ -1669,31 +1604,21 @@ namespace Org.OpenAPITools.Api } } - partial void FormatUploadFileWithRequiredFile(ref System.IO.Stream requiredFile, ref long petId, ref string additionalMetadata); + partial void FormatUploadFileWithRequiredFile(ref System.IO.Stream requiredFile, ref long petId, ref Option additionalMetadata); /// /// Validates the request parameters /// /// - /// /// /// - private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, long petId, string additionalMetadata) + private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, Option additionalMetadata) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (requiredFile == null) throw new ArgumentNullException(nameof(requiredFile)); - if (petId == null) - throw new ArgumentNullException(nameof(petId)); - - if (additionalMetadata == null) + if (additionalMetadata.IsSet && additionalMetadata.Value == null) throw new ArgumentNullException(nameof(additionalMetadata)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1703,7 +1628,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterUploadFileWithRequiredFileDefaultImplementation(ApiResponse apiResponseLocalVar, System.IO.Stream requiredFile, long petId, string additionalMetadata) + private void AfterUploadFileWithRequiredFileDefaultImplementation(ApiResponse apiResponseLocalVar, System.IO.Stream requiredFile, long petId, Option additionalMetadata) { bool suppressDefaultLog = false; AfterUploadFileWithRequiredFile(ref suppressDefaultLog, apiResponseLocalVar, requiredFile, petId, additionalMetadata); @@ -1719,7 +1644,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterUploadFileWithRequiredFile(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, System.IO.Stream requiredFile, long petId, string additionalMetadata); + partial void AfterUploadFileWithRequiredFile(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, System.IO.Stream requiredFile, long petId, Option additionalMetadata); /// /// Logs exceptions that occur while retrieving the server response @@ -1730,7 +1655,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorUploadFileWithRequiredFileDefaultImplementation(Exception exception, string pathFormat, string path, System.IO.Stream requiredFile, long petId, string additionalMetadata) + private void OnErrorUploadFileWithRequiredFileDefaultImplementation(Exception exception, string pathFormat, string path, System.IO.Stream requiredFile, long petId, Option additionalMetadata) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorUploadFileWithRequiredFile(exception, pathFormat, path, requiredFile, petId, additionalMetadata); @@ -1745,7 +1670,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorUploadFileWithRequiredFile(Exception exception, string pathFormat, string path, System.IO.Stream requiredFile, long petId, string additionalMetadata); + partial void OnErrorUploadFileWithRequiredFile(Exception exception, string pathFormat, string path, System.IO.Stream requiredFile, long petId, Option additionalMetadata); /// /// uploads an image (required) @@ -1755,7 +1680,7 @@ namespace Org.OpenAPITools.Api /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -1776,13 +1701,13 @@ namespace Org.OpenAPITools.Api /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateUploadFileWithRequiredFile(requiredFile, petId, additionalMetadata); + ValidateUploadFileWithRequiredFile(requiredFile, additionalMetadata); FormatUploadFileWithRequiredFile(ref requiredFile, ref petId, ref additionalMetadata); @@ -1802,8 +1727,8 @@ namespace Org.OpenAPITools.Api multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); multipartContentLocalVar.Add(new StreamContent(requiredFile)); - if (additionalMetadata != null) - formParameterLocalVars.Add(new KeyValuePair("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata))); + if (additionalMetadata.IsSet) + formParameterLocalVars.Add(new KeyValuePair("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata.Value))); List tokenBaseLocalVars = new List(); @@ -1821,7 +1746,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/StoreApi.cs index 76f72322474..42a157596ce 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/StoreApi.cs @@ -193,14 +193,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateDeleteOrder(string orderId) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (orderId == null) throw new ArgumentNullException(nameof(orderId)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -437,23 +431,6 @@ namespace Org.OpenAPITools.Api partial void FormatGetOrderById(ref long orderId); - /// - /// Validates the request parameters - /// - /// - /// - private void ValidateGetOrderById(long orderId) - { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (orderId == null) - throw new ArgumentNullException(nameof(orderId)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - } - /// /// Processes the server response /// @@ -528,8 +505,6 @@ namespace Org.OpenAPITools.Api try { - ValidateGetOrderById(orderId); - FormatGetOrderById(ref orderId); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -584,14 +559,8 @@ namespace Org.OpenAPITools.Api /// private void ValidatePlaceOrder(Order order) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (order == null) throw new ArgumentNullException(nameof(order)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -691,7 +660,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/UserApi.cs index ea7a4153487..3d47c7f53c3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/UserApi.cs @@ -289,14 +289,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateCreateUser(User user) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (user == null) throw new ArgumentNullException(nameof(user)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -396,7 +390,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Post; @@ -431,14 +425,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateCreateUsersWithArrayInput(List user) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (user == null) throw new ArgumentNullException(nameof(user)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -538,7 +526,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Post; @@ -573,14 +561,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateCreateUsersWithListInput(List user) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (user == null) throw new ArgumentNullException(nameof(user)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -680,7 +662,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Post; @@ -715,14 +697,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateDeleteUser(string username) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (username == null) throw new ArgumentNullException(nameof(username)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -845,14 +821,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateGetUserByName(string username) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (username == null) throw new ArgumentNullException(nameof(username)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -986,17 +956,11 @@ namespace Org.OpenAPITools.Api /// private void ValidateLoginUser(string username, string password) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (username == null) throw new ArgumentNullException(nameof(username)); if (password == null) throw new ArgumentNullException(nameof(password)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1237,22 +1201,16 @@ namespace Org.OpenAPITools.Api /// /// Validates the request parameters /// - /// /// + /// /// - private void ValidateUpdateUser(User user, string username) + private void ValidateUpdateUser(string username, User user) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (user == null) - throw new ArgumentNullException(nameof(user)); - if (username == null) throw new ArgumentNullException(nameof(username)); - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + if (user == null) + throw new ArgumentNullException(nameof(user)); } /// @@ -1335,7 +1293,7 @@ namespace Org.OpenAPITools.Api try { - ValidateUpdateUser(user, username); + ValidateUpdateUser(username, user); FormatUpdateUser(user, ref username); @@ -1359,7 +1317,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = HttpMethod.Put; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/Option.cs new file mode 100644 index 00000000000..70f41078bb6 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/Option.cs @@ -0,0 +1,39 @@ +// +/* + * 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +namespace Org.OpenAPITools.Client +{ + /// + /// A wrapper for operation parameters which are not required + /// + public struct Option + { + /// + /// The value to send to the server + /// + public TType Value { get; } + + /// + /// When true the value will be sent to the server + /// + internal bool IsSet { get; } + + /// + /// A wrapper for operation parameters which are not required + /// + /// + public Option(TType value) + { + IsSet = true; + Value = value; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 48464abd1f9..4bcf2ff282d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -275,13 +275,20 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("empty_map"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); writer.WritePropertyName("map_of_map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); writer.WritePropertyName("map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); writer.WritePropertyName("map_with_undeclared_properties_string"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + writer.WritePropertyName("map_of_map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + writer.WritePropertyName("map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_string"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + writer.WritePropertyName("anytype_1"); JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs index f46a0e8bab0..5caff8d822f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -192,8 +192,10 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("array_array_of_integer"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); writer.WritePropertyName("array_array_of_model"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); writer.WritePropertyName("array_of_string"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + writer.WritePropertyName("array_array_of_model"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + writer.WritePropertyName("array_of_string"); JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs index a6ee8f3ebba..1cda67a3fa9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs @@ -197,9 +197,12 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("mainShape"); - JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); writer.WritePropertyName("shapes"); - JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); writer.WritePropertyName("nullableShape"); - JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); writer.WritePropertyName("shapeOrNull"); + JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + writer.WritePropertyName("nullableShape"); + JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); + writer.WritePropertyName("shapeOrNull"); JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs index c4e5de93130..aff7a4ad3d2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -310,6 +310,7 @@ namespace Org.OpenAPITools.Model { writer.WritePropertyName("array_enum"); JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol); if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 0804787231e..7f31c2f04f5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -175,7 +175,8 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("file"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); writer.WritePropertyName("files"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + writer.WritePropertyName("files"); JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs index 6457a415f71..a58b03e2200 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -587,11 +587,14 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("binary"); - JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); writer.WritePropertyName("byte"); - JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); + JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + writer.WritePropertyName("byte"); + JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); writer.WriteString("dateTime", formatTest.DateTime.ToString(DateTimeFormat)); writer.WritePropertyName("decimal"); - JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); writer.WriteNumber("double", formatTest.VarDouble); + JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); + writer.WriteNumber("double", formatTest.VarDouble); writer.WriteNumber("float", formatTest.VarFloat); writer.WriteNumber("int32", formatTest.Int32); writer.WriteNumber("int64", formatTest.Int64); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs index 448c6477ab5..92da24c3ef1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs @@ -275,9 +275,12 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("direct_map"); - JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); writer.WritePropertyName("indirect_map"); - JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); writer.WritePropertyName("map_map_of_string"); - JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); writer.WritePropertyName("map_of_enum_string"); + JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + writer.WritePropertyName("indirect_map"); + JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + writer.WritePropertyName("map_map_of_string"); + JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + writer.WritePropertyName("map_of_enum_string"); JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 7901d14ec2a..487806c051a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -222,7 +222,8 @@ namespace Org.OpenAPITools.Model { writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.ToString(DateTimeFormat)); writer.WritePropertyName("map"); - JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid); + JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid); writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs index c526cc355f0..5d15b68a30e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs @@ -318,10 +318,14 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("array_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); writer.WritePropertyName("object_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); writer.WritePropertyName("array_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); writer.WritePropertyName("array_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + writer.WritePropertyName("array_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); + writer.WritePropertyName("array_nullable_prop"); JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); + if (nullableClass.BooleanProp != null) writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value); else @@ -348,8 +352,10 @@ namespace Org.OpenAPITools.Model writer.WriteNull("number_prop"); writer.WritePropertyName("object_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); writer.WritePropertyName("object_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); writer.WriteString("string_prop", nullableClass.StringProp); + JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); + writer.WritePropertyName("object_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); + writer.WriteString("string_prop", nullableClass.StringProp); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 010dad50bee..ec1fc811445 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -211,8 +211,10 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("bars"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); writer.WritePropertyName("deprecatedRef"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); writer.WriteNumber("id", objectWithDeprecatedFields.Id); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + writer.WritePropertyName("deprecatedRef"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + writer.WriteNumber("id", objectWithDeprecatedFields.Id); writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs index 8ce91807343..10777ea636e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs @@ -327,10 +327,12 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("category"); - JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); writer.WriteNumber("id", pet.Id); + JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + writer.WriteNumber("id", pet.Id); writer.WriteString("name", pet.Name); writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); + var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status); if (statusRawValue != null) writer.WriteString("status", statusRawValue); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs index 35235f141ee..32f57e24959 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs @@ -339,13 +339,16 @@ namespace Org.OpenAPITools.Model writer.WriteNumber("id", user.Id); writer.WriteString("lastName", user.LastName); writer.WritePropertyName("objectWithNoDeclaredProps"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); writer.WriteString("password", user.Password); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + writer.WriteString("password", user.Password); writer.WriteString("phone", user.Phone); writer.WriteNumber("userStatus", user.UserStatus); writer.WriteString("username", user.Username); writer.WritePropertyName("anyTypeProp"); - JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); writer.WritePropertyName("anyTypePropNullable"); - JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/.openapi-generator/FILES index 2490e7ebb0b..dc6273a3813 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/.openapi-generator/FILES @@ -24,6 +24,7 @@ src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs src/Org.OpenAPITools/Client/HostConfiguration.cs src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +src/Org.OpenAPITools/Client/Option.cs src/Org.OpenAPITools/Client/RateLimitProvider`1.cs src/Org.OpenAPITools/Client/TokenBase.cs src/Org.OpenAPITools/Client/TokenContainer`1.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Api/DefaultApi.cs index f1a6f094910..1e10bdf8c90 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -93,14 +93,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateList(string personId) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (personId == null) throw new ArgumentNullException(nameof(personId)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Client/Option.cs new file mode 100644 index 00000000000..663aecff33e --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Client/Option.cs @@ -0,0 +1,41 @@ +// +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + + +namespace Org.OpenAPITools.Client +{ + /// + /// A wrapper for operation parameters which are not required + /// + public struct Option + { + /// + /// The value to send to the server + /// + public TType Value { get; } + + /// + /// When true the value will be sent to the server + /// + internal bool IsSet { get; } + + /// + /// A wrapper for operation parameters which are not required + /// + /// + public Option(TType value) + { + IsSet = true; + Value = value; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs index 6d4cab8b80f..7f15eb28149 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs @@ -168,7 +168,8 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, Adult adult, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("children"); - JsonSerializer.Serialize(writer, adult.Children, jsonSerializerOptions); writer.WriteString("firstName", adult.FirstName); + JsonSerializer.Serialize(writer, adult.Children, jsonSerializerOptions); + writer.WriteString("firstName", adult.FirstName); writer.WriteString("lastName", adult.LastName); writer.WriteString("$_type", adult.Type); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/.openapi-generator/FILES index a71e463b072..ca078a2045e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/.openapi-generator/FILES @@ -24,6 +24,7 @@ src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs src/Org.OpenAPITools/Client/HostConfiguration.cs src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +src/Org.OpenAPITools/Client/Option.cs src/Org.OpenAPITools/Client/RateLimitProvider`1.cs src/Org.OpenAPITools/Client/TokenBase.cs src/Org.OpenAPITools/Client/TokenContainer`1.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Client/Option.cs new file mode 100644 index 00000000000..3c370b043a5 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Client/Option.cs @@ -0,0 +1,41 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + + +namespace Org.OpenAPITools.Client +{ + /// + /// A wrapper for operation parameters which are not required + /// + public struct Option + { + /// + /// The value to send to the server + /// + public TType Value { get; } + + /// + /// When true the value will be sent to the server + /// + internal bool IsSet { get; } + + /// + /// A wrapper for operation parameters which are not required + /// + /// + public Option(TType value) + { + IsSet = true; + Value = value; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/.openapi-generator/FILES index a71e463b072..ca078a2045e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/.openapi-generator/FILES @@ -24,6 +24,7 @@ src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs src/Org.OpenAPITools/Client/HostConfiguration.cs src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +src/Org.OpenAPITools/Client/Option.cs src/Org.OpenAPITools/Client/RateLimitProvider`1.cs src/Org.OpenAPITools/Client/TokenBase.cs src/Org.OpenAPITools/Client/TokenContainer`1.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Client/Option.cs new file mode 100644 index 00000000000..3c370b043a5 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Client/Option.cs @@ -0,0 +1,41 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + + +namespace Org.OpenAPITools.Client +{ + /// + /// A wrapper for operation parameters which are not required + /// + public struct Option + { + /// + /// The value to send to the server + /// + public TType Value { get; } + + /// + /// When true the value will be sent to the server + /// + internal bool IsSet { get; } + + /// + /// A wrapper for operation parameters which are not required + /// + /// + public Option(TType value) + { + IsSet = true; + Value = value; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES index 0ab733136b4..60c779c5ced 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES @@ -123,6 +123,7 @@ src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs src/Org.OpenAPITools/Client/HttpSigningToken.cs src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs src/Org.OpenAPITools/Client/OAuthToken.cs +src/Org.OpenAPITools/Client/Option.cs src/Org.OpenAPITools/Client/RateLimitProvider`1.cs src/Org.OpenAPITools/Client/TokenBase.cs src/Org.OpenAPITools/Client/TokenContainer`1.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml index 6be7f291ccc..c2398ea9992 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml @@ -1036,6 +1036,38 @@ paths: type: string type: array style: form + - explode: true + in: query + name: requiredNotNullable + required: true + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: requiredNullable + required: true + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: notRequiredNotNullable + required: false + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: notRequiredNullable + required: false + schema: + nullable: true + type: string + style: form responses: "200": description: Success diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/apis/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/apis/FakeApi.md index b49cfaa04e3..82106bd5206 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/apis/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/apis/FakeApi.md @@ -1301,7 +1301,7 @@ No authorization required # **TestQueryParameterCollectionFormat** -> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context) +> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = null, string notRequiredNullable = null) @@ -1329,10 +1329,14 @@ namespace Example var http = new List(); // List | var url = new List(); // List | var context = new List(); // List | + var requiredNotNullable = "requiredNotNullable_example"; // string | + var requiredNullable = "requiredNullable_example"; // string | + var notRequiredNotNullable = "notRequiredNotNullable_example"; // string | (optional) + var notRequiredNullable = "notRequiredNullable_example"; // string | (optional) try { - apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1351,7 +1355,7 @@ This returns an ApiResponse object which contains the response data, status code ```csharp try { - apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1370,6 +1374,10 @@ catch (ApiException e) | **http** | [**List<string>**](string.md) | | | | **url** | [**List<string>**](string.md) | | | | **context** | [**List<string>**](string.md) | | | +| **requiredNotNullable** | **string** | | | +| **requiredNullable** | **string** | | | +| **notRequiredNotNullable** | **string** | | [optional] | +| **notRequiredNullable** | **string** | | [optional] | ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs index 1a3378ebdd0..73b87f569ac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs @@ -67,7 +67,7 @@ namespace Org.OpenAPITools.Test.Api [Fact (Skip = "not implemented")] public async Task FakeOuterBooleanSerializeAsyncTest() { - bool body = default; + Client.Option body = default; var response = await _instance.FakeOuterBooleanSerializeAsync(body); var model = response.AsModel(); Assert.IsType(model); @@ -79,7 +79,7 @@ namespace Org.OpenAPITools.Test.Api [Fact (Skip = "not implemented")] public async Task FakeOuterCompositeSerializeAsyncTest() { - OuterComposite outerComposite = default; + Client.Option outerComposite = default; var response = await _instance.FakeOuterCompositeSerializeAsync(outerComposite); var model = response.AsModel(); Assert.IsType(model); @@ -91,7 +91,7 @@ namespace Org.OpenAPITools.Test.Api [Fact (Skip = "not implemented")] public async Task FakeOuterNumberSerializeAsyncTest() { - decimal body = default; + Client.Option body = default; var response = await _instance.FakeOuterNumberSerializeAsync(body); var model = response.AsModel(); Assert.IsType(model); @@ -104,7 +104,7 @@ namespace Org.OpenAPITools.Test.Api public async Task FakeOuterStringSerializeAsyncTest() { Guid requiredStringUuid = default; - string body = default; + Client.Option body = default; var response = await _instance.FakeOuterStringSerializeAsync(requiredStringUuid, body); var model = response.AsModel(); Assert.IsType(model); @@ -164,16 +164,16 @@ namespace Org.OpenAPITools.Test.Api decimal number = default; double varDouble = default; string patternWithoutDelimiter = default; - DateTime date = default; - System.IO.Stream binary = default; - float varFloat = default; - int integer = default; - int int32 = default; - long int64 = default; - string varString = default; - string password = default; - string callback = default; - DateTime dateTime = default; + Client.Option date = default; + Client.Option binary = default; + Client.Option varFloat = default; + Client.Option integer = default; + Client.Option int32 = default; + Client.Option int64 = default; + Client.Option varString = default; + Client.Option password = default; + Client.Option callback = default; + Client.Option dateTime = default; await _instance.TestEndpointParametersAsync(varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime); } @@ -183,14 +183,14 @@ namespace Org.OpenAPITools.Test.Api [Fact (Skip = "not implemented")] public async Task TestEnumParametersAsyncTest() { - List enumHeaderStringArray = default; - List enumQueryStringArray = default; - double enumQueryDouble = default; - int enumQueryInteger = default; - List enumFormStringArray = default; - string enumHeaderString = default; - string enumQueryString = default; - string enumFormString = default; + Client.Option> enumHeaderStringArray = default; + Client.Option> enumQueryStringArray = default; + Client.Option enumQueryDouble = default; + Client.Option enumQueryInteger = default; + Client.Option> enumFormStringArray = default; + Client.Option enumHeaderString = default; + Client.Option enumQueryString = default; + Client.Option enumFormString = default; await _instance.TestEnumParametersAsync(enumHeaderStringArray, enumQueryStringArray, enumQueryDouble, enumQueryInteger, enumFormStringArray, enumHeaderString, enumQueryString, enumFormString); } @@ -203,9 +203,9 @@ namespace Org.OpenAPITools.Test.Api bool requiredBooleanGroup = default; int requiredStringGroup = default; long requiredInt64Group = default; - bool booleanGroup = default; - int stringGroup = default; - long int64Group = default; + Client.Option booleanGroup = default; + Client.Option stringGroup = default; + Client.Option int64Group = default; await _instance.TestGroupParametersAsync(requiredBooleanGroup, requiredStringGroup, requiredInt64Group, booleanGroup, stringGroup, int64Group); } @@ -241,7 +241,11 @@ namespace Org.OpenAPITools.Test.Api List http = default; List url = default; List context = default; - await _instance.TestQueryParameterCollectionFormatAsync(pipe, ioutil, http, url, context); + string requiredNotNullable = default; + string requiredNullable = default; + Client.Option notRequiredNotNullable = default; + Client.Option notRequiredNullable = default; + await _instance.TestQueryParameterCollectionFormatAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/PetApiTests.cs index 5f43e98fd32..e1c54f8f129 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/PetApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/PetApiTests.cs @@ -67,7 +67,7 @@ namespace Org.OpenAPITools.Test.Api public async Task DeletePetAsyncTest() { long petId = default; - string apiKey = default; + Client.Option apiKey = default; await _instance.DeletePetAsync(petId, apiKey); } @@ -124,8 +124,8 @@ namespace Org.OpenAPITools.Test.Api public async Task UpdatePetWithFormAsyncTest() { long petId = default; - string name = default; - string status = default; + Client.Option name = default; + Client.Option status = default; await _instance.UpdatePetWithFormAsync(petId, name, status); } @@ -136,8 +136,8 @@ namespace Org.OpenAPITools.Test.Api public async Task UploadFileAsyncTest() { long petId = default; - System.IO.Stream file = default; - string additionalMetadata = default; + Client.Option file = default; + Client.Option additionalMetadata = default; var response = await _instance.UploadFileAsync(petId, file, additionalMetadata); var model = response.AsModel(); Assert.IsType(model); @@ -151,7 +151,7 @@ namespace Org.OpenAPITools.Test.Api { System.IO.Stream requiredFile = default; long petId = default; - string additionalMetadata = default; + Client.Option additionalMetadata = default; var response = await _instance.UploadFileWithRequiredFileAsync(requiredFile, petId, additionalMetadata); var model = response.AsModel(); Assert.IsType(model); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 53eba2098f0..7c98548d4f1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -126,14 +126,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateCall123TestSpecialTags(ModelClient modelClient) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (modelClient == null) throw new ArgumentNullException(nameof(modelClient)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -233,7 +227,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/DefaultApi.cs index 002d490ba6f..fb656ed5462 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -276,14 +276,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateGetCountry(string country) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (country == null) throw new ArgumentNullException(nameof(country)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -389,7 +383,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = new HttpMethod("POST"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeApi.cs index 26f67e62056..4a6bc73783d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeApi.cs @@ -58,7 +58,7 @@ namespace Org.OpenAPITools.IApi /// Input boolean as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<bool>> - Task> FakeOuterBooleanSerializeAsync(bool? body = null, System.Threading.CancellationToken cancellationToken = default); + Task> FakeOuterBooleanSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -69,7 +69,7 @@ namespace Org.OpenAPITools.IApi /// Input boolean as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>bool>> - Task> FakeOuterBooleanSerializeOrDefaultAsync(bool? body = null, System.Threading.CancellationToken cancellationToken = default); + Task> FakeOuterBooleanSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -81,7 +81,7 @@ namespace Org.OpenAPITools.IApi /// Input composite as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<OuterComposite>> - Task> FakeOuterCompositeSerializeAsync(OuterComposite outerComposite = null, System.Threading.CancellationToken cancellationToken = default); + Task> FakeOuterCompositeSerializeAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -92,7 +92,7 @@ namespace Org.OpenAPITools.IApi /// Input composite as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>OuterComposite>> - Task> FakeOuterCompositeSerializeOrDefaultAsync(OuterComposite outerComposite = null, System.Threading.CancellationToken cancellationToken = default); + Task> FakeOuterCompositeSerializeOrDefaultAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -104,7 +104,7 @@ namespace Org.OpenAPITools.IApi /// Input number as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<decimal>> - Task> FakeOuterNumberSerializeAsync(decimal? body = null, System.Threading.CancellationToken cancellationToken = default); + Task> FakeOuterNumberSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -115,7 +115,7 @@ namespace Org.OpenAPITools.IApi /// Input number as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>decimal>> - Task> FakeOuterNumberSerializeOrDefaultAsync(decimal? body = null, System.Threading.CancellationToken cancellationToken = default); + Task> FakeOuterNumberSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -128,7 +128,7 @@ namespace Org.OpenAPITools.IApi /// Input string as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<string>> - Task> FakeOuterStringSerializeAsync(Guid requiredStringUuid, string body = null, System.Threading.CancellationToken cancellationToken = default); + Task> FakeOuterStringSerializeAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -140,7 +140,7 @@ namespace Org.OpenAPITools.IApi /// Input string as post body (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>string>> - Task> FakeOuterStringSerializeOrDefaultAsync(Guid requiredStringUuid, string body = null, System.Threading.CancellationToken cancellationToken = default); + Task> FakeOuterStringSerializeOrDefaultAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default); /// /// Array of Enums @@ -257,7 +257,7 @@ namespace Org.OpenAPITools.IApi /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") /// Cancellation Token to cancel the request. /// Task<ApiResponse<object>> - Task> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date = null, System.IO.Stream binary = null, float? varFloat = null, int? integer = null, int? int32 = null, long? int64 = null, string varString = null, string password = null, string callback = null, DateTime? dateTime = null, System.Threading.CancellationToken cancellationToken = default); + Task> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date = default, Option binary = default, Option varFloat = default, Option integer = default, Option int32 = default, Option int64 = default, Option varString = default, Option password = default, Option callback = default, Option dateTime = default, System.Threading.CancellationToken cancellationToken = default); /// /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -281,7 +281,7 @@ namespace Org.OpenAPITools.IApi /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") /// Cancellation Token to cancel the request. /// Task<ApiResponse>object>> - Task> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date = null, System.IO.Stream binary = null, float? varFloat = null, int? integer = null, int? int32 = null, long? int64 = null, string varString = null, string password = null, string callback = null, DateTime? dateTime = null, System.Threading.CancellationToken cancellationToken = default); + Task> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date = default, Option binary = default, Option varFloat = default, Option integer = default, Option int32 = default, Option int64 = default, Option varString = default, Option password = default, Option callback = default, Option dateTime = default, System.Threading.CancellationToken cancellationToken = default); /// /// To test enum parameters @@ -300,7 +300,7 @@ namespace Org.OpenAPITools.IApi /// Form parameter enum test (string) (optional, default to -efg) /// Cancellation Token to cancel the request. /// Task<ApiResponse<object>> - Task> TestEnumParametersAsync(List enumHeaderStringArray = null, List enumQueryStringArray = null, double? enumQueryDouble = null, int? enumQueryInteger = null, List enumFormStringArray = null, string enumHeaderString = null, string enumQueryString = null, string enumFormString = null, System.Threading.CancellationToken cancellationToken = default); + Task> TestEnumParametersAsync(Option> enumHeaderStringArray = default, Option> enumQueryStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option enumQueryString = default, Option enumFormString = default, System.Threading.CancellationToken cancellationToken = default); /// /// To test enum parameters @@ -318,7 +318,7 @@ namespace Org.OpenAPITools.IApi /// Form parameter enum test (string) (optional, default to -efg) /// Cancellation Token to cancel the request. /// Task<ApiResponse>object>> - Task> TestEnumParametersOrDefaultAsync(List enumHeaderStringArray = null, List enumQueryStringArray = null, double? enumQueryDouble = null, int? enumQueryInteger = null, List enumFormStringArray = null, string enumHeaderString = null, string enumQueryString = null, string enumFormString = null, System.Threading.CancellationToken cancellationToken = default); + Task> TestEnumParametersOrDefaultAsync(Option> enumHeaderStringArray = default, Option> enumQueryStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option enumQueryString = default, Option enumFormString = default, System.Threading.CancellationToken cancellationToken = default); /// /// Fake endpoint to test group parameters (optional) @@ -335,7 +335,7 @@ namespace Org.OpenAPITools.IApi /// Integer in group parameters (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<object>> - Task> TestGroupParametersAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup = null, int? stringGroup = null, long? int64Group = null, System.Threading.CancellationToken cancellationToken = default); + Task> TestGroupParametersAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup = default, Option stringGroup = default, Option int64Group = default, System.Threading.CancellationToken cancellationToken = default); /// /// Fake endpoint to test group parameters (optional) @@ -351,7 +351,7 @@ namespace Org.OpenAPITools.IApi /// Integer in group parameters (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>object>> - Task> TestGroupParametersOrDefaultAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup = null, int? stringGroup = null, long? int64Group = null, System.Threading.CancellationToken cancellationToken = default); + Task> TestGroupParametersOrDefaultAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup = default, Option stringGroup = default, Option int64Group = default, System.Threading.CancellationToken cancellationToken = default); /// /// test inline additionalProperties @@ -413,9 +413,13 @@ namespace Org.OpenAPITools.IApi /// /// /// + /// + /// + /// (optional) + /// (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<object>> - Task> TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, System.Threading.CancellationToken cancellationToken = default); + Task> TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable = default, Option notRequiredNotNullable = default, Option notRequiredNullable = default, System.Threading.CancellationToken cancellationToken = default); /// /// @@ -428,9 +432,13 @@ namespace Org.OpenAPITools.IApi /// /// /// + /// + /// + /// (optional) + /// (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>object>> - Task> TestQueryParameterCollectionFormatOrDefaultAsync(List pipe, List ioutil, List http, List url, List context, System.Threading.CancellationToken cancellationToken = default); + Task> TestQueryParameterCollectionFormatOrDefaultAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable = default, Option notRequiredNotNullable = default, Option notRequiredNullable = default, System.Threading.CancellationToken cancellationToken = default); } } @@ -607,31 +615,14 @@ namespace Org.OpenAPITools.Api } } - partial void FormatFakeOuterBooleanSerialize(ref bool? body); - - /// - /// Validates the request parameters - /// - /// - /// - private void ValidateFakeOuterBooleanSerialize(bool? body) - { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (body == null) - throw new ArgumentNullException(nameof(body)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - } + partial void FormatFakeOuterBooleanSerialize(ref Option body); /// /// Processes the server response /// /// /// - private void AfterFakeOuterBooleanSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, bool? body) + private void AfterFakeOuterBooleanSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, Option body) { bool suppressDefaultLog = false; AfterFakeOuterBooleanSerialize(ref suppressDefaultLog, apiResponseLocalVar, body); @@ -645,7 +636,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterFakeOuterBooleanSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, bool? body); + partial void AfterFakeOuterBooleanSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, Option body); /// /// Logs exceptions that occur while retrieving the server response @@ -654,7 +645,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorFakeOuterBooleanSerializeDefaultImplementation(Exception exception, string pathFormat, string path, bool? body) + private void OnErrorFakeOuterBooleanSerializeDefaultImplementation(Exception exception, string pathFormat, string path, Option body) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorFakeOuterBooleanSerialize(exception, pathFormat, path, body); @@ -667,7 +658,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorFakeOuterBooleanSerialize(Exception exception, string pathFormat, string path, bool? body); + partial void OnErrorFakeOuterBooleanSerialize(Exception exception, string pathFormat, string path, Option body); /// /// Test serialization of outer boolean types @@ -675,7 +666,7 @@ namespace Org.OpenAPITools.Api /// Input boolean as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> FakeOuterBooleanSerializeOrDefaultAsync(bool? body = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> FakeOuterBooleanSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -694,14 +685,12 @@ namespace Org.OpenAPITools.Api /// Input boolean as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> FakeOuterBooleanSerializeAsync(bool? body = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> FakeOuterBooleanSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateFakeOuterBooleanSerialize(body); - FormatFakeOuterBooleanSerialize(ref body); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -711,9 +700,10 @@ namespace Org.OpenAPITools.Api uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/boolean"; - httpRequestMessageLocalVar.Content = (body as object) is System.IO.Stream stream - ? httpRequestMessageLocalVar.Content = new StreamContent(stream) - : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body, _jsonSerializerOptions)); + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; @@ -723,7 +713,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { @@ -757,23 +747,17 @@ namespace Org.OpenAPITools.Api } } - partial void FormatFakeOuterCompositeSerialize(OuterComposite outerComposite); + partial void FormatFakeOuterCompositeSerialize(Option outerComposite); /// /// Validates the request parameters /// /// /// - private void ValidateFakeOuterCompositeSerialize(OuterComposite outerComposite) + private void ValidateFakeOuterCompositeSerialize(Option outerComposite) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (outerComposite == null) + if (outerComposite.IsSet && outerComposite.Value == null) throw new ArgumentNullException(nameof(outerComposite)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -781,7 +765,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterFakeOuterCompositeSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, OuterComposite outerComposite) + private void AfterFakeOuterCompositeSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, Option outerComposite) { bool suppressDefaultLog = false; AfterFakeOuterCompositeSerialize(ref suppressDefaultLog, apiResponseLocalVar, outerComposite); @@ -795,7 +779,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterFakeOuterCompositeSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, OuterComposite outerComposite); + partial void AfterFakeOuterCompositeSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, Option outerComposite); /// /// Logs exceptions that occur while retrieving the server response @@ -804,7 +788,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorFakeOuterCompositeSerializeDefaultImplementation(Exception exception, string pathFormat, string path, OuterComposite outerComposite) + private void OnErrorFakeOuterCompositeSerializeDefaultImplementation(Exception exception, string pathFormat, string path, Option outerComposite) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorFakeOuterCompositeSerialize(exception, pathFormat, path, outerComposite); @@ -817,7 +801,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorFakeOuterCompositeSerialize(Exception exception, string pathFormat, string path, OuterComposite outerComposite); + partial void OnErrorFakeOuterCompositeSerialize(Exception exception, string pathFormat, string path, Option outerComposite); /// /// Test serialization of object with outer number type @@ -825,7 +809,7 @@ namespace Org.OpenAPITools.Api /// Input composite as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> FakeOuterCompositeSerializeOrDefaultAsync(OuterComposite outerComposite = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> FakeOuterCompositeSerializeOrDefaultAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -844,7 +828,7 @@ namespace Org.OpenAPITools.Api /// Input composite as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> FakeOuterCompositeSerializeAsync(OuterComposite outerComposite = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> FakeOuterCompositeSerializeAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); @@ -861,9 +845,10 @@ namespace Org.OpenAPITools.Api uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/composite"; - httpRequestMessageLocalVar.Content = (outerComposite as object) is System.IO.Stream stream - ? httpRequestMessageLocalVar.Content = new StreamContent(stream) - : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(outerComposite, _jsonSerializerOptions)); + if (outerComposite.IsSet) + httpRequestMessageLocalVar.Content = (outerComposite.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(outerComposite.Value, _jsonSerializerOptions)); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; @@ -873,7 +858,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { @@ -907,31 +892,14 @@ namespace Org.OpenAPITools.Api } } - partial void FormatFakeOuterNumberSerialize(ref decimal? body); - - /// - /// Validates the request parameters - /// - /// - /// - private void ValidateFakeOuterNumberSerialize(decimal? body) - { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (body == null) - throw new ArgumentNullException(nameof(body)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - } + partial void FormatFakeOuterNumberSerialize(ref Option body); /// /// Processes the server response /// /// /// - private void AfterFakeOuterNumberSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, decimal? body) + private void AfterFakeOuterNumberSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, Option body) { bool suppressDefaultLog = false; AfterFakeOuterNumberSerialize(ref suppressDefaultLog, apiResponseLocalVar, body); @@ -945,7 +913,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterFakeOuterNumberSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, decimal? body); + partial void AfterFakeOuterNumberSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, Option body); /// /// Logs exceptions that occur while retrieving the server response @@ -954,7 +922,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorFakeOuterNumberSerializeDefaultImplementation(Exception exception, string pathFormat, string path, decimal? body) + private void OnErrorFakeOuterNumberSerializeDefaultImplementation(Exception exception, string pathFormat, string path, Option body) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorFakeOuterNumberSerialize(exception, pathFormat, path, body); @@ -967,7 +935,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorFakeOuterNumberSerialize(Exception exception, string pathFormat, string path, decimal? body); + partial void OnErrorFakeOuterNumberSerialize(Exception exception, string pathFormat, string path, Option body); /// /// Test serialization of outer number types @@ -975,7 +943,7 @@ namespace Org.OpenAPITools.Api /// Input number as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> FakeOuterNumberSerializeOrDefaultAsync(decimal? body = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> FakeOuterNumberSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -994,14 +962,12 @@ namespace Org.OpenAPITools.Api /// Input number as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> FakeOuterNumberSerializeAsync(decimal? body = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> FakeOuterNumberSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateFakeOuterNumberSerialize(body); - FormatFakeOuterNumberSerialize(ref body); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -1011,9 +977,10 @@ namespace Org.OpenAPITools.Api uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/number"; - httpRequestMessageLocalVar.Content = (body as object) is System.IO.Stream stream - ? httpRequestMessageLocalVar.Content = new StreamContent(stream) - : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body, _jsonSerializerOptions)); + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; @@ -1023,7 +990,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { @@ -1057,27 +1024,17 @@ namespace Org.OpenAPITools.Api } } - partial void FormatFakeOuterStringSerialize(ref Guid requiredStringUuid, ref string body); + partial void FormatFakeOuterStringSerialize(ref Guid requiredStringUuid, ref Option body); /// /// Validates the request parameters /// - /// /// /// - private void ValidateFakeOuterStringSerialize(Guid requiredStringUuid, string body) + private void ValidateFakeOuterStringSerialize(Option body) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (requiredStringUuid == null) - throw new ArgumentNullException(nameof(requiredStringUuid)); - - if (body == null) + if (body.IsSet && body.Value == null) throw new ArgumentNullException(nameof(body)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1086,7 +1043,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterFakeOuterStringSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, Guid requiredStringUuid, string body) + private void AfterFakeOuterStringSerializeDefaultImplementation(ApiResponse apiResponseLocalVar, Guid requiredStringUuid, Option body) { bool suppressDefaultLog = false; AfterFakeOuterStringSerialize(ref suppressDefaultLog, apiResponseLocalVar, requiredStringUuid, body); @@ -1101,7 +1058,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterFakeOuterStringSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, Guid requiredStringUuid, string body); + partial void AfterFakeOuterStringSerialize(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, Guid requiredStringUuid, Option body); /// /// Logs exceptions that occur while retrieving the server response @@ -1111,7 +1068,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorFakeOuterStringSerializeDefaultImplementation(Exception exception, string pathFormat, string path, Guid requiredStringUuid, string body) + private void OnErrorFakeOuterStringSerializeDefaultImplementation(Exception exception, string pathFormat, string path, Guid requiredStringUuid, Option body) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorFakeOuterStringSerialize(exception, pathFormat, path, requiredStringUuid, body); @@ -1125,7 +1082,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorFakeOuterStringSerialize(Exception exception, string pathFormat, string path, Guid requiredStringUuid, string body); + partial void OnErrorFakeOuterStringSerialize(Exception exception, string pathFormat, string path, Guid requiredStringUuid, Option body); /// /// Test serialization of outer string types @@ -1134,7 +1091,7 @@ namespace Org.OpenAPITools.Api /// Input string as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> FakeOuterStringSerializeOrDefaultAsync(Guid requiredStringUuid, string body = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> FakeOuterStringSerializeOrDefaultAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -1154,13 +1111,13 @@ namespace Org.OpenAPITools.Api /// Input string as post body (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> FakeOuterStringSerializeAsync(Guid requiredStringUuid, string body = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> FakeOuterStringSerializeAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateFakeOuterStringSerialize(requiredStringUuid, body); + ValidateFakeOuterStringSerialize(body); FormatFakeOuterStringSerialize(ref requiredStringUuid, ref body); @@ -1177,9 +1134,10 @@ namespace Org.OpenAPITools.Api uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); - httpRequestMessageLocalVar.Content = (body as object) is System.IO.Stream stream - ? httpRequestMessageLocalVar.Content = new StreamContent(stream) - : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body, _jsonSerializerOptions)); + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; @@ -1189,7 +1147,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { @@ -1340,14 +1298,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateTestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (fileSchemaTestClass == null) throw new ArgumentNullException(nameof(fileSchemaTestClass)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1447,7 +1399,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); @@ -1478,22 +1430,16 @@ namespace Org.OpenAPITools.Api /// /// Validates the request parameters /// - /// /// + /// /// - private void ValidateTestBodyWithQueryParams(User user, string query) + private void ValidateTestBodyWithQueryParams(string query, User user) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (user == null) - throw new ArgumentNullException(nameof(user)); - if (query == null) throw new ArgumentNullException(nameof(query)); - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + if (user == null) + throw new ArgumentNullException(nameof(user)); } /// @@ -1576,7 +1522,7 @@ namespace Org.OpenAPITools.Api try { - ValidateTestBodyWithQueryParams(user, query); + ValidateTestBodyWithQueryParams(query, user); FormatTestBodyWithQueryParams(user, ref query); @@ -1605,7 +1551,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); @@ -1640,14 +1586,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateTestClientModel(ModelClient modelClient) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (modelClient == null) throw new ArgumentNullException(nameof(modelClient)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1747,7 +1687,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { @@ -1781,75 +1721,37 @@ namespace Org.OpenAPITools.Api } } - partial void FormatTestEndpointParameters(ref byte[] varByte, ref decimal number, ref double varDouble, ref string patternWithoutDelimiter, ref DateTime? date, ref System.IO.Stream binary, ref float? varFloat, ref int? integer, ref int? int32, ref long? int64, ref string varString, ref string password, ref string callback, ref DateTime? dateTime); + partial void FormatTestEndpointParameters(ref byte[] varByte, ref decimal number, ref double varDouble, ref string patternWithoutDelimiter, ref Option date, ref Option binary, ref Option varFloat, ref Option integer, ref Option int32, ref Option int64, ref Option varString, ref Option password, ref Option callback, ref Option dateTime); /// /// Validates the request parameters /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// /// + /// + /// + /// /// - /// + /// /// - private void ValidateTestEndpointParameters(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date, System.IO.Stream binary, float? varFloat, int? integer, int? int32, long? int64, string varString, string password, string callback, DateTime? dateTime) + private void ValidateTestEndpointParameters(Option password, string patternWithoutDelimiter, Option binary, Option varString, Option callback, byte[] varByte) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (varByte == null) - throw new ArgumentNullException(nameof(varByte)); - - if (number == null) - throw new ArgumentNullException(nameof(number)); - - if (varDouble == null) - throw new ArgumentNullException(nameof(varDouble)); + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password)); if (patternWithoutDelimiter == null) throw new ArgumentNullException(nameof(patternWithoutDelimiter)); - if (date == null) - throw new ArgumentNullException(nameof(date)); - - if (binary == null) + if (binary.IsSet && binary.Value == null) throw new ArgumentNullException(nameof(binary)); - if (varFloat == null) - throw new ArgumentNullException(nameof(varFloat)); - - if (integer == null) - throw new ArgumentNullException(nameof(integer)); - - if (int32 == null) - throw new ArgumentNullException(nameof(int32)); - - if (int64 == null) - throw new ArgumentNullException(nameof(int64)); - - if (varString == null) + if (varString.IsSet && varString.Value == null) throw new ArgumentNullException(nameof(varString)); - if (password == null) - throw new ArgumentNullException(nameof(password)); - - if (callback == null) + if (callback.IsSet && callback.Value == null) throw new ArgumentNullException(nameof(callback)); - if (dateTime == null) - throw new ArgumentNullException(nameof(dateTime)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + if (varByte == null) + throw new ArgumentNullException(nameof(varByte)); } /// @@ -1870,7 +1772,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterTestEndpointParametersDefaultImplementation(ApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date, System.IO.Stream binary, float? varFloat, int? integer, int? int32, long? int64, string varString, string password, string callback, DateTime? dateTime) + private void AfterTestEndpointParametersDefaultImplementation(ApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date, Option binary, Option varFloat, Option integer, Option int32, Option int64, Option varString, Option password, Option callback, Option dateTime) { bool suppressDefaultLog = false; AfterTestEndpointParameters(ref suppressDefaultLog, apiResponseLocalVar, varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime); @@ -1897,7 +1799,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterTestEndpointParameters(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date, System.IO.Stream binary, float? varFloat, int? integer, int? int32, long? int64, string varString, string password, string callback, DateTime? dateTime); + partial void AfterTestEndpointParameters(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date, Option binary, Option varFloat, Option integer, Option int32, Option int64, Option varString, Option password, Option callback, Option dateTime); /// /// Logs exceptions that occur while retrieving the server response @@ -1919,7 +1821,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorTestEndpointParametersDefaultImplementation(Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date, System.IO.Stream binary, float? varFloat, int? integer, int? int32, long? int64, string varString, string password, string callback, DateTime? dateTime) + private void OnErrorTestEndpointParametersDefaultImplementation(Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date, Option binary, Option varFloat, Option integer, Option int32, Option int64, Option varString, Option password, Option callback, Option dateTime) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorTestEndpointParameters(exception, pathFormat, path, varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime); @@ -1945,7 +1847,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorTestEndpointParameters(Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date, System.IO.Stream binary, float? varFloat, int? integer, int? int32, long? int64, string varString, string password, string callback, DateTime? dateTime); + partial void OnErrorTestEndpointParameters(Exception exception, string pathFormat, string path, byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date, Option binary, Option varFloat, Option integer, Option int32, Option int64, Option varString, Option password, Option callback, Option dateTime); /// /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -1966,7 +1868,7 @@ namespace Org.OpenAPITools.Api /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") /// Cancellation Token to cancel the request. /// <> where T : - public async Task> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date = null, System.IO.Stream binary = null, float? varFloat = null, int? integer = null, int? int32 = null, long? int64 = null, string varString = null, string password = null, string callback = null, DateTime? dateTime = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> TestEndpointParametersOrDefaultAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date = default, Option binary = default, Option varFloat = default, Option integer = default, Option int32 = default, Option int64 = default, Option varString = default, Option password = default, Option callback = default, Option dateTime = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -1998,13 +1900,13 @@ namespace Org.OpenAPITools.Api /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") /// Cancellation Token to cancel the request. /// <> where T : - public async Task> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date = null, System.IO.Stream binary = null, float? varFloat = null, int? integer = null, int? int32 = null, long? int64 = null, string varString = null, string password = null, string callback = null, DateTime? dateTime = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> TestEndpointParametersAsync(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, Option date = default, Option binary = default, Option varFloat = default, Option integer = default, Option int32 = default, Option int64 = default, Option varString = default, Option password = default, Option callback = default, Option dateTime = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateTestEndpointParameters(varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime); + ValidateTestEndpointParameters(password, patternWithoutDelimiter, binary, varString, callback, varByte); FormatTestEndpointParameters(ref varByte, ref number, ref varDouble, ref patternWithoutDelimiter, ref date, ref binary, ref varFloat, ref integer, ref int32, ref int64, ref varString, ref password, ref callback, ref dateTime); @@ -2031,35 +1933,35 @@ namespace Org.OpenAPITools.Api formParameterLocalVars.Add(new KeyValuePair("pattern_without_delimiter", ClientUtils.ParameterToString(patternWithoutDelimiter))); - if (date != null) - formParameterLocalVars.Add(new KeyValuePair("date", ClientUtils.ParameterToString(date))); + if (date.IsSet) + formParameterLocalVars.Add(new KeyValuePair("date", ClientUtils.ParameterToString(date.Value))); - if (binary != null) - multipartContentLocalVar.Add(new StreamContent(binary)); + if (binary.IsSet) + multipartContentLocalVar.Add(new StreamContent(binary.Value)); - if (varFloat != null) - formParameterLocalVars.Add(new KeyValuePair("float", ClientUtils.ParameterToString(varFloat))); + if (varFloat.IsSet) + formParameterLocalVars.Add(new KeyValuePair("float", ClientUtils.ParameterToString(varFloat.Value))); - if (integer != null) - formParameterLocalVars.Add(new KeyValuePair("integer", ClientUtils.ParameterToString(integer))); + if (integer.IsSet) + formParameterLocalVars.Add(new KeyValuePair("integer", ClientUtils.ParameterToString(integer.Value))); - if (int32 != null) - formParameterLocalVars.Add(new KeyValuePair("int32", ClientUtils.ParameterToString(int32))); + if (int32.IsSet) + formParameterLocalVars.Add(new KeyValuePair("int32", ClientUtils.ParameterToString(int32.Value))); - if (int64 != null) - formParameterLocalVars.Add(new KeyValuePair("int64", ClientUtils.ParameterToString(int64))); + if (int64.IsSet) + formParameterLocalVars.Add(new KeyValuePair("int64", ClientUtils.ParameterToString(int64.Value))); - if (varString != null) - formParameterLocalVars.Add(new KeyValuePair("string", ClientUtils.ParameterToString(varString))); + if (varString.IsSet) + formParameterLocalVars.Add(new KeyValuePair("string", ClientUtils.ParameterToString(varString.Value))); - if (password != null) - formParameterLocalVars.Add(new KeyValuePair("password", ClientUtils.ParameterToString(password))); + if (password.IsSet) + formParameterLocalVars.Add(new KeyValuePair("password", ClientUtils.ParameterToString(password.Value))); - if (callback != null) - formParameterLocalVars.Add(new KeyValuePair("callback", ClientUtils.ParameterToString(callback))); + if (callback.IsSet) + formParameterLocalVars.Add(new KeyValuePair("callback", ClientUtils.ParameterToString(callback.Value))); - if (dateTime != null) - formParameterLocalVars.Add(new KeyValuePair("dateTime", ClientUtils.ParameterToString(dateTime))); + if (dateTime.IsSet) + formParameterLocalVars.Add(new KeyValuePair("dateTime", ClientUtils.ParameterToString(dateTime.Value))); List tokenBaseLocalVars = new List(); @@ -2077,7 +1979,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = new HttpMethod("POST"); @@ -2107,51 +2009,37 @@ namespace Org.OpenAPITools.Api } } - partial void FormatTestEnumParameters(List enumHeaderStringArray, List enumQueryStringArray, ref double? enumQueryDouble, ref int? enumQueryInteger, List enumFormStringArray, ref string enumHeaderString, ref string enumQueryString, ref string enumFormString); + partial void FormatTestEnumParameters(Option> enumHeaderStringArray, Option> enumQueryStringArray, ref Option enumQueryDouble, ref Option enumQueryInteger, Option> enumFormStringArray, ref Option enumHeaderString, ref Option enumQueryString, ref Option enumFormString); /// /// Validates the request parameters /// - /// /// - /// - /// /// /// - /// + /// /// + /// /// - private void ValidateTestEnumParameters(List enumHeaderStringArray, List enumQueryStringArray, double? enumQueryDouble, int? enumQueryInteger, List enumFormStringArray, string enumHeaderString, string enumQueryString, string enumFormString) + private void ValidateTestEnumParameters(Option> enumQueryStringArray, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumFormString, Option enumQueryString) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (enumHeaderStringArray == null) - throw new ArgumentNullException(nameof(enumHeaderStringArray)); - - if (enumQueryStringArray == null) + if (enumQueryStringArray.IsSet && enumQueryStringArray.Value == null) throw new ArgumentNullException(nameof(enumQueryStringArray)); - if (enumQueryDouble == null) - throw new ArgumentNullException(nameof(enumQueryDouble)); - - if (enumQueryInteger == null) - throw new ArgumentNullException(nameof(enumQueryInteger)); - - if (enumFormStringArray == null) + if (enumFormStringArray.IsSet && enumFormStringArray.Value == null) throw new ArgumentNullException(nameof(enumFormStringArray)); - if (enumHeaderString == null) + if (enumHeaderString.IsSet && enumHeaderString.Value == null) throw new ArgumentNullException(nameof(enumHeaderString)); - if (enumQueryString == null) - throw new ArgumentNullException(nameof(enumQueryString)); + if (enumHeaderStringArray.IsSet && enumHeaderStringArray.Value == null) + throw new ArgumentNullException(nameof(enumHeaderStringArray)); - if (enumFormString == null) + if (enumFormString.IsSet && enumFormString.Value == null) throw new ArgumentNullException(nameof(enumFormString)); - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + if (enumQueryString.IsSet && enumQueryString.Value == null) + throw new ArgumentNullException(nameof(enumQueryString)); } /// @@ -2166,7 +2054,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterTestEnumParametersDefaultImplementation(ApiResponse apiResponseLocalVar, List enumHeaderStringArray, List enumQueryStringArray, double? enumQueryDouble, int? enumQueryInteger, List enumFormStringArray, string enumHeaderString, string enumQueryString, string enumFormString) + private void AfterTestEnumParametersDefaultImplementation(ApiResponse apiResponseLocalVar, Option> enumHeaderStringArray, Option> enumQueryStringArray, Option enumQueryDouble, Option enumQueryInteger, Option> enumFormStringArray, Option enumHeaderString, Option enumQueryString, Option enumFormString) { bool suppressDefaultLog = false; AfterTestEnumParameters(ref suppressDefaultLog, apiResponseLocalVar, enumHeaderStringArray, enumQueryStringArray, enumQueryDouble, enumQueryInteger, enumFormStringArray, enumHeaderString, enumQueryString, enumFormString); @@ -2187,7 +2075,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterTestEnumParameters(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, List enumHeaderStringArray, List enumQueryStringArray, double? enumQueryDouble, int? enumQueryInteger, List enumFormStringArray, string enumHeaderString, string enumQueryString, string enumFormString); + partial void AfterTestEnumParameters(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, Option> enumHeaderStringArray, Option> enumQueryStringArray, Option enumQueryDouble, Option enumQueryInteger, Option> enumFormStringArray, Option enumHeaderString, Option enumQueryString, Option enumFormString); /// /// Logs exceptions that occur while retrieving the server response @@ -2203,7 +2091,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorTestEnumParametersDefaultImplementation(Exception exception, string pathFormat, string path, List enumHeaderStringArray, List enumQueryStringArray, double? enumQueryDouble, int? enumQueryInteger, List enumFormStringArray, string enumHeaderString, string enumQueryString, string enumFormString) + private void OnErrorTestEnumParametersDefaultImplementation(Exception exception, string pathFormat, string path, Option> enumHeaderStringArray, Option> enumQueryStringArray, Option enumQueryDouble, Option enumQueryInteger, Option> enumFormStringArray, Option enumHeaderString, Option enumQueryString, Option enumFormString) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorTestEnumParameters(exception, pathFormat, path, enumHeaderStringArray, enumQueryStringArray, enumQueryDouble, enumQueryInteger, enumFormStringArray, enumHeaderString, enumQueryString, enumFormString); @@ -2223,7 +2111,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorTestEnumParameters(Exception exception, string pathFormat, string path, List enumHeaderStringArray, List enumQueryStringArray, double? enumQueryDouble, int? enumQueryInteger, List enumFormStringArray, string enumHeaderString, string enumQueryString, string enumFormString); + partial void OnErrorTestEnumParameters(Exception exception, string pathFormat, string path, Option> enumHeaderStringArray, Option> enumQueryStringArray, Option enumQueryDouble, Option enumQueryInteger, Option> enumFormStringArray, Option enumHeaderString, Option enumQueryString, Option enumFormString); /// /// To test enum parameters To test enum parameters @@ -2238,7 +2126,7 @@ namespace Org.OpenAPITools.Api /// Form parameter enum test (string) (optional, default to -efg) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> TestEnumParametersOrDefaultAsync(List enumHeaderStringArray = null, List enumQueryStringArray = null, double? enumQueryDouble = null, int? enumQueryInteger = null, List enumFormStringArray = null, string enumHeaderString = null, string enumQueryString = null, string enumFormString = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> TestEnumParametersOrDefaultAsync(Option> enumHeaderStringArray = default, Option> enumQueryStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option enumQueryString = default, Option enumFormString = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -2264,13 +2152,13 @@ namespace Org.OpenAPITools.Api /// Form parameter enum test (string) (optional, default to -efg) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> TestEnumParametersAsync(List enumHeaderStringArray = null, List enumQueryStringArray = null, double? enumQueryDouble = null, int? enumQueryInteger = null, List enumFormStringArray = null, string enumHeaderString = null, string enumQueryString = null, string enumFormString = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> TestEnumParametersAsync(Option> enumHeaderStringArray = default, Option> enumQueryStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option enumQueryString = default, Option enumFormString = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateTestEnumParameters(enumHeaderStringArray, enumQueryStringArray, enumQueryDouble, enumQueryInteger, enumFormStringArray, enumHeaderString, enumQueryString, enumFormString); + ValidateTestEnumParameters(enumQueryStringArray, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumFormString, enumQueryString); FormatTestEnumParameters(enumHeaderStringArray, enumQueryStringArray, ref enumQueryDouble, ref enumQueryInteger, enumFormStringArray, ref enumHeaderString, ref enumQueryString, ref enumFormString); @@ -2283,25 +2171,25 @@ namespace Org.OpenAPITools.Api System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); - if (enumQueryStringArray != null) - parseQueryStringLocalVar["enum_query_string_array"] = enumQueryStringArray.ToString(); + if (enumQueryStringArray.IsSet) + parseQueryStringLocalVar["enum_query_string_array"] = enumQueryStringArray.Value.ToString(); - if (enumQueryDouble != null) - parseQueryStringLocalVar["enum_query_double"] = enumQueryDouble.ToString(); + if (enumQueryDouble.IsSet) + parseQueryStringLocalVar["enum_query_double"] = enumQueryDouble.Value.ToString(); - if (enumQueryInteger != null) - parseQueryStringLocalVar["enum_query_integer"] = enumQueryInteger.ToString(); + if (enumQueryInteger.IsSet) + parseQueryStringLocalVar["enum_query_integer"] = enumQueryInteger.Value.ToString(); - if (enumQueryString != null) - parseQueryStringLocalVar["enum_query_string"] = enumQueryString.ToString(); + if (enumQueryString.IsSet) + parseQueryStringLocalVar["enum_query_string"] = enumQueryString.Value.ToString(); uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); - if (enumHeaderStringArray != null) - httpRequestMessageLocalVar.Headers.Add("enum_header_string_array", ClientUtils.ParameterToString(enumHeaderStringArray)); + if (enumHeaderStringArray.IsSet) + httpRequestMessageLocalVar.Headers.Add("enum_header_string_array", ClientUtils.ParameterToString(enumHeaderStringArray.Value)); - if (enumHeaderString != null) - httpRequestMessageLocalVar.Headers.Add("enum_header_string", ClientUtils.ParameterToString(enumHeaderString)); + if (enumHeaderString.IsSet) + httpRequestMessageLocalVar.Headers.Add("enum_header_string", ClientUtils.ParameterToString(enumHeaderString.Value)); MultipartContent multipartContentLocalVar = new MultipartContent(); @@ -2309,11 +2197,11 @@ namespace Org.OpenAPITools.Api List> formParameterLocalVars = new List>(); - multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (enumFormStringArray != null) - formParameterLocalVars.Add(new KeyValuePair("enum_form_string_array", ClientUtils.ParameterToString(enumFormStringArray))); + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (enumFormStringArray.IsSet) + formParameterLocalVars.Add(new KeyValuePair("enum_form_string_array", ClientUtils.ParameterToString(enumFormStringArray.Value))); - if (enumFormString != null) - formParameterLocalVars.Add(new KeyValuePair("enum_form_string", ClientUtils.ParameterToString(enumFormString))); + if (enumFormString.IsSet) + formParameterLocalVars.Add(new KeyValuePair("enum_form_string", ClientUtils.ParameterToString(enumFormString.Value))); httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; @@ -2323,7 +2211,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = new HttpMethod("GET"); @@ -2349,44 +2237,7 @@ namespace Org.OpenAPITools.Api } } - partial void FormatTestGroupParameters(ref bool requiredBooleanGroup, ref int requiredStringGroup, ref long requiredInt64Group, ref bool? booleanGroup, ref int? stringGroup, ref long? int64Group); - - /// - /// Validates the request parameters - /// - /// - /// - /// - /// - /// - /// - /// - private void ValidateTestGroupParameters(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup, int? stringGroup, long? int64Group) - { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (requiredBooleanGroup == null) - throw new ArgumentNullException(nameof(requiredBooleanGroup)); - - if (requiredStringGroup == null) - throw new ArgumentNullException(nameof(requiredStringGroup)); - - if (requiredInt64Group == null) - throw new ArgumentNullException(nameof(requiredInt64Group)); - - if (booleanGroup == null) - throw new ArgumentNullException(nameof(booleanGroup)); - - if (stringGroup == null) - throw new ArgumentNullException(nameof(stringGroup)); - - if (int64Group == null) - throw new ArgumentNullException(nameof(int64Group)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - } + partial void FormatTestGroupParameters(ref bool requiredBooleanGroup, ref int requiredStringGroup, ref long requiredInt64Group, ref Option booleanGroup, ref Option stringGroup, ref Option int64Group); /// /// Processes the server response @@ -2398,7 +2249,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterTestGroupParametersDefaultImplementation(ApiResponse apiResponseLocalVar, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup, int? stringGroup, long? int64Group) + private void AfterTestGroupParametersDefaultImplementation(ApiResponse apiResponseLocalVar, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup, Option stringGroup, Option int64Group) { bool suppressDefaultLog = false; AfterTestGroupParameters(ref suppressDefaultLog, apiResponseLocalVar, requiredBooleanGroup, requiredStringGroup, requiredInt64Group, booleanGroup, stringGroup, int64Group); @@ -2417,7 +2268,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterTestGroupParameters(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup, int? stringGroup, long? int64Group); + partial void AfterTestGroupParameters(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup, Option stringGroup, Option int64Group); /// /// Logs exceptions that occur while retrieving the server response @@ -2431,7 +2282,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorTestGroupParametersDefaultImplementation(Exception exception, string pathFormat, string path, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup, int? stringGroup, long? int64Group) + private void OnErrorTestGroupParametersDefaultImplementation(Exception exception, string pathFormat, string path, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup, Option stringGroup, Option int64Group) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorTestGroupParameters(exception, pathFormat, path, requiredBooleanGroup, requiredStringGroup, requiredInt64Group, booleanGroup, stringGroup, int64Group); @@ -2449,7 +2300,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorTestGroupParameters(Exception exception, string pathFormat, string path, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup, int? stringGroup, long? int64Group); + partial void OnErrorTestGroupParameters(Exception exception, string pathFormat, string path, bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup, Option stringGroup, Option int64Group); /// /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) @@ -2462,7 +2313,7 @@ namespace Org.OpenAPITools.Api /// Integer in group parameters (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> TestGroupParametersOrDefaultAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup = null, int? stringGroup = null, long? int64Group = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> TestGroupParametersOrDefaultAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup = default, Option stringGroup = default, Option int64Group = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -2486,14 +2337,12 @@ namespace Org.OpenAPITools.Api /// Integer in group parameters (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> TestGroupParametersAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup = null, int? stringGroup = null, long? int64Group = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> TestGroupParametersAsync(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, Option booleanGroup = default, Option stringGroup = default, Option int64Group = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateTestGroupParameters(requiredBooleanGroup, requiredStringGroup, requiredInt64Group, booleanGroup, stringGroup, int64Group); - FormatTestGroupParameters(ref requiredBooleanGroup, ref requiredStringGroup, ref requiredInt64Group, ref booleanGroup, ref stringGroup, ref int64Group); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -2508,18 +2357,18 @@ namespace Org.OpenAPITools.Api parseQueryStringLocalVar["required_string_group"] = requiredStringGroup.ToString(); parseQueryStringLocalVar["required_int64_group"] = requiredInt64Group.ToString(); - if (stringGroup != null) - parseQueryStringLocalVar["string_group"] = stringGroup.ToString(); + if (stringGroup.IsSet) + parseQueryStringLocalVar["string_group"] = stringGroup.Value.ToString(); - if (int64Group != null) - parseQueryStringLocalVar["int64_group"] = int64Group.ToString(); + if (int64Group.IsSet) + parseQueryStringLocalVar["int64_group"] = int64Group.Value.ToString(); uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); httpRequestMessageLocalVar.Headers.Add("required_boolean_group", ClientUtils.ParameterToString(requiredBooleanGroup)); - if (booleanGroup != null) - httpRequestMessageLocalVar.Headers.Add("boolean_group", ClientUtils.ParameterToString(booleanGroup)); + if (booleanGroup.IsSet) + httpRequestMessageLocalVar.Headers.Add("boolean_group", ClientUtils.ParameterToString(booleanGroup.Value)); List tokenBaseLocalVars = new List(); @@ -2566,14 +2415,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateTestInlineAdditionalProperties(Dictionary requestBody) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (requestBody == null) throw new ArgumentNullException(nameof(requestBody)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -2673,7 +2516,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = new HttpMethod("POST"); @@ -2709,17 +2552,11 @@ namespace Org.OpenAPITools.Api /// private void ValidateTestJsonFormData(string param, string param2) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (param == null) throw new ArgumentNullException(nameof(param)); if (param2 == null) throw new ArgumentNullException(nameof(param2)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -2833,7 +2670,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = new HttpMethod("GET"); @@ -2859,39 +2696,41 @@ namespace Org.OpenAPITools.Api } } - partial void FormatTestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context); + partial void FormatTestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, ref string requiredNotNullable, ref string requiredNullable, ref Option notRequiredNotNullable, ref Option notRequiredNullable); /// /// Validates the request parameters /// /// - /// /// - /// + /// /// + /// + /// + /// /// - private void ValidateTestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) + private void ValidateTestQueryParameterCollectionFormat(List pipe, List http, Option notRequiredNotNullable, List context, List ioutil, string requiredNotNullable, List url) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (pipe == null) throw new ArgumentNullException(nameof(pipe)); - if (ioutil == null) - throw new ArgumentNullException(nameof(ioutil)); - if (http == null) throw new ArgumentNullException(nameof(http)); - if (url == null) - throw new ArgumentNullException(nameof(url)); + if (notRequiredNotNullable.IsSet && notRequiredNotNullable.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotNullable)); if (context == null) throw new ArgumentNullException(nameof(context)); - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + if (ioutil == null) + throw new ArgumentNullException(nameof(ioutil)); + + if (requiredNotNullable == null) + throw new ArgumentNullException(nameof(requiredNotNullable)); + + if (url == null) + throw new ArgumentNullException(nameof(url)); } /// @@ -2903,10 +2742,14 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterTestQueryParameterCollectionFormatDefaultImplementation(ApiResponse apiResponseLocalVar, List pipe, List ioutil, List http, List url, List context) + /// + /// + /// + /// + private void AfterTestQueryParameterCollectionFormatDefaultImplementation(ApiResponse apiResponseLocalVar, List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, Option notRequiredNotNullable, Option notRequiredNullable) { bool suppressDefaultLog = false; - AfterTestQueryParameterCollectionFormat(ref suppressDefaultLog, apiResponseLocalVar, pipe, ioutil, http, url, context); + AfterTestQueryParameterCollectionFormat(ref suppressDefaultLog, apiResponseLocalVar, pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); if (!suppressDefaultLog) Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); } @@ -2921,7 +2764,11 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterTestQueryParameterCollectionFormat(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, List pipe, List ioutil, List http, List url, List context); + /// + /// + /// + /// + partial void AfterTestQueryParameterCollectionFormat(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, Option notRequiredNotNullable, Option notRequiredNullable); /// /// Logs exceptions that occur while retrieving the server response @@ -2934,10 +2781,14 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorTestQueryParameterCollectionFormatDefaultImplementation(Exception exception, string pathFormat, string path, List pipe, List ioutil, List http, List url, List context) + /// + /// + /// + /// + private void OnErrorTestQueryParameterCollectionFormatDefaultImplementation(Exception exception, string pathFormat, string path, List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, Option notRequiredNotNullable, Option notRequiredNullable) { Logger.LogError(exception, "An error occurred while sending the request to the server."); - OnErrorTestQueryParameterCollectionFormat(exception, pathFormat, path, pipe, ioutil, http, url, context); + OnErrorTestQueryParameterCollectionFormat(exception, pathFormat, path, pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } /// @@ -2951,7 +2802,11 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorTestQueryParameterCollectionFormat(Exception exception, string pathFormat, string path, List pipe, List ioutil, List http, List url, List context); + /// + /// + /// + /// + partial void OnErrorTestQueryParameterCollectionFormat(Exception exception, string pathFormat, string path, List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, Option notRequiredNotNullable, Option notRequiredNullable); /// /// To test the collection format in query parameters @@ -2961,13 +2816,17 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> TestQueryParameterCollectionFormatOrDefaultAsync(List pipe, List ioutil, List http, List url, List context, System.Threading.CancellationToken cancellationToken = default) + public async Task> TestQueryParameterCollectionFormatOrDefaultAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable = default, Option notRequiredNotNullable = default, Option notRequiredNullable = default, System.Threading.CancellationToken cancellationToken = default) { try { - return await TestQueryParameterCollectionFormatAsync(pipe, ioutil, http, url, context, cancellationToken).ConfigureAwait(false); + return await TestQueryParameterCollectionFormatAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable, cancellationToken).ConfigureAwait(false); } catch (Exception) { @@ -2984,17 +2843,21 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, System.Threading.CancellationToken cancellationToken = default) + public async Task> TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable = default, Option notRequiredNotNullable = default, Option notRequiredNullable = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + ValidateTestQueryParameterCollectionFormat(pipe, http, notRequiredNotNullable, context, ioutil, requiredNotNullable, url); - FormatTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + FormatTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, ref requiredNotNullable, ref requiredNullable, ref notRequiredNotNullable, ref notRequiredNullable); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) { @@ -3010,6 +2873,14 @@ namespace Org.OpenAPITools.Api parseQueryStringLocalVar["http"] = http.ToString(); parseQueryStringLocalVar["url"] = url.ToString(); parseQueryStringLocalVar["context"] = context.ToString(); + parseQueryStringLocalVar["requiredNotNullable"] = requiredNotNullable.ToString(); + parseQueryStringLocalVar["requiredNullable"] = requiredNullable.ToString(); + + if (notRequiredNotNullable.IsSet) + parseQueryStringLocalVar["notRequiredNotNullable"] = notRequiredNotNullable.Value.ToString(); + + if (notRequiredNullable.IsSet) + parseQueryStringLocalVar["notRequiredNullable"] = notRequiredNullable.Value.ToString(); uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); @@ -3024,7 +2895,7 @@ namespace Org.OpenAPITools.Api ApiResponse apiResponseLocalVar = new ApiResponse(httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/test-query-parameters", requestedAtLocalVar, _jsonSerializerOptions); - AfterTestQueryParameterCollectionFormatDefaultImplementation(apiResponseLocalVar, pipe, ioutil, http, url, context); + AfterTestQueryParameterCollectionFormatDefaultImplementation(apiResponseLocalVar, pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); return apiResponseLocalVar; } @@ -3032,7 +2903,7 @@ namespace Org.OpenAPITools.Api } catch(Exception e) { - OnErrorTestQueryParameterCollectionFormatDefaultImplementation(e, "/fake/test-query-parameters", uriBuilderLocalVar.Path, pipe, ioutil, http, url, context); + OnErrorTestQueryParameterCollectionFormatDefaultImplementation(e, "/fake/test-query-parameters", uriBuilderLocalVar.Path, pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); throw; } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index 2203d73140b..9cc4f4e8f24 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -126,14 +126,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateTestClassname(ModelClient modelClient) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (modelClient == null) throw new ArgumentNullException(nameof(modelClient)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -244,7 +238,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs index 253291dd5b2..7c0b69f4437 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs @@ -61,7 +61,7 @@ namespace Org.OpenAPITools.IApi /// (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<object>> - Task> DeletePetAsync(long petId, string apiKey = null, System.Threading.CancellationToken cancellationToken = default); + Task> DeletePetAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default); /// /// Deletes a pet @@ -73,7 +73,7 @@ namespace Org.OpenAPITools.IApi /// (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>object>> - Task> DeletePetOrDefaultAsync(long petId, string apiKey = null, System.Threading.CancellationToken cancellationToken = default); + Task> DeletePetOrDefaultAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default); /// /// Finds Pets by status @@ -179,7 +179,7 @@ namespace Org.OpenAPITools.IApi /// Updated status of the pet (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<object>> - Task> UpdatePetWithFormAsync(long petId, string name = null, string status = null, System.Threading.CancellationToken cancellationToken = default); + Task> UpdatePetWithFormAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default); /// /// Updates a pet in the store with form data @@ -192,7 +192,7 @@ namespace Org.OpenAPITools.IApi /// Updated status of the pet (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>object>> - Task> UpdatePetWithFormOrDefaultAsync(long petId, string name = null, string status = null, System.Threading.CancellationToken cancellationToken = default); + Task> UpdatePetWithFormOrDefaultAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default); /// /// uploads an image @@ -206,7 +206,7 @@ namespace Org.OpenAPITools.IApi /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<ApiResponse>> - Task> UploadFileAsync(long petId, System.IO.Stream file = null, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default); + Task> UploadFileAsync(long petId, Option file = default, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default); /// /// uploads an image @@ -219,7 +219,7 @@ namespace Org.OpenAPITools.IApi /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>ApiResponse>> - Task> UploadFileOrDefaultAsync(long petId, System.IO.Stream file = null, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default); + Task> UploadFileOrDefaultAsync(long petId, Option file = default, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default); /// /// uploads an image (required) @@ -233,7 +233,7 @@ namespace Org.OpenAPITools.IApi /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse<ApiResponse>> - Task> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default); + Task> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default); /// /// uploads an image (required) @@ -246,7 +246,7 @@ namespace Org.OpenAPITools.IApi /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// Task<ApiResponse>ApiResponse>> - Task> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default); + Task> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default); } } @@ -324,14 +324,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateAddPet(Pet pet) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (pet == null) throw new ArgumentNullException(nameof(pet)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -437,9 +431,11 @@ namespace Org.OpenAPITools.Api tokenBaseLocalVars.Add(httpSignatureTokenLocalVar); - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); - httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } string[] contentTypes = new string[] { "application/json", @@ -448,7 +444,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = new HttpMethod("POST"); @@ -482,27 +478,17 @@ namespace Org.OpenAPITools.Api } } - partial void FormatDeletePet(ref long petId, ref string apiKey); + partial void FormatDeletePet(ref long petId, ref Option apiKey); /// /// Validates the request parameters /// - /// /// /// - private void ValidateDeletePet(long petId, string apiKey) + private void ValidateDeletePet(Option apiKey) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (petId == null) - throw new ArgumentNullException(nameof(petId)); - - if (apiKey == null) + if (apiKey.IsSet && apiKey.Value == null) throw new ArgumentNullException(nameof(apiKey)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -511,7 +497,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterDeletePetDefaultImplementation(ApiResponse apiResponseLocalVar, long petId, string apiKey) + private void AfterDeletePetDefaultImplementation(ApiResponse apiResponseLocalVar, long petId, Option apiKey) { bool suppressDefaultLog = false; AfterDeletePet(ref suppressDefaultLog, apiResponseLocalVar, petId, apiKey); @@ -526,7 +512,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterDeletePet(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, long petId, string apiKey); + partial void AfterDeletePet(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, long petId, Option apiKey); /// /// Logs exceptions that occur while retrieving the server response @@ -536,7 +522,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorDeletePetDefaultImplementation(Exception exception, string pathFormat, string path, long petId, string apiKey) + private void OnErrorDeletePetDefaultImplementation(Exception exception, string pathFormat, string path, long petId, Option apiKey) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorDeletePet(exception, pathFormat, path, petId, apiKey); @@ -550,7 +536,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorDeletePet(Exception exception, string pathFormat, string path, long petId, string apiKey); + partial void OnErrorDeletePet(Exception exception, string pathFormat, string path, long petId, Option apiKey); /// /// Deletes a pet @@ -559,7 +545,7 @@ namespace Org.OpenAPITools.Api /// (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> DeletePetOrDefaultAsync(long petId, string apiKey = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> DeletePetOrDefaultAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -579,13 +565,13 @@ namespace Org.OpenAPITools.Api /// (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> DeletePetAsync(long petId, string apiKey = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> DeletePetAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateDeletePet(petId, apiKey); + ValidateDeletePet(apiKey); FormatDeletePet(ref petId, ref apiKey); @@ -597,8 +583,8 @@ namespace Org.OpenAPITools.Api uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/{petId}"; uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); - if (apiKey != null) - httpRequestMessageLocalVar.Headers.Add("api_key", ClientUtils.ParameterToString(apiKey)); + if (apiKey.IsSet) + httpRequestMessageLocalVar.Headers.Add("api_key", ClientUtils.ParameterToString(apiKey.Value)); List tokenBaseLocalVars = new List(); @@ -645,14 +631,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateFindPetsByStatus(List status) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (status == null) throw new ArgumentNullException(nameof(status)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -760,9 +740,11 @@ namespace Org.OpenAPITools.Api tokenBaseLocalVars.Add(httpSignatureTokenLocalVar); - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); - httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } string[] acceptLocalVars = new string[] { "application/xml", @@ -813,14 +795,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateFindPetsByTags(List tags) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (tags == null) throw new ArgumentNullException(nameof(tags)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -928,9 +904,11 @@ namespace Org.OpenAPITools.Api tokenBaseLocalVars.Add(httpSignatureTokenLocalVar); - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); - httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } string[] acceptLocalVars = new string[] { "application/xml", @@ -974,23 +952,6 @@ namespace Org.OpenAPITools.Api partial void FormatGetPetById(ref long petId); - /// - /// Validates the request parameters - /// - /// - /// - private void ValidateGetPetById(long petId) - { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (petId == null) - throw new ArgumentNullException(nameof(petId)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - } - /// /// Processes the server response /// @@ -1065,8 +1026,6 @@ namespace Org.OpenAPITools.Api try { - ValidateGetPetById(petId); - FormatGetPetById(ref petId); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -1132,14 +1091,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateUpdatePet(Pet pet) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (pet == null) throw new ArgumentNullException(nameof(pet)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1245,9 +1198,11 @@ namespace Org.OpenAPITools.Api tokenBaseLocalVars.Add(httpSignatureTokenLocalVar); - string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); - httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } string[] contentTypes = new string[] { "application/json", @@ -1256,7 +1211,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); @@ -1290,31 +1245,21 @@ namespace Org.OpenAPITools.Api } } - partial void FormatUpdatePetWithForm(ref long petId, ref string name, ref string status); + partial void FormatUpdatePetWithForm(ref long petId, ref Option name, ref Option status); /// /// Validates the request parameters /// - /// - /// /// + /// /// - private void ValidateUpdatePetWithForm(long petId, string name, string status) + private void ValidateUpdatePetWithForm(Option status, Option name) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (petId == null) - throw new ArgumentNullException(nameof(petId)); - - if (name == null) - throw new ArgumentNullException(nameof(name)); - - if (status == null) + if (status.IsSet && status.Value == null) throw new ArgumentNullException(nameof(status)); - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name)); } /// @@ -1324,7 +1269,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterUpdatePetWithFormDefaultImplementation(ApiResponse apiResponseLocalVar, long petId, string name, string status) + private void AfterUpdatePetWithFormDefaultImplementation(ApiResponse apiResponseLocalVar, long petId, Option name, Option status) { bool suppressDefaultLog = false; AfterUpdatePetWithForm(ref suppressDefaultLog, apiResponseLocalVar, petId, name, status); @@ -1340,7 +1285,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterUpdatePetWithForm(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, long petId, string name, string status); + partial void AfterUpdatePetWithForm(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, long petId, Option name, Option status); /// /// Logs exceptions that occur while retrieving the server response @@ -1351,7 +1296,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorUpdatePetWithFormDefaultImplementation(Exception exception, string pathFormat, string path, long petId, string name, string status) + private void OnErrorUpdatePetWithFormDefaultImplementation(Exception exception, string pathFormat, string path, long petId, Option name, Option status) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorUpdatePetWithForm(exception, pathFormat, path, petId, name, status); @@ -1366,7 +1311,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorUpdatePetWithForm(Exception exception, string pathFormat, string path, long petId, string name, string status); + partial void OnErrorUpdatePetWithForm(Exception exception, string pathFormat, string path, long petId, Option name, Option status); /// /// Updates a pet in the store with form data @@ -1376,7 +1321,7 @@ namespace Org.OpenAPITools.Api /// Updated status of the pet (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> UpdatePetWithFormOrDefaultAsync(long petId, string name = null, string status = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> UpdatePetWithFormOrDefaultAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -1397,13 +1342,13 @@ namespace Org.OpenAPITools.Api /// Updated status of the pet (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> UpdatePetWithFormAsync(long petId, string name = null, string status = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> UpdatePetWithFormAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateUpdatePetWithForm(petId, name, status); + ValidateUpdatePetWithForm(status, name); FormatUpdatePetWithForm(ref petId, ref name, ref status); @@ -1421,11 +1366,11 @@ namespace Org.OpenAPITools.Api List> formParameterLocalVars = new List>(); - multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (name != null) - formParameterLocalVars.Add(new KeyValuePair("name", ClientUtils.ParameterToString(name))); + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (name.IsSet) + formParameterLocalVars.Add(new KeyValuePair("name", ClientUtils.ParameterToString(name.Value))); - if (status != null) - formParameterLocalVars.Add(new KeyValuePair("status", ClientUtils.ParameterToString(status))); + if (status.IsSet) + formParameterLocalVars.Add(new KeyValuePair("status", ClientUtils.ParameterToString(status.Value))); List tokenBaseLocalVars = new List(); @@ -1443,7 +1388,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = new HttpMethod("POST"); @@ -1473,31 +1418,21 @@ namespace Org.OpenAPITools.Api } } - partial void FormatUploadFile(ref long petId, ref System.IO.Stream file, ref string additionalMetadata); + partial void FormatUploadFile(ref long petId, ref Option file, ref Option additionalMetadata); /// /// Validates the request parameters /// - /// /// /// /// - private void ValidateUploadFile(long petId, System.IO.Stream file, string additionalMetadata) + private void ValidateUploadFile(Option file, Option additionalMetadata) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (petId == null) - throw new ArgumentNullException(nameof(petId)); - - if (file == null) + if (file.IsSet && file.Value == null) throw new ArgumentNullException(nameof(file)); - if (additionalMetadata == null) + if (additionalMetadata.IsSet && additionalMetadata.Value == null) throw new ArgumentNullException(nameof(additionalMetadata)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1507,7 +1442,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterUploadFileDefaultImplementation(ApiResponse apiResponseLocalVar, long petId, System.IO.Stream file, string additionalMetadata) + private void AfterUploadFileDefaultImplementation(ApiResponse apiResponseLocalVar, long petId, Option file, Option additionalMetadata) { bool suppressDefaultLog = false; AfterUploadFile(ref suppressDefaultLog, apiResponseLocalVar, petId, file, additionalMetadata); @@ -1523,7 +1458,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterUploadFile(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, long petId, System.IO.Stream file, string additionalMetadata); + partial void AfterUploadFile(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, long petId, Option file, Option additionalMetadata); /// /// Logs exceptions that occur while retrieving the server response @@ -1534,7 +1469,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorUploadFileDefaultImplementation(Exception exception, string pathFormat, string path, long petId, System.IO.Stream file, string additionalMetadata) + private void OnErrorUploadFileDefaultImplementation(Exception exception, string pathFormat, string path, long petId, Option file, Option additionalMetadata) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorUploadFile(exception, pathFormat, path, petId, file, additionalMetadata); @@ -1549,7 +1484,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorUploadFile(Exception exception, string pathFormat, string path, long petId, System.IO.Stream file, string additionalMetadata); + partial void OnErrorUploadFile(Exception exception, string pathFormat, string path, long petId, Option file, Option additionalMetadata); /// /// uploads an image @@ -1559,7 +1494,7 @@ namespace Org.OpenAPITools.Api /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> UploadFileOrDefaultAsync(long petId, System.IO.Stream file = null, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> UploadFileOrDefaultAsync(long petId, Option file = default, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -1580,13 +1515,13 @@ namespace Org.OpenAPITools.Api /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> UploadFileAsync(long petId, System.IO.Stream file = null, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> UploadFileAsync(long petId, Option file = default, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateUploadFile(petId, file, additionalMetadata); + ValidateUploadFile(file, additionalMetadata); FormatUploadFile(ref petId, ref file, ref additionalMetadata); @@ -1604,11 +1539,11 @@ namespace Org.OpenAPITools.Api List> formParameterLocalVars = new List>(); - multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (file != null) - multipartContentLocalVar.Add(new StreamContent(file)); + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (file.IsSet) + multipartContentLocalVar.Add(new StreamContent(file.Value)); - if (additionalMetadata != null) - formParameterLocalVars.Add(new KeyValuePair("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata))); + if (additionalMetadata.IsSet) + formParameterLocalVars.Add(new KeyValuePair("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata.Value))); List tokenBaseLocalVars = new List(); @@ -1626,7 +1561,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { @@ -1664,31 +1599,21 @@ namespace Org.OpenAPITools.Api } } - partial void FormatUploadFileWithRequiredFile(ref System.IO.Stream requiredFile, ref long petId, ref string additionalMetadata); + partial void FormatUploadFileWithRequiredFile(ref System.IO.Stream requiredFile, ref long petId, ref Option additionalMetadata); /// /// Validates the request parameters /// /// - /// /// /// - private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, long petId, string additionalMetadata) + private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, Option additionalMetadata) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (requiredFile == null) throw new ArgumentNullException(nameof(requiredFile)); - if (petId == null) - throw new ArgumentNullException(nameof(petId)); - - if (additionalMetadata == null) + if (additionalMetadata.IsSet && additionalMetadata.Value == null) throw new ArgumentNullException(nameof(additionalMetadata)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1698,7 +1623,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void AfterUploadFileWithRequiredFileDefaultImplementation(ApiResponse apiResponseLocalVar, System.IO.Stream requiredFile, long petId, string additionalMetadata) + private void AfterUploadFileWithRequiredFileDefaultImplementation(ApiResponse apiResponseLocalVar, System.IO.Stream requiredFile, long petId, Option additionalMetadata) { bool suppressDefaultLog = false; AfterUploadFileWithRequiredFile(ref suppressDefaultLog, apiResponseLocalVar, requiredFile, petId, additionalMetadata); @@ -1714,7 +1639,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void AfterUploadFileWithRequiredFile(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, System.IO.Stream requiredFile, long petId, string additionalMetadata); + partial void AfterUploadFileWithRequiredFile(ref bool suppressDefaultLog, ApiResponse apiResponseLocalVar, System.IO.Stream requiredFile, long petId, Option additionalMetadata); /// /// Logs exceptions that occur while retrieving the server response @@ -1725,7 +1650,7 @@ namespace Org.OpenAPITools.Api /// /// /// - private void OnErrorUploadFileWithRequiredFileDefaultImplementation(Exception exception, string pathFormat, string path, System.IO.Stream requiredFile, long petId, string additionalMetadata) + private void OnErrorUploadFileWithRequiredFileDefaultImplementation(Exception exception, string pathFormat, string path, System.IO.Stream requiredFile, long petId, Option additionalMetadata) { Logger.LogError(exception, "An error occurred while sending the request to the server."); OnErrorUploadFileWithRequiredFile(exception, pathFormat, path, requiredFile, petId, additionalMetadata); @@ -1740,7 +1665,7 @@ namespace Org.OpenAPITools.Api /// /// /// - partial void OnErrorUploadFileWithRequiredFile(Exception exception, string pathFormat, string path, System.IO.Stream requiredFile, long petId, string additionalMetadata); + partial void OnErrorUploadFileWithRequiredFile(Exception exception, string pathFormat, string path, System.IO.Stream requiredFile, long petId, Option additionalMetadata); /// /// uploads an image (required) @@ -1750,7 +1675,7 @@ namespace Org.OpenAPITools.Api /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default) { try { @@ -1771,13 +1696,13 @@ namespace Org.OpenAPITools.Api /// Additional data to pass to server (optional) /// Cancellation Token to cancel the request. /// <> where T : - public async Task> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default) + public async Task> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default) { UriBuilder uriBuilderLocalVar = new UriBuilder(); try { - ValidateUploadFileWithRequiredFile(requiredFile, petId, additionalMetadata); + ValidateUploadFileWithRequiredFile(requiredFile, additionalMetadata); FormatUploadFileWithRequiredFile(ref requiredFile, ref petId, ref additionalMetadata); @@ -1797,8 +1722,8 @@ namespace Org.OpenAPITools.Api multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); multipartContentLocalVar.Add(new StreamContent(requiredFile)); - if (additionalMetadata != null) - formParameterLocalVars.Add(new KeyValuePair("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata))); + if (additionalMetadata.IsSet) + formParameterLocalVars.Add(new KeyValuePair("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata.Value))); List tokenBaseLocalVars = new List(); @@ -1816,7 +1741,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/StoreApi.cs index e93f7444fca..6f62f4818fb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/StoreApi.cs @@ -193,14 +193,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateDeleteOrder(string orderId) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (orderId == null) throw new ArgumentNullException(nameof(orderId)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -435,23 +429,6 @@ namespace Org.OpenAPITools.Api partial void FormatGetOrderById(ref long orderId); - /// - /// Validates the request parameters - /// - /// - /// - private void ValidateGetOrderById(long orderId) - { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (orderId == null) - throw new ArgumentNullException(nameof(orderId)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - } - /// /// Processes the server response /// @@ -526,8 +503,6 @@ namespace Org.OpenAPITools.Api try { - ValidateGetOrderById(orderId); - FormatGetOrderById(ref orderId); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -581,14 +556,8 @@ namespace Org.OpenAPITools.Api /// private void ValidatePlaceOrder(Order order) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (order == null) throw new ArgumentNullException(nameof(order)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -688,7 +657,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); string[] acceptLocalVars = new string[] { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/UserApi.cs index de22825526e..a26f9f1fc65 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/UserApi.cs @@ -289,14 +289,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateCreateUser(User user) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (user == null) throw new ArgumentNullException(nameof(user)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -396,7 +390,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = new HttpMethod("POST"); @@ -431,14 +425,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateCreateUsersWithArrayInput(List user) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (user == null) throw new ArgumentNullException(nameof(user)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -538,7 +526,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = new HttpMethod("POST"); @@ -573,14 +561,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateCreateUsersWithListInput(List user) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (user == null) throw new ArgumentNullException(nameof(user)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -680,7 +662,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = new HttpMethod("POST"); @@ -715,14 +697,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateDeleteUser(string username) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (username == null) throw new ArgumentNullException(nameof(username)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -844,14 +820,8 @@ namespace Org.OpenAPITools.Api /// private void ValidateGetUserByName(string username) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (username == null) throw new ArgumentNullException(nameof(username)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -984,17 +954,11 @@ namespace Org.OpenAPITools.Api /// private void ValidateLoginUser(string username, string password) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - if (username == null) throw new ArgumentNullException(nameof(username)); if (password == null) throw new ArgumentNullException(nameof(password)); - - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } /// @@ -1233,22 +1197,16 @@ namespace Org.OpenAPITools.Api /// /// Validates the request parameters /// - /// /// + /// /// - private void ValidateUpdateUser(User user, string username) + private void ValidateUpdateUser(string username, User user) { - #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - - if (user == null) - throw new ArgumentNullException(nameof(user)); - if (username == null) throw new ArgumentNullException(nameof(username)); - #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' - #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + if (user == null) + throw new ArgumentNullException(nameof(user)); } /// @@ -1331,7 +1289,7 @@ namespace Org.OpenAPITools.Api try { - ValidateUpdateUser(user, username); + ValidateUpdateUser(username, user); FormatUpdateUser(user, ref username); @@ -1355,7 +1313,7 @@ namespace Org.OpenAPITools.Api string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); - if (contentTypeLocalVar != null) + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); httpRequestMessageLocalVar.Method = new HttpMethod("PUT"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/Option.cs new file mode 100644 index 00000000000..70f41078bb6 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/Option.cs @@ -0,0 +1,39 @@ +// +/* + * 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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +namespace Org.OpenAPITools.Client +{ + /// + /// A wrapper for operation parameters which are not required + /// + public struct Option + { + /// + /// The value to send to the server + /// + public TType Value { get; } + + /// + /// When true the value will be sent to the server + /// + internal bool IsSet { get; } + + /// + /// A wrapper for operation parameters which are not required + /// + /// + public Option(TType value) + { + IsSet = true; + Value = value; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 48464abd1f9..4bcf2ff282d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -275,13 +275,20 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("empty_map"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); writer.WritePropertyName("map_of_map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); writer.WritePropertyName("map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); writer.WritePropertyName("map_with_undeclared_properties_string"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + writer.WritePropertyName("map_of_map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + writer.WritePropertyName("map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_string"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + writer.WritePropertyName("anytype_1"); JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs index f46a0e8bab0..5caff8d822f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -192,8 +192,10 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("array_array_of_integer"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); writer.WritePropertyName("array_array_of_model"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); writer.WritePropertyName("array_of_string"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + writer.WritePropertyName("array_array_of_model"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + writer.WritePropertyName("array_of_string"); JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs index a6ee8f3ebba..1cda67a3fa9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs @@ -197,9 +197,12 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("mainShape"); - JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); writer.WritePropertyName("shapes"); - JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); writer.WritePropertyName("nullableShape"); - JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); writer.WritePropertyName("shapeOrNull"); + JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + writer.WritePropertyName("nullableShape"); + JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); + writer.WritePropertyName("shapeOrNull"); JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs index c4e5de93130..aff7a4ad3d2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -310,6 +310,7 @@ namespace Org.OpenAPITools.Model { writer.WritePropertyName("array_enum"); JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol); if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 0804787231e..7f31c2f04f5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -175,7 +175,8 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("file"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); writer.WritePropertyName("files"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + writer.WritePropertyName("files"); JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs index 6457a415f71..a58b03e2200 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -587,11 +587,14 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("binary"); - JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); writer.WritePropertyName("byte"); - JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); + JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + writer.WritePropertyName("byte"); + JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); writer.WriteString("dateTime", formatTest.DateTime.ToString(DateTimeFormat)); writer.WritePropertyName("decimal"); - JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); writer.WriteNumber("double", formatTest.VarDouble); + JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); + writer.WriteNumber("double", formatTest.VarDouble); writer.WriteNumber("float", formatTest.VarFloat); writer.WriteNumber("int32", formatTest.Int32); writer.WriteNumber("int64", formatTest.Int64); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs index 448c6477ab5..92da24c3ef1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs @@ -275,9 +275,12 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("direct_map"); - JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); writer.WritePropertyName("indirect_map"); - JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); writer.WritePropertyName("map_map_of_string"); - JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); writer.WritePropertyName("map_of_enum_string"); + JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + writer.WritePropertyName("indirect_map"); + JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + writer.WritePropertyName("map_map_of_string"); + JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + writer.WritePropertyName("map_of_enum_string"); JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 7901d14ec2a..487806c051a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -222,7 +222,8 @@ namespace Org.OpenAPITools.Model { writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.ToString(DateTimeFormat)); writer.WritePropertyName("map"); - JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid); + JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid); writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs index c526cc355f0..5d15b68a30e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs @@ -318,10 +318,14 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("array_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); writer.WritePropertyName("object_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); writer.WritePropertyName("array_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); writer.WritePropertyName("array_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + writer.WritePropertyName("array_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); + writer.WritePropertyName("array_nullable_prop"); JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); + if (nullableClass.BooleanProp != null) writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value); else @@ -348,8 +352,10 @@ namespace Org.OpenAPITools.Model writer.WriteNull("number_prop"); writer.WritePropertyName("object_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); writer.WritePropertyName("object_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); writer.WriteString("string_prop", nullableClass.StringProp); + JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); + writer.WritePropertyName("object_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); + writer.WriteString("string_prop", nullableClass.StringProp); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 010dad50bee..ec1fc811445 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -211,8 +211,10 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("bars"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); writer.WritePropertyName("deprecatedRef"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); writer.WriteNumber("id", objectWithDeprecatedFields.Id); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + writer.WritePropertyName("deprecatedRef"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + writer.WriteNumber("id", objectWithDeprecatedFields.Id); writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs index 8ce91807343..10777ea636e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs @@ -327,10 +327,12 @@ namespace Org.OpenAPITools.Model public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) { writer.WritePropertyName("category"); - JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); writer.WriteNumber("id", pet.Id); + JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + writer.WriteNumber("id", pet.Id); writer.WriteString("name", pet.Name); writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); + var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status); if (statusRawValue != null) writer.WriteString("status", statusRawValue); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs index 35235f141ee..32f57e24959 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs @@ -339,13 +339,16 @@ namespace Org.OpenAPITools.Model writer.WriteNumber("id", user.Id); writer.WriteString("lastName", user.LastName); writer.WritePropertyName("objectWithNoDeclaredProps"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); writer.WriteString("password", user.Password); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + writer.WriteString("password", user.Password); writer.WriteString("phone", user.Phone); writer.WriteNumber("userStatus", user.UserStatus); writer.WriteString("username", user.Username); writer.WritePropertyName("anyTypeProp"); - JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); writer.WritePropertyName("anyTypePropNullable"); - JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml index 6be7f291ccc..c2398ea9992 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml @@ -1036,6 +1036,38 @@ paths: type: string type: array style: form + - explode: true + in: query + name: requiredNotNullable + required: true + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: requiredNullable + required: true + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: notRequiredNotNullable + required: false + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: notRequiredNullable + required: false + schema: + nullable: true + type: string + style: form responses: "200": description: Success diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/FakeApi.md index 703290f204a..179bd712636 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/FakeApi.md @@ -1357,7 +1357,7 @@ No authorization required # **TestQueryParameterCollectionFormat** -> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context) +> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = null, string notRequiredNullable = null) @@ -1389,10 +1389,14 @@ namespace Example var http = new List(); // List | var url = new List(); // List | var context = new List(); // List | + var requiredNotNullable = "requiredNotNullable_example"; // string | + var requiredNullable = "requiredNullable_example"; // string | + var notRequiredNotNullable = "notRequiredNotNullable_example"; // string | (optional) + var notRequiredNullable = "notRequiredNullable_example"; // string | (optional) try { - apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1411,7 +1415,7 @@ This returns an ApiResponse object which contains the response data, status code ```csharp try { - apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1430,6 +1434,10 @@ catch (ApiException e) | **http** | [**List<string>**](string.md) | | | | **url** | [**List<string>**](string.md) | | | | **context** | [**List<string>**](string.md) | | | +| **requiredNotNullable** | **string** | | | +| **requiredNullable** | **string** | | | +| **notRequiredNotNullable** | **string** | | [optional] | +| **notRequiredNullable** | **string** | | [optional] | ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeApi.cs index cbc78b4dc1f..6beca60b3bf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Api/FakeApi.cs @@ -370,8 +370,12 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// - void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context); + void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string)); /// /// @@ -385,8 +389,12 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// ApiResponse of Object(void) - ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context); + ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string)); #endregion Synchronous Operations } @@ -782,9 +790,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Cancellation Token to cancel the request. /// Task of void - System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// @@ -798,9 +810,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Cancellation Token to cancel the request. /// Task of ApiResponse - System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); #endregion Asynchronous Operations } @@ -2893,10 +2909,14 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// - public void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) + public void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string)) { - TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } /// @@ -2908,8 +2928,12 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context) + public Org.OpenAPITools.Client.ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string)) { // verify the required parameter 'pipe' is set if (pipe == null) @@ -2931,6 +2955,14 @@ namespace Org.OpenAPITools.Api if (context == null) throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); + // verify the required parameter 'requiredNotNullable' is set + if (requiredNotNullable == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + + // verify the required parameter 'requiredNullable' is set + if (requiredNullable == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); string[] _contentTypes = new string[] { @@ -2951,6 +2983,16 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); + if (notRequiredNotNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); + } + if (notRequiredNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); + } // make the HTTP request @@ -2974,11 +3016,15 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Cancellation Token to cancel the request. /// Task of void - public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, cancellationToken).ConfigureAwait(false); + await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable, cancellationToken).ConfigureAwait(false); } /// @@ -2990,9 +3036,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Cancellation Token to cancel the request. /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // verify the required parameter 'pipe' is set if (pipe == null) @@ -3014,6 +3064,14 @@ namespace Org.OpenAPITools.Api if (context == null) throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); + // verify the required parameter 'requiredNotNullable' is set + if (requiredNotNullable == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + + // verify the required parameter 'requiredNullable' is set + if (requiredNullable == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); @@ -3036,6 +3094,16 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); + if (notRequiredNotNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); + } + if (notRequiredNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); + } // make the HTTP request diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml index 6be7f291ccc..c2398ea9992 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml @@ -1036,6 +1036,38 @@ paths: type: string type: array style: form + - explode: true + in: query + name: requiredNotNullable + required: true + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: requiredNullable + required: true + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: notRequiredNotNullable + required: false + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: notRequiredNullable + required: false + schema: + nullable: true + type: string + style: form responses: "200": description: Success diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient-net47/docs/FakeApi.md index 7bdf5246aac..f2bf397505d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/docs/FakeApi.md @@ -1301,7 +1301,7 @@ No authorization required # **TestQueryParameterCollectionFormat** -> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context) +> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = null, string notRequiredNullable = null) @@ -1329,10 +1329,14 @@ namespace Example var http = new List(); // List | var url = new List(); // List | var context = new List(); // List | + var requiredNotNullable = "requiredNotNullable_example"; // string | + var requiredNullable = "requiredNullable_example"; // string | + var notRequiredNotNullable = "notRequiredNotNullable_example"; // string | (optional) + var notRequiredNullable = "notRequiredNullable_example"; // string | (optional) try { - apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1351,7 +1355,7 @@ This returns an ApiResponse object which contains the response data, status code ```csharp try { - apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1370,6 +1374,10 @@ catch (ApiException e) | **http** | [**List<string>**](string.md) | | | | **url** | [**List<string>**](string.md) | | | | **context** | [**List<string>**](string.md) | | | +| **requiredNotNullable** | **string** | | | +| **requiredNullable** | **string** | | | +| **notRequiredNotNullable** | **string** | | [optional] | +| **notRequiredNullable** | **string** | | [optional] | ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Api/FakeApi.cs index db7210ad86f..aef969f7935 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Api/FakeApi.cs @@ -398,9 +398,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// - void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0); + void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0); /// /// @@ -414,9 +418,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// ApiResponse of Object(void) - ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0); + ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0); #endregion Synchronous Operations } @@ -840,10 +848,14 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of void - System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// @@ -857,10 +869,14 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of ApiResponse - System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); #endregion Asynchronous Operations } @@ -3246,11 +3262,15 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// - public void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0) + public void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0) { - TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } /// @@ -3262,9 +3282,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0) + public Org.OpenAPITools.Client.ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0) { // verify the required parameter 'pipe' is set if (pipe == null) @@ -3296,6 +3320,18 @@ namespace Org.OpenAPITools.Api throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); } + // verify the required parameter 'requiredNotNullable' is set + if (requiredNotNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'requiredNullable' is set + if (requiredNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); string[] _contentTypes = new string[] { @@ -3322,6 +3358,16 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); + if (notRequiredNotNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); + } + if (notRequiredNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); + } localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat"; localVarRequestOptions.OperationIndex = operationIndex; @@ -3350,12 +3396,16 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of void - public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, operationIndex, cancellationToken).ConfigureAwait(false); + await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable, operationIndex, cancellationToken).ConfigureAwait(false); } /// @@ -3367,10 +3417,14 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // verify the required parameter 'pipe' is set if (pipe == null) @@ -3402,6 +3456,18 @@ namespace Org.OpenAPITools.Api throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); } + // verify the required parameter 'requiredNotNullable' is set + if (requiredNotNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'requiredNullable' is set + if (requiredNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); @@ -3429,6 +3495,16 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); + if (notRequiredNotNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); + } + if (notRequiredNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); + } localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat"; localVarRequestOptions.OperationIndex = operationIndex; diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml index 6be7f291ccc..c2398ea9992 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml @@ -1036,6 +1036,38 @@ paths: type: string type: array style: form + - explode: true + in: query + name: requiredNotNullable + required: true + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: requiredNullable + required: true + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: notRequiredNotNullable + required: false + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: notRequiredNullable + required: false + schema: + nullable: true + type: string + style: form responses: "200": description: Success diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient-net48/docs/FakeApi.md index 7bdf5246aac..f2bf397505d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/docs/FakeApi.md @@ -1301,7 +1301,7 @@ No authorization required # **TestQueryParameterCollectionFormat** -> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context) +> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = null, string notRequiredNullable = null) @@ -1329,10 +1329,14 @@ namespace Example var http = new List(); // List | var url = new List(); // List | var context = new List(); // List | + var requiredNotNullable = "requiredNotNullable_example"; // string | + var requiredNullable = "requiredNullable_example"; // string | + var notRequiredNotNullable = "notRequiredNotNullable_example"; // string | (optional) + var notRequiredNullable = "notRequiredNullable_example"; // string | (optional) try { - apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1351,7 +1355,7 @@ This returns an ApiResponse object which contains the response data, status code ```csharp try { - apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1370,6 +1374,10 @@ catch (ApiException e) | **http** | [**List<string>**](string.md) | | | | **url** | [**List<string>**](string.md) | | | | **context** | [**List<string>**](string.md) | | | +| **requiredNotNullable** | **string** | | | +| **requiredNullable** | **string** | | | +| **notRequiredNotNullable** | **string** | | [optional] | +| **notRequiredNullable** | **string** | | [optional] | ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Api/FakeApi.cs index db7210ad86f..aef969f7935 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Api/FakeApi.cs @@ -398,9 +398,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// - void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0); + void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0); /// /// @@ -414,9 +418,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// ApiResponse of Object(void) - ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0); + ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0); #endregion Synchronous Operations } @@ -840,10 +848,14 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of void - System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// @@ -857,10 +869,14 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of ApiResponse - System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); #endregion Asynchronous Operations } @@ -3246,11 +3262,15 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// - public void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0) + public void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0) { - TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } /// @@ -3262,9 +3282,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0) + public Org.OpenAPITools.Client.ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0) { // verify the required parameter 'pipe' is set if (pipe == null) @@ -3296,6 +3320,18 @@ namespace Org.OpenAPITools.Api throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); } + // verify the required parameter 'requiredNotNullable' is set + if (requiredNotNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'requiredNullable' is set + if (requiredNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); string[] _contentTypes = new string[] { @@ -3322,6 +3358,16 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); + if (notRequiredNotNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); + } + if (notRequiredNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); + } localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat"; localVarRequestOptions.OperationIndex = operationIndex; @@ -3350,12 +3396,16 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of void - public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, operationIndex, cancellationToken).ConfigureAwait(false); + await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable, operationIndex, cancellationToken).ConfigureAwait(false); } /// @@ -3367,10 +3417,14 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // verify the required parameter 'pipe' is set if (pipe == null) @@ -3402,6 +3456,18 @@ namespace Org.OpenAPITools.Api throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); } + // verify the required parameter 'requiredNotNullable' is set + if (requiredNotNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'requiredNullable' is set + if (requiredNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); @@ -3429,6 +3495,16 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); + if (notRequiredNotNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); + } + if (notRequiredNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); + } localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat"; localVarRequestOptions.OperationIndex = operationIndex; diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml index 6be7f291ccc..c2398ea9992 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml @@ -1036,6 +1036,38 @@ paths: type: string type: array style: form + - explode: true + in: query + name: requiredNotNullable + required: true + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: requiredNullable + required: true + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: notRequiredNotNullable + required: false + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: notRequiredNullable + required: false + schema: + nullable: true + type: string + style: form responses: "200": description: Success diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/FakeApi.md index ccc390872ec..575453fad06 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/FakeApi.md @@ -1301,7 +1301,7 @@ No authorization required # **TestQueryParameterCollectionFormat** -> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context) +> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = null, string? notRequiredNullable = null) @@ -1329,10 +1329,14 @@ namespace Example var http = new List(); // List | var url = new List(); // List | var context = new List(); // List | + var requiredNotNullable = "requiredNotNullable_example"; // string | + var requiredNullable = "requiredNullable_example"; // string | + var notRequiredNotNullable = "notRequiredNotNullable_example"; // string? | (optional) + var notRequiredNullable = "notRequiredNullable_example"; // string? | (optional) try { - apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1351,7 +1355,7 @@ This returns an ApiResponse object which contains the response data, status code ```csharp try { - apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1370,6 +1374,10 @@ catch (ApiException e) | **http** | [**List<string>**](string.md) | | | | **url** | [**List<string>**](string.md) | | | | **context** | [**List<string>**](string.md) | | | +| **requiredNotNullable** | **string** | | | +| **requiredNullable** | **string** | | | +| **notRequiredNotNullable** | **string?** | | [optional] | +| **notRequiredNullable** | **string?** | | [optional] | ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/FakeApi.cs index f0a96c2970a..0ebf9df8a61 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Api/FakeApi.cs @@ -398,9 +398,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// - void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0); + void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0); /// /// @@ -414,9 +418,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// ApiResponse of Object(void) - ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0); + ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0); #endregion Synchronous Operations } @@ -840,10 +848,14 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of void - System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// @@ -857,10 +869,14 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of ApiResponse - System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); #endregion Asynchronous Operations } @@ -3246,11 +3262,15 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// - public void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0) + public void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0) { - TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } /// @@ -3262,9 +3282,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0) + public Org.OpenAPITools.Client.ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0) { // verify the required parameter 'pipe' is set if (pipe == null) @@ -3296,6 +3320,18 @@ namespace Org.OpenAPITools.Api throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); } + // verify the required parameter 'requiredNotNullable' is set + if (requiredNotNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'requiredNullable' is set + if (requiredNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); string[] _contentTypes = new string[] { @@ -3322,6 +3358,16 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); + if (notRequiredNotNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); + } + if (notRequiredNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); + } localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat"; localVarRequestOptions.OperationIndex = operationIndex; @@ -3350,12 +3396,16 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of void - public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, operationIndex, cancellationToken).ConfigureAwait(false); + await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable, operationIndex, cancellationToken).ConfigureAwait(false); } /// @@ -3367,10 +3417,14 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // verify the required parameter 'pipe' is set if (pipe == null) @@ -3402,6 +3456,18 @@ namespace Org.OpenAPITools.Api throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); } + // verify the required parameter 'requiredNotNullable' is set + if (requiredNotNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'requiredNullable' is set + if (requiredNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); @@ -3429,6 +3495,16 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); + if (notRequiredNotNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); + } + if (notRequiredNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); + } localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat"; localVarRequestOptions.OperationIndex = operationIndex; diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml index 6be7f291ccc..c2398ea9992 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml @@ -1036,6 +1036,38 @@ paths: type: string type: array style: form + - explode: true + in: query + name: requiredNotNullable + required: true + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: requiredNullable + required: true + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: notRequiredNotNullable + required: false + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: notRequiredNullable + required: false + schema: + nullable: true + type: string + style: form responses: "200": description: Success diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/FakeApi.md index 7bdf5246aac..f2bf397505d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/FakeApi.md @@ -1301,7 +1301,7 @@ No authorization required # **TestQueryParameterCollectionFormat** -> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context) +> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = null, string notRequiredNullable = null) @@ -1329,10 +1329,14 @@ namespace Example var http = new List(); // List | var url = new List(); // List | var context = new List(); // List | + var requiredNotNullable = "requiredNotNullable_example"; // string | + var requiredNullable = "requiredNullable_example"; // string | + var notRequiredNotNullable = "notRequiredNotNullable_example"; // string | (optional) + var notRequiredNullable = "notRequiredNullable_example"; // string | (optional) try { - apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1351,7 +1355,7 @@ This returns an ApiResponse object which contains the response data, status code ```csharp try { - apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1370,6 +1374,10 @@ catch (ApiException e) | **http** | [**List<string>**](string.md) | | | | **url** | [**List<string>**](string.md) | | | | **context** | [**List<string>**](string.md) | | | +| **requiredNotNullable** | **string** | | | +| **requiredNullable** | **string** | | | +| **notRequiredNotNullable** | **string** | | [optional] | +| **notRequiredNullable** | **string** | | [optional] | ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Api/FakeApi.cs index 04d4fe78633..b679e625cde 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Api/FakeApi.cs @@ -369,8 +369,12 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// - void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context); + void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string)); /// /// @@ -384,8 +388,12 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// ApiResponse of Object(void) - ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context); + ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string)); #endregion Synchronous Operations } @@ -781,9 +789,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Cancellation Token to cancel the request. /// Task of void - System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// @@ -797,9 +809,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Cancellation Token to cancel the request. /// Task of ApiResponse - System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); #endregion Asynchronous Operations } @@ -2975,10 +2991,14 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// - public void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context) + public void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string)) { - TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } /// @@ -2990,8 +3010,12 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context) + public Org.OpenAPITools.Client.ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string)) { // verify the required parameter 'pipe' is set if (pipe == null) @@ -3013,6 +3037,14 @@ namespace Org.OpenAPITools.Api if (context == null) throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); + // verify the required parameter 'requiredNotNullable' is set + if (requiredNotNullable == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + + // verify the required parameter 'requiredNullable' is set + if (requiredNullable == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); string[] _contentTypes = new string[] { @@ -3033,6 +3065,16 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); + if (notRequiredNotNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); + } + if (notRequiredNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); + } // make the HTTP request @@ -3056,11 +3098,15 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Cancellation Token to cancel the request. /// Task of void - public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - var task = TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, cancellationToken); + var task = TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable, cancellationToken); #if UNITY_EDITOR || !UNITY_WEBGL await task.ConfigureAwait(false); #else @@ -3077,9 +3123,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Cancellation Token to cancel the request. /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // verify the required parameter 'pipe' is set if (pipe == null) @@ -3101,6 +3151,14 @@ namespace Org.OpenAPITools.Api if (context == null) throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); + // verify the required parameter 'requiredNotNullable' is set + if (requiredNotNullable == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + + // verify the required parameter 'requiredNullable' is set + if (requiredNullable == null) + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); @@ -3123,6 +3181,16 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); + if (notRequiredNotNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); + } + if (notRequiredNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); + } // make the HTTP request diff --git a/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml index 6be7f291ccc..c2398ea9992 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml @@ -1036,6 +1036,38 @@ paths: type: string type: array style: form + - explode: true + in: query + name: requiredNotNullable + required: true + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: requiredNullable + required: true + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: notRequiredNotNullable + required: false + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: notRequiredNullable + required: false + schema: + nullable: true + type: string + style: form responses: "200": description: Success diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient/docs/FakeApi.md index 7bdf5246aac..f2bf397505d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/FakeApi.md @@ -1301,7 +1301,7 @@ No authorization required # **TestQueryParameterCollectionFormat** -> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context) +> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = null, string notRequiredNullable = null) @@ -1329,10 +1329,14 @@ namespace Example var http = new List(); // List | var url = new List(); // List | var context = new List(); // List | + var requiredNotNullable = "requiredNotNullable_example"; // string | + var requiredNullable = "requiredNullable_example"; // string | + var notRequiredNotNullable = "notRequiredNotNullable_example"; // string | (optional) + var notRequiredNullable = "notRequiredNullable_example"; // string | (optional) try { - apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1351,7 +1355,7 @@ This returns an ApiResponse object which contains the response data, status code ```csharp try { - apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1370,6 +1374,10 @@ catch (ApiException e) | **http** | [**List<string>**](string.md) | | | | **url** | [**List<string>**](string.md) | | | | **context** | [**List<string>**](string.md) | | | +| **requiredNotNullable** | **string** | | | +| **requiredNullable** | **string** | | | +| **notRequiredNotNullable** | **string** | | [optional] | +| **notRequiredNullable** | **string** | | [optional] | ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs index db7210ad86f..aef969f7935 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/FakeApi.cs @@ -398,9 +398,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// - void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0); + void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0); /// /// @@ -414,9 +418,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// ApiResponse of Object(void) - ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0); + ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0); #endregion Synchronous Operations } @@ -840,10 +848,14 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of void - System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// @@ -857,10 +869,14 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of ApiResponse - System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); #endregion Asynchronous Operations } @@ -3246,11 +3262,15 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// - public void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0) + public void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0) { - TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } /// @@ -3262,9 +3282,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0) + public Org.OpenAPITools.Client.ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0) { // verify the required parameter 'pipe' is set if (pipe == null) @@ -3296,6 +3320,18 @@ namespace Org.OpenAPITools.Api throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); } + // verify the required parameter 'requiredNotNullable' is set + if (requiredNotNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'requiredNullable' is set + if (requiredNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); string[] _contentTypes = new string[] { @@ -3322,6 +3358,16 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); + if (notRequiredNotNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); + } + if (notRequiredNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); + } localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat"; localVarRequestOptions.OperationIndex = operationIndex; @@ -3350,12 +3396,16 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of void - public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, operationIndex, cancellationToken).ConfigureAwait(false); + await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable, operationIndex, cancellationToken).ConfigureAwait(false); } /// @@ -3367,10 +3417,14 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // verify the required parameter 'pipe' is set if (pipe == null) @@ -3402,6 +3456,18 @@ namespace Org.OpenAPITools.Api throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); } + // verify the required parameter 'requiredNotNullable' is set + if (requiredNotNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'requiredNullable' is set + if (requiredNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); @@ -3429,6 +3495,16 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); + if (notRequiredNotNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); + } + if (notRequiredNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); + } localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat"; localVarRequestOptions.OperationIndex = operationIndex; diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml index 6be7f291ccc..c2398ea9992 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml @@ -1036,6 +1036,38 @@ paths: type: string type: array style: form + - explode: true + in: query + name: requiredNotNullable + required: true + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: requiredNullable + required: true + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: notRequiredNotNullable + required: false + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: notRequiredNullable + required: false + schema: + nullable: true + type: string + style: form responses: "200": description: Success diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClientCore/docs/FakeApi.md index ccc390872ec..575453fad06 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientCore/docs/FakeApi.md @@ -1301,7 +1301,7 @@ No authorization required # **TestQueryParameterCollectionFormat** -> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context) +> void TestQueryParameterCollectionFormat (List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = null, string? notRequiredNullable = null) @@ -1329,10 +1329,14 @@ namespace Example var http = new List(); // List | var url = new List(); // List | var context = new List(); // List | + var requiredNotNullable = "requiredNotNullable_example"; // string | + var requiredNullable = "requiredNullable_example"; // string | + var notRequiredNotNullable = "notRequiredNotNullable_example"; // string? | (optional) + var notRequiredNullable = "notRequiredNullable_example"; // string? | (optional) try { - apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1351,7 +1355,7 @@ This returns an ApiResponse object which contains the response data, status code ```csharp try { - apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } catch (ApiException e) { @@ -1370,6 +1374,10 @@ catch (ApiException e) | **http** | [**List<string>**](string.md) | | | | **url** | [**List<string>**](string.md) | | | | **context** | [**List<string>**](string.md) | | | +| **requiredNotNullable** | **string** | | | +| **requiredNullable** | **string** | | | +| **notRequiredNotNullable** | **string?** | | [optional] | +| **notRequiredNullable** | **string?** | | [optional] | ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Api/FakeApi.cs index f0a96c2970a..0ebf9df8a61 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Api/FakeApi.cs @@ -398,9 +398,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// - void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0); + void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0); /// /// @@ -414,9 +418,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// ApiResponse of Object(void) - ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0); + ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0); #endregion Synchronous Operations } @@ -840,10 +848,14 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of void - System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// /// @@ -857,10 +869,14 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of ApiResponse - System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); #endregion Asynchronous Operations } @@ -3246,11 +3262,15 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// - public void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0) + public void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0) { - TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context); + TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); } /// @@ -3262,9 +3282,13 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0) + public Org.OpenAPITools.Client.ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0) { // verify the required parameter 'pipe' is set if (pipe == null) @@ -3296,6 +3320,18 @@ namespace Org.OpenAPITools.Api throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); } + // verify the required parameter 'requiredNotNullable' is set + if (requiredNotNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'requiredNullable' is set + if (requiredNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); string[] _contentTypes = new string[] { @@ -3322,6 +3358,16 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); + if (notRequiredNotNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); + } + if (notRequiredNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); + } localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat"; localVarRequestOptions.OperationIndex = operationIndex; @@ -3350,12 +3396,16 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of void - public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, operationIndex, cancellationToken).ConfigureAwait(false); + await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable, operationIndex, cancellationToken).ConfigureAwait(false); } /// @@ -3367,10 +3417,14 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// (optional) + /// (optional) /// Index associated with the operation. /// Cancellation Token to cancel the request. /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { // verify the required parameter 'pipe' is set if (pipe == null) @@ -3402,6 +3456,18 @@ namespace Org.OpenAPITools.Api throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); } + // verify the required parameter 'requiredNotNullable' is set + if (requiredNotNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'requiredNullable' is set + if (requiredNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); @@ -3429,6 +3495,16 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); + if (notRequiredNotNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); + } + if (notRequiredNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); + } localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat"; localVarRequestOptions.OperationIndex = operationIndex;