[csharp][generichost] Add Option struct to enable better validation (#15977)

* add Option struct to enable better validation

* use kebab case
This commit is contained in:
devhl-labs 2023-07-03 02:40:24 -04:00 committed by GitHub
parent e2f5997592
commit 00fcaa15c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
119 changed files with 2845 additions and 2262 deletions

View File

@ -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<CodegenParameter> 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);
}
}

View File

@ -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"));

View File

@ -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");
}
}

View File

@ -1 +1 @@
{{#notRequiredOrIsNullable}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}}{{/notRequiredOrIsNullable}}
{{#isNullable}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}}{{/isNullable}}

View File

@ -57,7 +57,9 @@ namespace {{packageName}}.Test.{{apiPackage}}
{{#hasOAuthMethods}}
string oauthTokenValue = context.Configuration["<token>"] ?? 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}}
});
}
}

View File

@ -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}}
}
}

View File

@ -1 +1 @@
{{#lambda.joinWithComma}}{{#allParams}}{{{dataType}}}{{>NullConditionalParameter}} {{paramName}}{{#notRequiredOrIsNullable}} = null{{/notRequiredOrIsNullable}} {{/allParams}}System.Threading.CancellationToken cancellationToken = default{{^netstandard20OrLater}}(System.Threading.CancellationToken){{/netstandard20OrLater}}{{/lambda.joinWithComma}}
{{#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}}

View File

@ -0,0 +1,35 @@
// <auto-generated>
{{>partial_header}}
{{#nrt}}
#nullable enable
{{/nrt}}
namespace {{packageName}}.{{clientPackage}}
{
/// <summary>
/// A wrapper for operation parameters which are not required
/// </summary>
public struct Option<TType>
{
/// <summary>
/// The value to send to the server
/// </summary>
public TType Value { get; }
/// <summary>
/// When true the value will be sent to the server
/// </summary>
internal bool IsSet { get; }
/// <summary>
/// A wrapper for operation parameters which are not required
/// </summary>
/// <param name="value"></param>
public Option(TType value)
{
IsSet = true;
Value = value;
}
}
}

View File

@ -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}}
/// <summary>
/// Validates the request parameters
/// </summary>
{{/-first}}
{{#vendorExtensions.x-not-nullable-reference-types}}
/// <param name="{{paramName}}"></param>
{{#-last}}
{{/vendorExtensions.x-not-nullable-reference-types}}
/// <returns></returns>
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}}
/// <summary>
/// Processes the server response
/// </summary>
@ -182,7 +170,7 @@ namespace {{packageName}}.{{apiPackage}}
{{#allParams}}
/// <param name="{{paramName}}"></param>
{{/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}}
/// <param name="{{paramName}}"></param>
{{/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}});
/// <summary>
/// Logs exceptions that occur while retrieving the server response
@ -208,7 +196,7 @@ namespace {{packageName}}.{{apiPackage}}
{{#allParams}}
/// <param name="{{paramName}}"></param>
{{/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}}
/// <param name="{{paramName}}"></param>
{{/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>
/// {{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<string{{nrt?}}, string{{nrt?}}>("{{baseName}}", ClientUtils.ParameterToString({{paramName}})));
if ({{paramName}}.IsSet)
formParameterLocalVars.Add(new KeyValuePair<string{{nrt?}}, string{{nrt?}}>("{{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}}

View File

@ -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}});

View File

@ -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}}

View File

@ -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

View File

@ -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

View File

@ -1301,7 +1301,7 @@ No authorization required
<a id="testqueryparametercollectionformat"></a>
# **TestQueryParameterCollectionFormat**
> void TestQueryParameterCollectionFormat (List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context)
> void TestQueryParameterCollectionFormat (List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = null, string notRequiredNullable = null)
@ -1329,10 +1329,14 @@ namespace Example
var http = new List<string>(); // List<string> |
var url = new List<string>(); // List<string> |
var context = new List<string>(); // List<string> |
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&lt;string&gt;**](string.md) | | |
| **url** | [**List&lt;string&gt;**](string.md) | | |
| **context** | [**List&lt;string&gt;**](string.md) | | |
| **requiredNotNullable** | **string** | | |
| **requiredNullable** | **string** | | |
| **notRequiredNotNullable** | **string** | | [optional] |
| **notRequiredNullable** | **string** | | [optional] |
### Return type

View File

@ -398,9 +398,13 @@ namespace Org.OpenAPITools.Api
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <param name="requiredNotNullable"></param>
/// <param name="requiredNullable"></param>
/// <param name="notRequiredNotNullable"> (optional)</param>
/// <param name="notRequiredNullable"> (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns></returns>
void TestQueryParameterCollectionFormat(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, int operationIndex = 0);
void TestQueryParameterCollectionFormat(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0);
/// <summary>
///
@ -414,9 +418,13 @@ namespace Org.OpenAPITools.Api
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <param name="requiredNotNullable"></param>
/// <param name="requiredNullable"></param>
/// <param name="notRequiredNotNullable"> (optional)</param>
/// <param name="notRequiredNullable"> (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> TestQueryParameterCollectionFormatWithHttpInfo(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, int operationIndex = 0);
ApiResponse<Object> TestQueryParameterCollectionFormatWithHttpInfo(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> 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
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <param name="requiredNotNullable"></param>
/// <param name="requiredNullable"></param>
/// <param name="notRequiredNotNullable"> (optional)</param>
/// <param name="notRequiredNullable"> (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of void</returns>
System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = default(string), string notRequiredNullable = default(string), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
/// <summary>
///
@ -857,10 +869,14 @@ namespace Org.OpenAPITools.Api
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <param name="requiredNotNullable"></param>
/// <param name="requiredNullable"></param>
/// <param name="notRequiredNotNullable"> (optional)</param>
/// <param name="notRequiredNullable"> (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> TestQueryParameterCollectionFormatWithHttpInfoAsync(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
System.Threading.Tasks.Task<ApiResponse<Object>> TestQueryParameterCollectionFormatWithHttpInfoAsync(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> 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
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <param name="requiredNotNullable"></param>
/// <param name="requiredNullable"></param>
/// <param name="notRequiredNotNullable"> (optional)</param>
/// <param name="notRequiredNullable"> (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns></returns>
public void TestQueryParameterCollectionFormat(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, int operationIndex = 0)
public void TestQueryParameterCollectionFormat(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> 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);
}
/// <summary>
@ -3262,9 +3282,13 @@ namespace Org.OpenAPITools.Api
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <param name="requiredNotNullable"></param>
/// <param name="requiredNullable"></param>
/// <param name="notRequiredNotNullable"> (optional)</param>
/// <param name="notRequiredNullable"> (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <returns>ApiResponse of Object(void)</returns>
public Org.OpenAPITools.Client.ApiResponse<Object> TestQueryParameterCollectionFormatWithHttpInfo(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, int operationIndex = 0)
public Org.OpenAPITools.Client.ApiResponse<Object> TestQueryParameterCollectionFormatWithHttpInfo(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> 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
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <param name="requiredNotNullable"></param>
/// <param name="requiredNullable"></param>
/// <param name="notRequiredNotNullable"> (optional)</param>
/// <param name="notRequiredNullable"> (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of void</returns>
public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> 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);
}
/// <summary>
@ -3367,10 +3417,14 @@ namespace Org.OpenAPITools.Api
/// <param name="http"></param>
/// <param name="url"></param>
/// <param name="context"></param>
/// <param name="requiredNotNullable"></param>
/// <param name="requiredNullable"></param>
/// <param name="notRequiredNotNullable"> (optional)</param>
/// <param name="notRequiredNullable"> (optional)</param>
/// <param name="operationIndex">Index associated with the operation.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse</returns>
public async System.Threading.Tasks.Task<Org.OpenAPITools.Client.ApiResponse<Object>> TestQueryParameterCollectionFormatWithHttpInfoAsync(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
public async System.Threading.Tasks.Task<Org.OpenAPITools.Client.ApiResponse<Object>> TestQueryParameterCollectionFormatWithHttpInfoAsync(List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> 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;

View File

@ -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

View File

@ -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

View File

@ -1301,7 +1301,7 @@ No authorization required
<a id="testqueryparametercollectionformat"></a>
# **TestQueryParameterCollectionFormat**
> void TestQueryParameterCollectionFormat (List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context)
> void TestQueryParameterCollectionFormat (List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = null, string notRequiredNullable = null)
@ -1329,10 +1329,14 @@ namespace Example
var http = new List<string>(); // List<string> |
var url = new List<string>(); // List<string> |
var context = new List<string>(); // List<string> |
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&lt;string&gt;**](string.md) | | |
| **url** | [**List&lt;string&gt;**](string.md) | | |
| **context** | [**List&lt;string&gt;**](string.md) | | |
| **requiredNotNullable** | **string** | | |
| **requiredNullable** | **string** | | |
| **notRequiredNotNullable** | **string** | | [optional] |
| **notRequiredNullable** | **string** | | [optional] |
### Return type

View File

@ -67,7 +67,7 @@ namespace Org.OpenAPITools.Test.Api
[Fact (Skip = "not implemented")]
public async Task FakeOuterBooleanSerializeAsyncTest()
{
bool body = default!;
Client.Option<bool> body = default!;
var response = await _instance.FakeOuterBooleanSerializeAsync(body);
var model = response.AsModel();
Assert.IsType<bool>(model);
@ -79,7 +79,7 @@ namespace Org.OpenAPITools.Test.Api
[Fact (Skip = "not implemented")]
public async Task FakeOuterCompositeSerializeAsyncTest()
{
OuterComposite outerComposite = default!;
Client.Option<OuterComposite> outerComposite = default!;
var response = await _instance.FakeOuterCompositeSerializeAsync(outerComposite);
var model = response.AsModel();
Assert.IsType<OuterComposite>(model);
@ -91,7 +91,7 @@ namespace Org.OpenAPITools.Test.Api
[Fact (Skip = "not implemented")]
public async Task FakeOuterNumberSerializeAsyncTest()
{
decimal body = default!;
Client.Option<decimal> body = default!;
var response = await _instance.FakeOuterNumberSerializeAsync(body);
var model = response.AsModel();
Assert.IsType<decimal>(model);
@ -104,7 +104,7 @@ namespace Org.OpenAPITools.Test.Api
public async Task FakeOuterStringSerializeAsyncTest()
{
Guid requiredStringUuid = default!;
string body = default!;
Client.Option<string> body = default!;
var response = await _instance.FakeOuterStringSerializeAsync(requiredStringUuid, body);
var model = response.AsModel();
Assert.IsType<string>(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<DateTime> date = default!;
Client.Option<System.IO.Stream> binary = default!;
Client.Option<float> varFloat = default!;
Client.Option<int> integer = default!;
Client.Option<int> int32 = default!;
Client.Option<long> int64 = default!;
Client.Option<string> varString = default!;
Client.Option<string> password = default!;
Client.Option<string> callback = default!;
Client.Option<DateTime> 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<string> enumHeaderStringArray = default!;
List<string> enumQueryStringArray = default!;
double enumQueryDouble = default!;
int enumQueryInteger = default!;
List<string> enumFormStringArray = default!;
string enumHeaderString = default!;
string enumQueryString = default!;
string enumFormString = default!;
Client.Option<List<string>> enumHeaderStringArray = default!;
Client.Option<List<string>> enumQueryStringArray = default!;
Client.Option<double> enumQueryDouble = default!;
Client.Option<int> enumQueryInteger = default!;
Client.Option<List<string>> enumFormStringArray = default!;
Client.Option<string> enumHeaderString = default!;
Client.Option<string> enumQueryString = default!;
Client.Option<string> 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<bool> booleanGroup = default!;
Client.Option<int> stringGroup = default!;
Client.Option<long> int64Group = default!;
await _instance.TestGroupParametersAsync(requiredBooleanGroup, requiredStringGroup, requiredInt64Group, booleanGroup, stringGroup, int64Group);
}
@ -241,7 +241,11 @@ namespace Org.OpenAPITools.Test.Api
List<string> http = default!;
List<string> url = default!;
List<string> context = default!;
await _instance.TestQueryParameterCollectionFormatAsync(pipe, ioutil, http, url, context);
string requiredNotNullable = default!;
string? requiredNullable = default!;
Client.Option<string> notRequiredNotNullable = default!;
Client.Option<string?> notRequiredNullable = default!;
await _instance.TestQueryParameterCollectionFormatAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable);
}
}
}

View File

@ -67,7 +67,7 @@ namespace Org.OpenAPITools.Test.Api
public async Task DeletePetAsyncTest()
{
long petId = default!;
string apiKey = default!;
Client.Option<string> 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<string> name = default!;
Client.Option<string> 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<System.IO.Stream> file = default!;
Client.Option<string> additionalMetadata = default!;
var response = await _instance.UploadFileAsync(petId, file, additionalMetadata);
var model = response.AsModel();
Assert.IsType<ApiResponse>(model);
@ -151,7 +151,7 @@ namespace Org.OpenAPITools.Test.Api
{
System.IO.Stream requiredFile = default!;
long petId = default!;
string additionalMetadata = default!;
Client.Option<string> additionalMetadata = default!;
var response = await _instance.UploadFileWithRequiredFileAsync(requiredFile, petId, additionalMetadata);
var model = response.AsModel();
Assert.IsType<ApiResponse>(model);

View File

@ -128,14 +128,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -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[] {

View File

@ -279,14 +279,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -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;

View File

@ -128,14 +128,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -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[] {

View File

@ -63,7 +63,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="apiKey"> (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&lt;object&gt;&gt;</returns>
Task<ApiResponse<object>> DeletePetAsync(long petId, string? apiKey = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<object>> DeletePetAsync(long petId, Option<string> apiKey = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Deletes a pet
@ -75,7 +75,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="apiKey"> (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&gt;object&gt;?&gt;</returns>
Task<ApiResponse<object>?> DeletePetOrDefaultAsync(long petId, string? apiKey = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<object>?> DeletePetOrDefaultAsync(long petId, Option<string> apiKey = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Finds Pets by status
@ -181,7 +181,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="status">Updated status of the pet (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&lt;object&gt;&gt;</returns>
Task<ApiResponse<object>> UpdatePetWithFormAsync(long petId, string? name = null, string? status = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<object>> UpdatePetWithFormAsync(long petId, Option<string> name = default, Option<string> status = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Updates a pet in the store with form data
@ -194,7 +194,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="status">Updated status of the pet (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&gt;object&gt;?&gt;</returns>
Task<ApiResponse<object>?> UpdatePetWithFormOrDefaultAsync(long petId, string? name = null, string? status = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<object>?> UpdatePetWithFormOrDefaultAsync(long petId, Option<string> name = default, Option<string> status = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// uploads an image
@ -208,7 +208,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&lt;ApiResponse&gt;&gt;</returns>
Task<ApiResponse<ApiResponse>> UploadFileAsync(long petId, System.IO.Stream? file = null, string? additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<ApiResponse>> UploadFileAsync(long petId, Option<System.IO.Stream> file = default, Option<string> additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// uploads an image
@ -221,7 +221,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&gt;ApiResponse&gt;?&gt;</returns>
Task<ApiResponse<ApiResponse>?> UploadFileOrDefaultAsync(long petId, System.IO.Stream? file = null, string? additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<ApiResponse>?> UploadFileOrDefaultAsync(long petId, Option<System.IO.Stream> file = default, Option<string> additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// uploads an image (required)
@ -235,7 +235,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&lt;ApiResponse&gt;&gt;</returns>
Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, string? additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, Option<string> additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// uploads an image (required)
@ -248,7 +248,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&gt;ApiResponse&gt;?&gt;</returns>
Task<ApiResponse<ApiResponse>?> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, string? additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<ApiResponse>?> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, Option<string> additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default);
}
}
@ -326,14 +326,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -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<string> apiKey);
/// <summary>
/// Validates the request parameters
/// </summary>
/// <param name="petId"></param>
/// <param name="apiKey"></param>
/// <returns></returns>
private void ValidateDeletePet(long petId, string? apiKey)
private void ValidateDeletePet(Option<string> 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'
}
/// <summary>
@ -513,7 +499,7 @@ namespace Org.OpenAPITools.Api
/// <param name="apiResponseLocalVar"></param>
/// <param name="petId"></param>
/// <param name="apiKey"></param>
private void AfterDeletePetDefaultImplementation(ApiResponse<object> apiResponseLocalVar, long petId, string? apiKey)
private void AfterDeletePetDefaultImplementation(ApiResponse<object> apiResponseLocalVar, long petId, Option<string> apiKey)
{
bool suppressDefaultLog = false;
AfterDeletePet(ref suppressDefaultLog, apiResponseLocalVar, petId, apiKey);
@ -528,7 +514,7 @@ namespace Org.OpenAPITools.Api
/// <param name="apiResponseLocalVar"></param>
/// <param name="petId"></param>
/// <param name="apiKey"></param>
partial void AfterDeletePet(ref bool suppressDefaultLog, ApiResponse<object> apiResponseLocalVar, long petId, string? apiKey);
partial void AfterDeletePet(ref bool suppressDefaultLog, ApiResponse<object> apiResponseLocalVar, long petId, Option<string> apiKey);
/// <summary>
/// Logs exceptions that occur while retrieving the server response
@ -538,7 +524,7 @@ namespace Org.OpenAPITools.Api
/// <param name="path"></param>
/// <param name="petId"></param>
/// <param name="apiKey"></param>
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<string> 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
/// <param name="path"></param>
/// <param name="petId"></param>
/// <param name="apiKey"></param>
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<string> apiKey);
/// <summary>
/// Deletes a pet
@ -561,7 +547,7 @@ namespace Org.OpenAPITools.Api
/// <param name="apiKey"> (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="object"/></returns>
public async Task<ApiResponse<object>?> DeletePetOrDefaultAsync(long petId, string? apiKey = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<object>?> DeletePetOrDefaultAsync(long petId, Option<string> apiKey = default, System.Threading.CancellationToken cancellationToken = default)
{
try
{
@ -581,13 +567,13 @@ namespace Org.OpenAPITools.Api
/// <param name="apiKey"> (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="object"/></returns>
public async Task<ApiResponse<object>> DeletePetAsync(long petId, string? apiKey = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<object>> DeletePetAsync(long petId, Option<string> 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<TokenBase> tokenBaseLocalVars = new List<TokenBase>();
@ -648,14 +634,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
private void ValidateFindPetsByStatus(List<string> 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'
}
/// <summary>
@ -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
/// <returns></returns>
private void ValidateFindPetsByTags(List<string> 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'
}
/// <summary>
@ -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);
/// <summary>
/// Validates the request parameters
/// </summary>
/// <param name="petId"></param>
/// <returns></returns>
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'
}
/// <summary>
/// Processes the server response
/// </summary>
@ -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
/// <returns></returns>
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'
}
/// <summary>
@ -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<string> name, ref Option<string> status);
/// <summary>
/// Validates the request parameters
/// </summary>
/// <param name="petId"></param>
/// <param name="name"></param>
/// <param name="status"></param>
/// <returns></returns>
private void ValidateUpdatePetWithForm(long petId, string? name, string? status)
private void ValidateUpdatePetWithForm(Option<string> name, Option<string> 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'
}
/// <summary>
@ -1330,7 +1275,7 @@ namespace Org.OpenAPITools.Api
/// <param name="petId"></param>
/// <param name="name"></param>
/// <param name="status"></param>
private void AfterUpdatePetWithFormDefaultImplementation(ApiResponse<object> apiResponseLocalVar, long petId, string? name, string? status)
private void AfterUpdatePetWithFormDefaultImplementation(ApiResponse<object> apiResponseLocalVar, long petId, Option<string> name, Option<string> status)
{
bool suppressDefaultLog = false;
AfterUpdatePetWithForm(ref suppressDefaultLog, apiResponseLocalVar, petId, name, status);
@ -1346,7 +1291,7 @@ namespace Org.OpenAPITools.Api
/// <param name="petId"></param>
/// <param name="name"></param>
/// <param name="status"></param>
partial void AfterUpdatePetWithForm(ref bool suppressDefaultLog, ApiResponse<object> apiResponseLocalVar, long petId, string? name, string? status);
partial void AfterUpdatePetWithForm(ref bool suppressDefaultLog, ApiResponse<object> apiResponseLocalVar, long petId, Option<string> name, Option<string> status);
/// <summary>
/// Logs exceptions that occur while retrieving the server response
@ -1357,7 +1302,7 @@ namespace Org.OpenAPITools.Api
/// <param name="petId"></param>
/// <param name="name"></param>
/// <param name="status"></param>
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<string> name, Option<string> 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
/// <param name="petId"></param>
/// <param name="name"></param>
/// <param name="status"></param>
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<string> name, Option<string> status);
/// <summary>
/// Updates a pet in the store with form data
@ -1382,7 +1327,7 @@ namespace Org.OpenAPITools.Api
/// <param name="status">Updated status of the pet (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="object"/></returns>
public async Task<ApiResponse<object>?> UpdatePetWithFormOrDefaultAsync(long petId, string? name = null, string? status = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<object>?> UpdatePetWithFormOrDefaultAsync(long petId, Option<string> name = default, Option<string> status = default, System.Threading.CancellationToken cancellationToken = default)
{
try
{
@ -1403,13 +1348,13 @@ namespace Org.OpenAPITools.Api
/// <param name="status">Updated status of the pet (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="object"/></returns>
public async Task<ApiResponse<object>> UpdatePetWithFormAsync(long petId, string? name = null, string? status = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<object>> UpdatePetWithFormAsync(long petId, Option<string> name = default, Option<string> 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<KeyValuePair<string?, string?>> formParameterLocalVars = new List<KeyValuePair<string?, string?>>();
multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (name != null)
formParameterLocalVars.Add(new KeyValuePair<string?, string?>("name", ClientUtils.ParameterToString(name)));
multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (name.IsSet)
formParameterLocalVars.Add(new KeyValuePair<string?, string?>("name", ClientUtils.ParameterToString(name.Value)));
if (status != null)
formParameterLocalVars.Add(new KeyValuePair<string?, string?>("status", ClientUtils.ParameterToString(status)));
if (status.IsSet)
formParameterLocalVars.Add(new KeyValuePair<string?, string?>("status", ClientUtils.ParameterToString(status.Value)));
List<TokenBase> tokenBaseLocalVars = new List<TokenBase>();
@ -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<System.IO.Stream> file, ref Option<string> additionalMetadata);
/// <summary>
/// Validates the request parameters
/// </summary>
/// <param name="petId"></param>
/// <param name="file"></param>
/// <param name="additionalMetadata"></param>
/// <param name="file"></param>
/// <returns></returns>
private void ValidateUploadFile(long petId, System.IO.Stream? file, string? additionalMetadata)
private void ValidateUploadFile(Option<string> additionalMetadata, Option<System.IO.Stream> 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));
}
/// <summary>
@ -1513,7 +1448,7 @@ namespace Org.OpenAPITools.Api
/// <param name="petId"></param>
/// <param name="file"></param>
/// <param name="additionalMetadata"></param>
private void AfterUploadFileDefaultImplementation(ApiResponse<ApiResponse> apiResponseLocalVar, long petId, System.IO.Stream? file, string? additionalMetadata)
private void AfterUploadFileDefaultImplementation(ApiResponse<ApiResponse> apiResponseLocalVar, long petId, Option<System.IO.Stream> file, Option<string> additionalMetadata)
{
bool suppressDefaultLog = false;
AfterUploadFile(ref suppressDefaultLog, apiResponseLocalVar, petId, file, additionalMetadata);
@ -1529,7 +1464,7 @@ namespace Org.OpenAPITools.Api
/// <param name="petId"></param>
/// <param name="file"></param>
/// <param name="additionalMetadata"></param>
partial void AfterUploadFile(ref bool suppressDefaultLog, ApiResponse<ApiResponse> apiResponseLocalVar, long petId, System.IO.Stream? file, string? additionalMetadata);
partial void AfterUploadFile(ref bool suppressDefaultLog, ApiResponse<ApiResponse> apiResponseLocalVar, long petId, Option<System.IO.Stream> file, Option<string> additionalMetadata);
/// <summary>
/// Logs exceptions that occur while retrieving the server response
@ -1540,7 +1475,7 @@ namespace Org.OpenAPITools.Api
/// <param name="petId"></param>
/// <param name="file"></param>
/// <param name="additionalMetadata"></param>
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<System.IO.Stream> file, Option<string> 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
/// <param name="petId"></param>
/// <param name="file"></param>
/// <param name="additionalMetadata"></param>
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<System.IO.Stream> file, Option<string> additionalMetadata);
/// <summary>
/// uploads an image
@ -1565,7 +1500,7 @@ namespace Org.OpenAPITools.Api
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="ApiResponse"/></returns>
public async Task<ApiResponse<ApiResponse>?> UploadFileOrDefaultAsync(long petId, System.IO.Stream? file = null, string? additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<ApiResponse>?> UploadFileOrDefaultAsync(long petId, Option<System.IO.Stream> file = default, Option<string> additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default)
{
try
{
@ -1586,13 +1521,13 @@ namespace Org.OpenAPITools.Api
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="ApiResponse"/></returns>
public async Task<ApiResponse<ApiResponse>> UploadFileAsync(long petId, System.IO.Stream? file = null, string? additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<ApiResponse>> UploadFileAsync(long petId, Option<System.IO.Stream> file = default, Option<string> 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<KeyValuePair<string?, string?>> formParameterLocalVars = new List<KeyValuePair<string?, string?>>();
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<string?, string?>("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata)));
if (additionalMetadata.IsSet)
formParameterLocalVars.Add(new KeyValuePair<string?, string?>("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata.Value)));
List<TokenBase> tokenBaseLocalVars = new List<TokenBase>();
@ -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<string> additionalMetadata);
/// <summary>
/// Validates the request parameters
/// </summary>
/// <param name="requiredFile"></param>
/// <param name="petId"></param>
/// <param name="additionalMetadata"></param>
/// <returns></returns>
private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, long petId, string? additionalMetadata)
private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, Option<string> 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'
}
/// <summary>
@ -1705,7 +1630,7 @@ namespace Org.OpenAPITools.Api
/// <param name="requiredFile"></param>
/// <param name="petId"></param>
/// <param name="additionalMetadata"></param>
private void AfterUploadFileWithRequiredFileDefaultImplementation(ApiResponse<ApiResponse> apiResponseLocalVar, System.IO.Stream requiredFile, long petId, string? additionalMetadata)
private void AfterUploadFileWithRequiredFileDefaultImplementation(ApiResponse<ApiResponse> apiResponseLocalVar, System.IO.Stream requiredFile, long petId, Option<string> additionalMetadata)
{
bool suppressDefaultLog = false;
AfterUploadFileWithRequiredFile(ref suppressDefaultLog, apiResponseLocalVar, requiredFile, petId, additionalMetadata);
@ -1721,7 +1646,7 @@ namespace Org.OpenAPITools.Api
/// <param name="requiredFile"></param>
/// <param name="petId"></param>
/// <param name="additionalMetadata"></param>
partial void AfterUploadFileWithRequiredFile(ref bool suppressDefaultLog, ApiResponse<ApiResponse> apiResponseLocalVar, System.IO.Stream requiredFile, long petId, string? additionalMetadata);
partial void AfterUploadFileWithRequiredFile(ref bool suppressDefaultLog, ApiResponse<ApiResponse> apiResponseLocalVar, System.IO.Stream requiredFile, long petId, Option<string> additionalMetadata);
/// <summary>
/// Logs exceptions that occur while retrieving the server response
@ -1732,7 +1657,7 @@ namespace Org.OpenAPITools.Api
/// <param name="requiredFile"></param>
/// <param name="petId"></param>
/// <param name="additionalMetadata"></param>
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<string> 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
/// <param name="requiredFile"></param>
/// <param name="petId"></param>
/// <param name="additionalMetadata"></param>
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<string> additionalMetadata);
/// <summary>
/// uploads an image (required)
@ -1757,7 +1682,7 @@ namespace Org.OpenAPITools.Api
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="ApiResponse"/></returns>
public async Task<ApiResponse<ApiResponse>?> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, string? additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<ApiResponse>?> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, Option<string> additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default)
{
try
{
@ -1778,13 +1703,13 @@ namespace Org.OpenAPITools.Api
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="ApiResponse"/></returns>
public async Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, string? additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, Option<string> 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<string?, string?>("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata)));
if (additionalMetadata.IsSet)
formParameterLocalVars.Add(new KeyValuePair<string?, string?>("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata.Value)));
List<TokenBase> tokenBaseLocalVars = new List<TokenBase>();
@ -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[] {

View File

@ -195,14 +195,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -439,23 +433,6 @@ namespace Org.OpenAPITools.Api
partial void FormatGetOrderById(ref long orderId);
/// <summary>
/// Validates the request parameters
/// </summary>
/// <param name="orderId"></param>
/// <returns></returns>
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'
}
/// <summary>
/// Processes the server response
/// </summary>
@ -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
/// <returns></returns>
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'
}
/// <summary>
@ -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[] {

View File

@ -291,14 +291,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -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
/// <returns></returns>
private void ValidateCreateUsersWithArrayInput(List<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'
}
/// <summary>
@ -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
/// <returns></returns>
private void ValidateCreateUsersWithListInput(List<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'
}
/// <summary>
@ -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
/// <returns></returns>
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'
}
/// <summary>
@ -847,14 +823,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -988,17 +958,11 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -1244,17 +1208,11 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -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;

View File

@ -0,0 +1,41 @@
// <auto-generated>
/*
* 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
{
/// <summary>
/// A wrapper for operation parameters which are not required
/// </summary>
public struct Option<TType>
{
/// <summary>
/// The value to send to the server
/// </summary>
public TType Value { get; }
/// <summary>
/// When true the value will be sent to the server
/// </summary>
internal bool IsSet { get; }
/// <summary>
/// A wrapper for operation parameters which are not required
/// </summary>
/// <param name="value"></param>
public Option(TType value)
{
IsSet = true;
Value = value;
}
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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

View File

@ -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

View File

@ -1301,7 +1301,7 @@ No authorization required
<a id="testqueryparametercollectionformat"></a>
# **TestQueryParameterCollectionFormat**
> void TestQueryParameterCollectionFormat (List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context)
> void TestQueryParameterCollectionFormat (List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = null, string notRequiredNullable = null)
@ -1329,10 +1329,14 @@ namespace Example
var http = new List<string>(); // List<string> |
var url = new List<string>(); // List<string> |
var context = new List<string>(); // List<string> |
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&lt;string&gt;**](string.md) | | |
| **url** | [**List&lt;string&gt;**](string.md) | | |
| **context** | [**List&lt;string&gt;**](string.md) | | |
| **requiredNotNullable** | **string** | | |
| **requiredNullable** | **string** | | |
| **notRequiredNotNullable** | **string** | | [optional] |
| **notRequiredNullable** | **string** | | [optional] |
### Return type

View File

@ -67,7 +67,7 @@ namespace Org.OpenAPITools.Test.Api
[Fact (Skip = "not implemented")]
public async Task FakeOuterBooleanSerializeAsyncTest()
{
bool body = default;
Client.Option<bool> body = default;
var response = await _instance.FakeOuterBooleanSerializeAsync(body);
var model = response.AsModel();
Assert.IsType<bool>(model);
@ -79,7 +79,7 @@ namespace Org.OpenAPITools.Test.Api
[Fact (Skip = "not implemented")]
public async Task FakeOuterCompositeSerializeAsyncTest()
{
OuterComposite outerComposite = default;
Client.Option<OuterComposite> outerComposite = default;
var response = await _instance.FakeOuterCompositeSerializeAsync(outerComposite);
var model = response.AsModel();
Assert.IsType<OuterComposite>(model);
@ -91,7 +91,7 @@ namespace Org.OpenAPITools.Test.Api
[Fact (Skip = "not implemented")]
public async Task FakeOuterNumberSerializeAsyncTest()
{
decimal body = default;
Client.Option<decimal> body = default;
var response = await _instance.FakeOuterNumberSerializeAsync(body);
var model = response.AsModel();
Assert.IsType<decimal>(model);
@ -104,7 +104,7 @@ namespace Org.OpenAPITools.Test.Api
public async Task FakeOuterStringSerializeAsyncTest()
{
Guid requiredStringUuid = default;
string body = default;
Client.Option<string> body = default;
var response = await _instance.FakeOuterStringSerializeAsync(requiredStringUuid, body);
var model = response.AsModel();
Assert.IsType<string>(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<DateTime> date = default;
Client.Option<System.IO.Stream> binary = default;
Client.Option<float> varFloat = default;
Client.Option<int> integer = default;
Client.Option<int> int32 = default;
Client.Option<long> int64 = default;
Client.Option<string> varString = default;
Client.Option<string> password = default;
Client.Option<string> callback = default;
Client.Option<DateTime> 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<string> enumHeaderStringArray = default;
List<string> enumQueryStringArray = default;
double enumQueryDouble = default;
int enumQueryInteger = default;
List<string> enumFormStringArray = default;
string enumHeaderString = default;
string enumQueryString = default;
string enumFormString = default;
Client.Option<List<string>> enumHeaderStringArray = default;
Client.Option<List<string>> enumQueryStringArray = default;
Client.Option<double> enumQueryDouble = default;
Client.Option<int> enumQueryInteger = default;
Client.Option<List<string>> enumFormStringArray = default;
Client.Option<string> enumHeaderString = default;
Client.Option<string> enumQueryString = default;
Client.Option<string> 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<bool> booleanGroup = default;
Client.Option<int> stringGroup = default;
Client.Option<long> int64Group = default;
await _instance.TestGroupParametersAsync(requiredBooleanGroup, requiredStringGroup, requiredInt64Group, booleanGroup, stringGroup, int64Group);
}
@ -241,7 +241,11 @@ namespace Org.OpenAPITools.Test.Api
List<string> http = default;
List<string> url = default;
List<string> context = default;
await _instance.TestQueryParameterCollectionFormatAsync(pipe, ioutil, http, url, context);
string requiredNotNullable = default;
string requiredNullable = default;
Client.Option<string> notRequiredNotNullable = default;
Client.Option<string> notRequiredNullable = default;
await _instance.TestQueryParameterCollectionFormatAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable);
}
}
}

View File

@ -67,7 +67,7 @@ namespace Org.OpenAPITools.Test.Api
public async Task DeletePetAsyncTest()
{
long petId = default;
string apiKey = default;
Client.Option<string> 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<string> name = default;
Client.Option<string> 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<System.IO.Stream> file = default;
Client.Option<string> additionalMetadata = default;
var response = await _instance.UploadFileAsync(petId, file, additionalMetadata);
var model = response.AsModel();
Assert.IsType<ApiResponse>(model);
@ -151,7 +151,7 @@ namespace Org.OpenAPITools.Test.Api
{
System.IO.Stream requiredFile = default;
long petId = default;
string additionalMetadata = default;
Client.Option<string> additionalMetadata = default;
var response = await _instance.UploadFileWithRequiredFileAsync(requiredFile, petId, additionalMetadata);
var model = response.AsModel();
Assert.IsType<ApiResponse>(model);

View File

@ -126,14 +126,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -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[] {

View File

@ -277,14 +277,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -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;

View File

@ -126,14 +126,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -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[] {

View File

@ -61,7 +61,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="apiKey"> (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&lt;object&gt;&gt;</returns>
Task<ApiResponse<object>> DeletePetAsync(long petId, string apiKey = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<object>> DeletePetAsync(long petId, Option<string> apiKey = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Deletes a pet
@ -73,7 +73,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="apiKey"> (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&gt;object&gt;&gt;</returns>
Task<ApiResponse<object>> DeletePetOrDefaultAsync(long petId, string apiKey = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<object>> DeletePetOrDefaultAsync(long petId, Option<string> apiKey = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Finds Pets by status
@ -179,7 +179,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="status">Updated status of the pet (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&lt;object&gt;&gt;</returns>
Task<ApiResponse<object>> UpdatePetWithFormAsync(long petId, string name = null, string status = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<object>> UpdatePetWithFormAsync(long petId, Option<string> name = default, Option<string> status = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Updates a pet in the store with form data
@ -192,7 +192,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="status">Updated status of the pet (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&gt;object&gt;&gt;</returns>
Task<ApiResponse<object>> UpdatePetWithFormOrDefaultAsync(long petId, string name = null, string status = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<object>> UpdatePetWithFormOrDefaultAsync(long petId, Option<string> name = default, Option<string> status = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// uploads an image
@ -206,7 +206,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&lt;ApiResponse&gt;&gt;</returns>
Task<ApiResponse<ApiResponse>> UploadFileAsync(long petId, System.IO.Stream file = null, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<ApiResponse>> UploadFileAsync(long petId, Option<System.IO.Stream> file = default, Option<string> additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// uploads an image
@ -219,7 +219,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&gt;ApiResponse&gt;&gt;</returns>
Task<ApiResponse<ApiResponse>> UploadFileOrDefaultAsync(long petId, System.IO.Stream file = null, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<ApiResponse>> UploadFileOrDefaultAsync(long petId, Option<System.IO.Stream> file = default, Option<string> additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// uploads an image (required)
@ -233,7 +233,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&lt;ApiResponse&gt;&gt;</returns>
Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, Option<string> additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// uploads an image (required)
@ -246,7 +246,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&gt;ApiResponse&gt;&gt;</returns>
Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, Option<string> additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default);
}
}
@ -324,14 +324,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -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<string> apiKey);
/// <summary>
/// Validates the request parameters
/// </summary>
/// <param name="petId"></param>
/// <param name="apiKey"></param>
/// <returns></returns>
private void ValidateDeletePet(long petId, string apiKey)
private void ValidateDeletePet(Option<string> 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'
}
/// <summary>
@ -511,7 +497,7 @@ namespace Org.OpenAPITools.Api
/// <param name="apiResponseLocalVar"></param>
/// <param name="petId"></param>
/// <param name="apiKey"></param>
private void AfterDeletePetDefaultImplementation(ApiResponse<object> apiResponseLocalVar, long petId, string apiKey)
private void AfterDeletePetDefaultImplementation(ApiResponse<object> apiResponseLocalVar, long petId, Option<string> apiKey)
{
bool suppressDefaultLog = false;
AfterDeletePet(ref suppressDefaultLog, apiResponseLocalVar, petId, apiKey);
@ -526,7 +512,7 @@ namespace Org.OpenAPITools.Api
/// <param name="apiResponseLocalVar"></param>
/// <param name="petId"></param>
/// <param name="apiKey"></param>
partial void AfterDeletePet(ref bool suppressDefaultLog, ApiResponse<object> apiResponseLocalVar, long petId, string apiKey);
partial void AfterDeletePet(ref bool suppressDefaultLog, ApiResponse<object> apiResponseLocalVar, long petId, Option<string> apiKey);
/// <summary>
/// Logs exceptions that occur while retrieving the server response
@ -536,7 +522,7 @@ namespace Org.OpenAPITools.Api
/// <param name="path"></param>
/// <param name="petId"></param>
/// <param name="apiKey"></param>
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<string> 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
/// <param name="path"></param>
/// <param name="petId"></param>
/// <param name="apiKey"></param>
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<string> apiKey);
/// <summary>
/// Deletes a pet
@ -559,7 +545,7 @@ namespace Org.OpenAPITools.Api
/// <param name="apiKey"> (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="object"/></returns>
public async Task<ApiResponse<object>> DeletePetOrDefaultAsync(long petId, string apiKey = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<object>> DeletePetOrDefaultAsync(long petId, Option<string> apiKey = default, System.Threading.CancellationToken cancellationToken = default)
{
try
{
@ -579,13 +565,13 @@ namespace Org.OpenAPITools.Api
/// <param name="apiKey"> (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="object"/></returns>
public async Task<ApiResponse<object>> DeletePetAsync(long petId, string apiKey = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<object>> DeletePetAsync(long petId, Option<string> 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<TokenBase> tokenBaseLocalVars = new List<TokenBase>();
@ -646,14 +632,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
private void ValidateFindPetsByStatus(List<string> 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'
}
/// <summary>
@ -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
/// <returns></returns>
private void ValidateFindPetsByTags(List<string> 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'
}
/// <summary>
@ -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);
/// <summary>
/// Validates the request parameters
/// </summary>
/// <param name="petId"></param>
/// <returns></returns>
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'
}
/// <summary>
/// Processes the server response
/// </summary>
@ -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
/// <returns></returns>
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'
}
/// <summary>
@ -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<string> name, ref Option<string> status);
/// <summary>
/// Validates the request parameters
/// </summary>
/// <param name="petId"></param>
/// <param name="name"></param>
/// <param name="status"></param>
/// <param name="name"></param>
/// <returns></returns>
private void ValidateUpdatePetWithForm(long petId, string name, string status)
private void ValidateUpdatePetWithForm(Option<string> status, Option<string> 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));
}
/// <summary>
@ -1328,7 +1273,7 @@ namespace Org.OpenAPITools.Api
/// <param name="petId"></param>
/// <param name="name"></param>
/// <param name="status"></param>
private void AfterUpdatePetWithFormDefaultImplementation(ApiResponse<object> apiResponseLocalVar, long petId, string name, string status)
private void AfterUpdatePetWithFormDefaultImplementation(ApiResponse<object> apiResponseLocalVar, long petId, Option<string> name, Option<string> status)
{
bool suppressDefaultLog = false;
AfterUpdatePetWithForm(ref suppressDefaultLog, apiResponseLocalVar, petId, name, status);
@ -1344,7 +1289,7 @@ namespace Org.OpenAPITools.Api
/// <param name="petId"></param>
/// <param name="name"></param>
/// <param name="status"></param>
partial void AfterUpdatePetWithForm(ref bool suppressDefaultLog, ApiResponse<object> apiResponseLocalVar, long petId, string name, string status);
partial void AfterUpdatePetWithForm(ref bool suppressDefaultLog, ApiResponse<object> apiResponseLocalVar, long petId, Option<string> name, Option<string> status);
/// <summary>
/// Logs exceptions that occur while retrieving the server response
@ -1355,7 +1300,7 @@ namespace Org.OpenAPITools.Api
/// <param name="petId"></param>
/// <param name="name"></param>
/// <param name="status"></param>
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<string> name, Option<string> 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
/// <param name="petId"></param>
/// <param name="name"></param>
/// <param name="status"></param>
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<string> name, Option<string> status);
/// <summary>
/// Updates a pet in the store with form data
@ -1380,7 +1325,7 @@ namespace Org.OpenAPITools.Api
/// <param name="status">Updated status of the pet (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="object"/></returns>
public async Task<ApiResponse<object>> UpdatePetWithFormOrDefaultAsync(long petId, string name = null, string status = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<object>> UpdatePetWithFormOrDefaultAsync(long petId, Option<string> name = default, Option<string> status = default, System.Threading.CancellationToken cancellationToken = default)
{
try
{
@ -1401,13 +1346,13 @@ namespace Org.OpenAPITools.Api
/// <param name="status">Updated status of the pet (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="object"/></returns>
public async Task<ApiResponse<object>> UpdatePetWithFormAsync(long petId, string name = null, string status = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<object>> UpdatePetWithFormAsync(long petId, Option<string> name = default, Option<string> 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<KeyValuePair<string, string>> formParameterLocalVars = new List<KeyValuePair<string, string>>();
multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (name != null)
formParameterLocalVars.Add(new KeyValuePair<string, string>("name", ClientUtils.ParameterToString(name)));
multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (name.IsSet)
formParameterLocalVars.Add(new KeyValuePair<string, string>("name", ClientUtils.ParameterToString(name.Value)));
if (status != null)
formParameterLocalVars.Add(new KeyValuePair<string, string>("status", ClientUtils.ParameterToString(status)));
if (status.IsSet)
formParameterLocalVars.Add(new KeyValuePair<string, string>("status", ClientUtils.ParameterToString(status.Value)));
List<TokenBase> tokenBaseLocalVars = new List<TokenBase>();
@ -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<System.IO.Stream> file, ref Option<string> additionalMetadata);
/// <summary>
/// Validates the request parameters
/// </summary>
/// <param name="petId"></param>
/// <param name="file"></param>
/// <param name="additionalMetadata"></param>
/// <returns></returns>
private void ValidateUploadFile(long petId, System.IO.Stream file, string additionalMetadata)
private void ValidateUploadFile(Option<System.IO.Stream> file, Option<string> 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'
}
/// <summary>
@ -1511,7 +1446,7 @@ namespace Org.OpenAPITools.Api
/// <param name="petId"></param>
/// <param name="file"></param>
/// <param name="additionalMetadata"></param>
private void AfterUploadFileDefaultImplementation(ApiResponse<ApiResponse> apiResponseLocalVar, long petId, System.IO.Stream file, string additionalMetadata)
private void AfterUploadFileDefaultImplementation(ApiResponse<ApiResponse> apiResponseLocalVar, long petId, Option<System.IO.Stream> file, Option<string> additionalMetadata)
{
bool suppressDefaultLog = false;
AfterUploadFile(ref suppressDefaultLog, apiResponseLocalVar, petId, file, additionalMetadata);
@ -1527,7 +1462,7 @@ namespace Org.OpenAPITools.Api
/// <param name="petId"></param>
/// <param name="file"></param>
/// <param name="additionalMetadata"></param>
partial void AfterUploadFile(ref bool suppressDefaultLog, ApiResponse<ApiResponse> apiResponseLocalVar, long petId, System.IO.Stream file, string additionalMetadata);
partial void AfterUploadFile(ref bool suppressDefaultLog, ApiResponse<ApiResponse> apiResponseLocalVar, long petId, Option<System.IO.Stream> file, Option<string> additionalMetadata);
/// <summary>
/// Logs exceptions that occur while retrieving the server response
@ -1538,7 +1473,7 @@ namespace Org.OpenAPITools.Api
/// <param name="petId"></param>
/// <param name="file"></param>
/// <param name="additionalMetadata"></param>
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<System.IO.Stream> file, Option<string> 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
/// <param name="petId"></param>
/// <param name="file"></param>
/// <param name="additionalMetadata"></param>
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<System.IO.Stream> file, Option<string> additionalMetadata);
/// <summary>
/// uploads an image
@ -1563,7 +1498,7 @@ namespace Org.OpenAPITools.Api
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="ApiResponse"/></returns>
public async Task<ApiResponse<ApiResponse>> UploadFileOrDefaultAsync(long petId, System.IO.Stream file = null, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<ApiResponse>> UploadFileOrDefaultAsync(long petId, Option<System.IO.Stream> file = default, Option<string> additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default)
{
try
{
@ -1584,13 +1519,13 @@ namespace Org.OpenAPITools.Api
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="ApiResponse"/></returns>
public async Task<ApiResponse<ApiResponse>> UploadFileAsync(long petId, System.IO.Stream file = null, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<ApiResponse>> UploadFileAsync(long petId, Option<System.IO.Stream> file = default, Option<string> 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<KeyValuePair<string, string>> formParameterLocalVars = new List<KeyValuePair<string, string>>();
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<string, string>("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata)));
if (additionalMetadata.IsSet)
formParameterLocalVars.Add(new KeyValuePair<string, string>("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata.Value)));
List<TokenBase> tokenBaseLocalVars = new List<TokenBase>();
@ -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<string> additionalMetadata);
/// <summary>
/// Validates the request parameters
/// </summary>
/// <param name="requiredFile"></param>
/// <param name="petId"></param>
/// <param name="additionalMetadata"></param>
/// <returns></returns>
private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, long petId, string additionalMetadata)
private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, Option<string> 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'
}
/// <summary>
@ -1703,7 +1628,7 @@ namespace Org.OpenAPITools.Api
/// <param name="requiredFile"></param>
/// <param name="petId"></param>
/// <param name="additionalMetadata"></param>
private void AfterUploadFileWithRequiredFileDefaultImplementation(ApiResponse<ApiResponse> apiResponseLocalVar, System.IO.Stream requiredFile, long petId, string additionalMetadata)
private void AfterUploadFileWithRequiredFileDefaultImplementation(ApiResponse<ApiResponse> apiResponseLocalVar, System.IO.Stream requiredFile, long petId, Option<string> additionalMetadata)
{
bool suppressDefaultLog = false;
AfterUploadFileWithRequiredFile(ref suppressDefaultLog, apiResponseLocalVar, requiredFile, petId, additionalMetadata);
@ -1719,7 +1644,7 @@ namespace Org.OpenAPITools.Api
/// <param name="requiredFile"></param>
/// <param name="petId"></param>
/// <param name="additionalMetadata"></param>
partial void AfterUploadFileWithRequiredFile(ref bool suppressDefaultLog, ApiResponse<ApiResponse> apiResponseLocalVar, System.IO.Stream requiredFile, long petId, string additionalMetadata);
partial void AfterUploadFileWithRequiredFile(ref bool suppressDefaultLog, ApiResponse<ApiResponse> apiResponseLocalVar, System.IO.Stream requiredFile, long petId, Option<string> additionalMetadata);
/// <summary>
/// Logs exceptions that occur while retrieving the server response
@ -1730,7 +1655,7 @@ namespace Org.OpenAPITools.Api
/// <param name="requiredFile"></param>
/// <param name="petId"></param>
/// <param name="additionalMetadata"></param>
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<string> 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
/// <param name="requiredFile"></param>
/// <param name="petId"></param>
/// <param name="additionalMetadata"></param>
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<string> additionalMetadata);
/// <summary>
/// uploads an image (required)
@ -1755,7 +1680,7 @@ namespace Org.OpenAPITools.Api
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="ApiResponse"/></returns>
public async Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, Option<string> additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default)
{
try
{
@ -1776,13 +1701,13 @@ namespace Org.OpenAPITools.Api
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="ApiResponse"/></returns>
public async Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, Option<string> 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<string, string>("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata)));
if (additionalMetadata.IsSet)
formParameterLocalVars.Add(new KeyValuePair<string, string>("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata.Value)));
List<TokenBase> tokenBaseLocalVars = new List<TokenBase>();
@ -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[] {

View File

@ -193,14 +193,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -437,23 +431,6 @@ namespace Org.OpenAPITools.Api
partial void FormatGetOrderById(ref long orderId);
/// <summary>
/// Validates the request parameters
/// </summary>
/// <param name="orderId"></param>
/// <returns></returns>
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'
}
/// <summary>
/// Processes the server response
/// </summary>
@ -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
/// <returns></returns>
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'
}
/// <summary>
@ -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[] {

View File

@ -289,14 +289,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -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
/// <returns></returns>
private void ValidateCreateUsersWithArrayInput(List<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'
}
/// <summary>
@ -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
/// <returns></returns>
private void ValidateCreateUsersWithListInput(List<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'
}
/// <summary>
@ -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
/// <returns></returns>
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'
}
/// <summary>
@ -845,14 +821,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -986,17 +956,11 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -1237,22 +1201,16 @@ namespace Org.OpenAPITools.Api
/// <summary>
/// Validates the request parameters
/// </summary>
/// <param name="user"></param>
/// <param name="username"></param>
/// <param name="user"></param>
/// <returns></returns>
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));
}
/// <summary>
@ -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;

View File

@ -0,0 +1,39 @@
// <auto-generated>
/*
* 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
{
/// <summary>
/// A wrapper for operation parameters which are not required
/// </summary>
public struct Option<TType>
{
/// <summary>
/// The value to send to the server
/// </summary>
public TType Value { get; }
/// <summary>
/// When true the value will be sent to the server
/// </summary>
internal bool IsSet { get; }
/// <summary>
/// A wrapper for operation parameters which are not required
/// </summary>
/// <param name="value"></param>
public Option(TType value)
{
IsSet = true;
Value = value;
}
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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

View File

@ -93,14 +93,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>

View File

@ -0,0 +1,41 @@
// <auto-generated>
/*
* 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
{
/// <summary>
/// A wrapper for operation parameters which are not required
/// </summary>
public struct Option<TType>
{
/// <summary>
/// The value to send to the server
/// </summary>
public TType Value { get; }
/// <summary>
/// When true the value will be sent to the server
/// </summary>
internal bool IsSet { get; }
/// <summary>
/// A wrapper for operation parameters which are not required
/// </summary>
/// <param name="value"></param>
public Option(TType value)
{
IsSet = true;
Value = value;
}
}
}

View File

@ -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);
}

View File

@ -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

View File

@ -0,0 +1,41 @@
// <auto-generated>
/*
* 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
{
/// <summary>
/// A wrapper for operation parameters which are not required
/// </summary>
public struct Option<TType>
{
/// <summary>
/// The value to send to the server
/// </summary>
public TType Value { get; }
/// <summary>
/// When true the value will be sent to the server
/// </summary>
internal bool IsSet { get; }
/// <summary>
/// A wrapper for operation parameters which are not required
/// </summary>
/// <param name="value"></param>
public Option(TType value)
{
IsSet = true;
Value = value;
}
}
}

View File

@ -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

View File

@ -0,0 +1,41 @@
// <auto-generated>
/*
* 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
{
/// <summary>
/// A wrapper for operation parameters which are not required
/// </summary>
public struct Option<TType>
{
/// <summary>
/// The value to send to the server
/// </summary>
public TType Value { get; }
/// <summary>
/// When true the value will be sent to the server
/// </summary>
internal bool IsSet { get; }
/// <summary>
/// A wrapper for operation parameters which are not required
/// </summary>
/// <param name="value"></param>
public Option(TType value)
{
IsSet = true;
Value = value;
}
}
}

View File

@ -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

View File

@ -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

View File

@ -1301,7 +1301,7 @@ No authorization required
<a id="testqueryparametercollectionformat"></a>
# **TestQueryParameterCollectionFormat**
> void TestQueryParameterCollectionFormat (List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context)
> void TestQueryParameterCollectionFormat (List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = null, string notRequiredNullable = null)
@ -1329,10 +1329,14 @@ namespace Example
var http = new List<string>(); // List<string> |
var url = new List<string>(); // List<string> |
var context = new List<string>(); // List<string> |
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&lt;string&gt;**](string.md) | | |
| **url** | [**List&lt;string&gt;**](string.md) | | |
| **context** | [**List&lt;string&gt;**](string.md) | | |
| **requiredNotNullable** | **string** | | |
| **requiredNullable** | **string** | | |
| **notRequiredNotNullable** | **string** | | [optional] |
| **notRequiredNullable** | **string** | | [optional] |
### Return type

View File

@ -67,7 +67,7 @@ namespace Org.OpenAPITools.Test.Api
[Fact (Skip = "not implemented")]
public async Task FakeOuterBooleanSerializeAsyncTest()
{
bool body = default;
Client.Option<bool> body = default;
var response = await _instance.FakeOuterBooleanSerializeAsync(body);
var model = response.AsModel();
Assert.IsType<bool>(model);
@ -79,7 +79,7 @@ namespace Org.OpenAPITools.Test.Api
[Fact (Skip = "not implemented")]
public async Task FakeOuterCompositeSerializeAsyncTest()
{
OuterComposite outerComposite = default;
Client.Option<OuterComposite> outerComposite = default;
var response = await _instance.FakeOuterCompositeSerializeAsync(outerComposite);
var model = response.AsModel();
Assert.IsType<OuterComposite>(model);
@ -91,7 +91,7 @@ namespace Org.OpenAPITools.Test.Api
[Fact (Skip = "not implemented")]
public async Task FakeOuterNumberSerializeAsyncTest()
{
decimal body = default;
Client.Option<decimal> body = default;
var response = await _instance.FakeOuterNumberSerializeAsync(body);
var model = response.AsModel();
Assert.IsType<decimal>(model);
@ -104,7 +104,7 @@ namespace Org.OpenAPITools.Test.Api
public async Task FakeOuterStringSerializeAsyncTest()
{
Guid requiredStringUuid = default;
string body = default;
Client.Option<string> body = default;
var response = await _instance.FakeOuterStringSerializeAsync(requiredStringUuid, body);
var model = response.AsModel();
Assert.IsType<string>(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<DateTime> date = default;
Client.Option<System.IO.Stream> binary = default;
Client.Option<float> varFloat = default;
Client.Option<int> integer = default;
Client.Option<int> int32 = default;
Client.Option<long> int64 = default;
Client.Option<string> varString = default;
Client.Option<string> password = default;
Client.Option<string> callback = default;
Client.Option<DateTime> 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<string> enumHeaderStringArray = default;
List<string> enumQueryStringArray = default;
double enumQueryDouble = default;
int enumQueryInteger = default;
List<string> enumFormStringArray = default;
string enumHeaderString = default;
string enumQueryString = default;
string enumFormString = default;
Client.Option<List<string>> enumHeaderStringArray = default;
Client.Option<List<string>> enumQueryStringArray = default;
Client.Option<double> enumQueryDouble = default;
Client.Option<int> enumQueryInteger = default;
Client.Option<List<string>> enumFormStringArray = default;
Client.Option<string> enumHeaderString = default;
Client.Option<string> enumQueryString = default;
Client.Option<string> 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<bool> booleanGroup = default;
Client.Option<int> stringGroup = default;
Client.Option<long> int64Group = default;
await _instance.TestGroupParametersAsync(requiredBooleanGroup, requiredStringGroup, requiredInt64Group, booleanGroup, stringGroup, int64Group);
}
@ -241,7 +241,11 @@ namespace Org.OpenAPITools.Test.Api
List<string> http = default;
List<string> url = default;
List<string> context = default;
await _instance.TestQueryParameterCollectionFormatAsync(pipe, ioutil, http, url, context);
string requiredNotNullable = default;
string requiredNullable = default;
Client.Option<string> notRequiredNotNullable = default;
Client.Option<string> notRequiredNullable = default;
await _instance.TestQueryParameterCollectionFormatAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable);
}
}
}

View File

@ -67,7 +67,7 @@ namespace Org.OpenAPITools.Test.Api
public async Task DeletePetAsyncTest()
{
long petId = default;
string apiKey = default;
Client.Option<string> 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<string> name = default;
Client.Option<string> 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<System.IO.Stream> file = default;
Client.Option<string> additionalMetadata = default;
var response = await _instance.UploadFileAsync(petId, file, additionalMetadata);
var model = response.AsModel();
Assert.IsType<ApiResponse>(model);
@ -151,7 +151,7 @@ namespace Org.OpenAPITools.Test.Api
{
System.IO.Stream requiredFile = default;
long petId = default;
string additionalMetadata = default;
Client.Option<string> additionalMetadata = default;
var response = await _instance.UploadFileWithRequiredFileAsync(requiredFile, petId, additionalMetadata);
var model = response.AsModel();
Assert.IsType<ApiResponse>(model);

View File

@ -126,14 +126,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -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[] {

View File

@ -276,14 +276,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -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");

View File

@ -126,14 +126,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -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[] {

View File

@ -61,7 +61,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="apiKey"> (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&lt;object&gt;&gt;</returns>
Task<ApiResponse<object>> DeletePetAsync(long petId, string apiKey = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<object>> DeletePetAsync(long petId, Option<string> apiKey = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Deletes a pet
@ -73,7 +73,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="apiKey"> (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&gt;object&gt;&gt;</returns>
Task<ApiResponse<object>> DeletePetOrDefaultAsync(long petId, string apiKey = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<object>> DeletePetOrDefaultAsync(long petId, Option<string> apiKey = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Finds Pets by status
@ -179,7 +179,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="status">Updated status of the pet (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&lt;object&gt;&gt;</returns>
Task<ApiResponse<object>> UpdatePetWithFormAsync(long petId, string name = null, string status = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<object>> UpdatePetWithFormAsync(long petId, Option<string> name = default, Option<string> status = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// Updates a pet in the store with form data
@ -192,7 +192,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="status">Updated status of the pet (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&gt;object&gt;&gt;</returns>
Task<ApiResponse<object>> UpdatePetWithFormOrDefaultAsync(long petId, string name = null, string status = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<object>> UpdatePetWithFormOrDefaultAsync(long petId, Option<string> name = default, Option<string> status = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// uploads an image
@ -206,7 +206,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&lt;ApiResponse&gt;&gt;</returns>
Task<ApiResponse<ApiResponse>> UploadFileAsync(long petId, System.IO.Stream file = null, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<ApiResponse>> UploadFileAsync(long petId, Option<System.IO.Stream> file = default, Option<string> additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// uploads an image
@ -219,7 +219,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&gt;ApiResponse&gt;&gt;</returns>
Task<ApiResponse<ApiResponse>> UploadFileOrDefaultAsync(long petId, System.IO.Stream file = null, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<ApiResponse>> UploadFileOrDefaultAsync(long petId, Option<System.IO.Stream> file = default, Option<string> additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// uploads an image (required)
@ -233,7 +233,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&lt;ApiResponse&gt;&gt;</returns>
Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, Option<string> additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default);
/// <summary>
/// uploads an image (required)
@ -246,7 +246,7 @@ namespace Org.OpenAPITools.IApi
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task&lt;ApiResponse&gt;ApiResponse&gt;&gt;</returns>
Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default);
Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, Option<string> additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default);
}
}
@ -324,14 +324,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -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<string> apiKey);
/// <summary>
/// Validates the request parameters
/// </summary>
/// <param name="petId"></param>
/// <param name="apiKey"></param>
/// <returns></returns>
private void ValidateDeletePet(long petId, string apiKey)
private void ValidateDeletePet(Option<string> 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'
}
/// <summary>
@ -511,7 +497,7 @@ namespace Org.OpenAPITools.Api
/// <param name="apiResponseLocalVar"></param>
/// <param name="petId"></param>
/// <param name="apiKey"></param>
private void AfterDeletePetDefaultImplementation(ApiResponse<object> apiResponseLocalVar, long petId, string apiKey)
private void AfterDeletePetDefaultImplementation(ApiResponse<object> apiResponseLocalVar, long petId, Option<string> apiKey)
{
bool suppressDefaultLog = false;
AfterDeletePet(ref suppressDefaultLog, apiResponseLocalVar, petId, apiKey);
@ -526,7 +512,7 @@ namespace Org.OpenAPITools.Api
/// <param name="apiResponseLocalVar"></param>
/// <param name="petId"></param>
/// <param name="apiKey"></param>
partial void AfterDeletePet(ref bool suppressDefaultLog, ApiResponse<object> apiResponseLocalVar, long petId, string apiKey);
partial void AfterDeletePet(ref bool suppressDefaultLog, ApiResponse<object> apiResponseLocalVar, long petId, Option<string> apiKey);
/// <summary>
/// Logs exceptions that occur while retrieving the server response
@ -536,7 +522,7 @@ namespace Org.OpenAPITools.Api
/// <param name="path"></param>
/// <param name="petId"></param>
/// <param name="apiKey"></param>
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<string> 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
/// <param name="path"></param>
/// <param name="petId"></param>
/// <param name="apiKey"></param>
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<string> apiKey);
/// <summary>
/// Deletes a pet
@ -559,7 +545,7 @@ namespace Org.OpenAPITools.Api
/// <param name="apiKey"> (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="object"/></returns>
public async Task<ApiResponse<object>> DeletePetOrDefaultAsync(long petId, string apiKey = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<object>> DeletePetOrDefaultAsync(long petId, Option<string> apiKey = default, System.Threading.CancellationToken cancellationToken = default)
{
try
{
@ -579,13 +565,13 @@ namespace Org.OpenAPITools.Api
/// <param name="apiKey"> (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="object"/></returns>
public async Task<ApiResponse<object>> DeletePetAsync(long petId, string apiKey = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<object>> DeletePetAsync(long petId, Option<string> 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<TokenBase> tokenBaseLocalVars = new List<TokenBase>();
@ -645,14 +631,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
private void ValidateFindPetsByStatus(List<string> 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'
}
/// <summary>
@ -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
/// <returns></returns>
private void ValidateFindPetsByTags(List<string> 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'
}
/// <summary>
@ -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);
/// <summary>
/// Validates the request parameters
/// </summary>
/// <param name="petId"></param>
/// <returns></returns>
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'
}
/// <summary>
/// Processes the server response
/// </summary>
@ -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
/// <returns></returns>
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'
}
/// <summary>
@ -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<string> name, ref Option<string> status);
/// <summary>
/// Validates the request parameters
/// </summary>
/// <param name="petId"></param>
/// <param name="name"></param>
/// <param name="status"></param>
/// <param name="name"></param>
/// <returns></returns>
private void ValidateUpdatePetWithForm(long petId, string name, string status)
private void ValidateUpdatePetWithForm(Option<string> status, Option<string> 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));
}
/// <summary>
@ -1324,7 +1269,7 @@ namespace Org.OpenAPITools.Api
/// <param name="petId"></param>
/// <param name="name"></param>
/// <param name="status"></param>
private void AfterUpdatePetWithFormDefaultImplementation(ApiResponse<object> apiResponseLocalVar, long petId, string name, string status)
private void AfterUpdatePetWithFormDefaultImplementation(ApiResponse<object> apiResponseLocalVar, long petId, Option<string> name, Option<string> status)
{
bool suppressDefaultLog = false;
AfterUpdatePetWithForm(ref suppressDefaultLog, apiResponseLocalVar, petId, name, status);
@ -1340,7 +1285,7 @@ namespace Org.OpenAPITools.Api
/// <param name="petId"></param>
/// <param name="name"></param>
/// <param name="status"></param>
partial void AfterUpdatePetWithForm(ref bool suppressDefaultLog, ApiResponse<object> apiResponseLocalVar, long petId, string name, string status);
partial void AfterUpdatePetWithForm(ref bool suppressDefaultLog, ApiResponse<object> apiResponseLocalVar, long petId, Option<string> name, Option<string> status);
/// <summary>
/// Logs exceptions that occur while retrieving the server response
@ -1351,7 +1296,7 @@ namespace Org.OpenAPITools.Api
/// <param name="petId"></param>
/// <param name="name"></param>
/// <param name="status"></param>
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<string> name, Option<string> 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
/// <param name="petId"></param>
/// <param name="name"></param>
/// <param name="status"></param>
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<string> name, Option<string> status);
/// <summary>
/// Updates a pet in the store with form data
@ -1376,7 +1321,7 @@ namespace Org.OpenAPITools.Api
/// <param name="status">Updated status of the pet (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="object"/></returns>
public async Task<ApiResponse<object>> UpdatePetWithFormOrDefaultAsync(long petId, string name = null, string status = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<object>> UpdatePetWithFormOrDefaultAsync(long petId, Option<string> name = default, Option<string> status = default, System.Threading.CancellationToken cancellationToken = default)
{
try
{
@ -1397,13 +1342,13 @@ namespace Org.OpenAPITools.Api
/// <param name="status">Updated status of the pet (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="object"/></returns>
public async Task<ApiResponse<object>> UpdatePetWithFormAsync(long petId, string name = null, string status = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<object>> UpdatePetWithFormAsync(long petId, Option<string> name = default, Option<string> 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<KeyValuePair<string, string>> formParameterLocalVars = new List<KeyValuePair<string, string>>();
multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (name != null)
formParameterLocalVars.Add(new KeyValuePair<string, string>("name", ClientUtils.ParameterToString(name)));
multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (name.IsSet)
formParameterLocalVars.Add(new KeyValuePair<string, string>("name", ClientUtils.ParameterToString(name.Value)));
if (status != null)
formParameterLocalVars.Add(new KeyValuePair<string, string>("status", ClientUtils.ParameterToString(status)));
if (status.IsSet)
formParameterLocalVars.Add(new KeyValuePair<string, string>("status", ClientUtils.ParameterToString(status.Value)));
List<TokenBase> tokenBaseLocalVars = new List<TokenBase>();
@ -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<System.IO.Stream> file, ref Option<string> additionalMetadata);
/// <summary>
/// Validates the request parameters
/// </summary>
/// <param name="petId"></param>
/// <param name="file"></param>
/// <param name="additionalMetadata"></param>
/// <returns></returns>
private void ValidateUploadFile(long petId, System.IO.Stream file, string additionalMetadata)
private void ValidateUploadFile(Option<System.IO.Stream> file, Option<string> 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'
}
/// <summary>
@ -1507,7 +1442,7 @@ namespace Org.OpenAPITools.Api
/// <param name="petId"></param>
/// <param name="file"></param>
/// <param name="additionalMetadata"></param>
private void AfterUploadFileDefaultImplementation(ApiResponse<ApiResponse> apiResponseLocalVar, long petId, System.IO.Stream file, string additionalMetadata)
private void AfterUploadFileDefaultImplementation(ApiResponse<ApiResponse> apiResponseLocalVar, long petId, Option<System.IO.Stream> file, Option<string> additionalMetadata)
{
bool suppressDefaultLog = false;
AfterUploadFile(ref suppressDefaultLog, apiResponseLocalVar, petId, file, additionalMetadata);
@ -1523,7 +1458,7 @@ namespace Org.OpenAPITools.Api
/// <param name="petId"></param>
/// <param name="file"></param>
/// <param name="additionalMetadata"></param>
partial void AfterUploadFile(ref bool suppressDefaultLog, ApiResponse<ApiResponse> apiResponseLocalVar, long petId, System.IO.Stream file, string additionalMetadata);
partial void AfterUploadFile(ref bool suppressDefaultLog, ApiResponse<ApiResponse> apiResponseLocalVar, long petId, Option<System.IO.Stream> file, Option<string> additionalMetadata);
/// <summary>
/// Logs exceptions that occur while retrieving the server response
@ -1534,7 +1469,7 @@ namespace Org.OpenAPITools.Api
/// <param name="petId"></param>
/// <param name="file"></param>
/// <param name="additionalMetadata"></param>
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<System.IO.Stream> file, Option<string> 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
/// <param name="petId"></param>
/// <param name="file"></param>
/// <param name="additionalMetadata"></param>
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<System.IO.Stream> file, Option<string> additionalMetadata);
/// <summary>
/// uploads an image
@ -1559,7 +1494,7 @@ namespace Org.OpenAPITools.Api
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="ApiResponse"/></returns>
public async Task<ApiResponse<ApiResponse>> UploadFileOrDefaultAsync(long petId, System.IO.Stream file = null, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<ApiResponse>> UploadFileOrDefaultAsync(long petId, Option<System.IO.Stream> file = default, Option<string> additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default)
{
try
{
@ -1580,13 +1515,13 @@ namespace Org.OpenAPITools.Api
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="ApiResponse"/></returns>
public async Task<ApiResponse<ApiResponse>> UploadFileAsync(long petId, System.IO.Stream file = null, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<ApiResponse>> UploadFileAsync(long petId, Option<System.IO.Stream> file = default, Option<string> 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<KeyValuePair<string, string>> formParameterLocalVars = new List<KeyValuePair<string, string>>();
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<string, string>("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata)));
if (additionalMetadata.IsSet)
formParameterLocalVars.Add(new KeyValuePair<string, string>("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata.Value)));
List<TokenBase> tokenBaseLocalVars = new List<TokenBase>();
@ -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<string> additionalMetadata);
/// <summary>
/// Validates the request parameters
/// </summary>
/// <param name="requiredFile"></param>
/// <param name="petId"></param>
/// <param name="additionalMetadata"></param>
/// <returns></returns>
private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, long petId, string additionalMetadata)
private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, Option<string> 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'
}
/// <summary>
@ -1698,7 +1623,7 @@ namespace Org.OpenAPITools.Api
/// <param name="requiredFile"></param>
/// <param name="petId"></param>
/// <param name="additionalMetadata"></param>
private void AfterUploadFileWithRequiredFileDefaultImplementation(ApiResponse<ApiResponse> apiResponseLocalVar, System.IO.Stream requiredFile, long petId, string additionalMetadata)
private void AfterUploadFileWithRequiredFileDefaultImplementation(ApiResponse<ApiResponse> apiResponseLocalVar, System.IO.Stream requiredFile, long petId, Option<string> additionalMetadata)
{
bool suppressDefaultLog = false;
AfterUploadFileWithRequiredFile(ref suppressDefaultLog, apiResponseLocalVar, requiredFile, petId, additionalMetadata);
@ -1714,7 +1639,7 @@ namespace Org.OpenAPITools.Api
/// <param name="requiredFile"></param>
/// <param name="petId"></param>
/// <param name="additionalMetadata"></param>
partial void AfterUploadFileWithRequiredFile(ref bool suppressDefaultLog, ApiResponse<ApiResponse> apiResponseLocalVar, System.IO.Stream requiredFile, long petId, string additionalMetadata);
partial void AfterUploadFileWithRequiredFile(ref bool suppressDefaultLog, ApiResponse<ApiResponse> apiResponseLocalVar, System.IO.Stream requiredFile, long petId, Option<string> additionalMetadata);
/// <summary>
/// Logs exceptions that occur while retrieving the server response
@ -1725,7 +1650,7 @@ namespace Org.OpenAPITools.Api
/// <param name="requiredFile"></param>
/// <param name="petId"></param>
/// <param name="additionalMetadata"></param>
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<string> 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
/// <param name="requiredFile"></param>
/// <param name="petId"></param>
/// <param name="additionalMetadata"></param>
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<string> additionalMetadata);
/// <summary>
/// uploads an image (required)
@ -1750,7 +1675,7 @@ namespace Org.OpenAPITools.Api
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="ApiResponse"/></returns>
public async Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileOrDefaultAsync(System.IO.Stream requiredFile, long petId, Option<string> additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default)
{
try
{
@ -1771,13 +1696,13 @@ namespace Org.OpenAPITools.Api
/// <param name="additionalMetadata">Additional data to pass to server (optional)</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns><see cref="Task"/>&lt;<see cref="ApiResponse{T}"/>&gt; where T : <see cref="ApiResponse"/></returns>
public async Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, string additionalMetadata = null, System.Threading.CancellationToken cancellationToken = default)
public async Task<ApiResponse<ApiResponse>> UploadFileWithRequiredFileAsync(System.IO.Stream requiredFile, long petId, Option<string> 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<string, string>("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata)));
if (additionalMetadata.IsSet)
formParameterLocalVars.Add(new KeyValuePair<string, string>("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata.Value)));
List<TokenBase> tokenBaseLocalVars = new List<TokenBase>();
@ -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[] {

View File

@ -193,14 +193,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -435,23 +429,6 @@ namespace Org.OpenAPITools.Api
partial void FormatGetOrderById(ref long orderId);
/// <summary>
/// Validates the request parameters
/// </summary>
/// <param name="orderId"></param>
/// <returns></returns>
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'
}
/// <summary>
/// Processes the server response
/// </summary>
@ -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
/// <returns></returns>
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'
}
/// <summary>
@ -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[] {

View File

@ -289,14 +289,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -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
/// <returns></returns>
private void ValidateCreateUsersWithArrayInput(List<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'
}
/// <summary>
@ -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
/// <returns></returns>
private void ValidateCreateUsersWithListInput(List<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'
}
/// <summary>
@ -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
/// <returns></returns>
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'
}
/// <summary>
@ -844,14 +820,8 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -984,17 +954,11 @@ namespace Org.OpenAPITools.Api
/// <returns></returns>
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'
}
/// <summary>
@ -1233,22 +1197,16 @@ namespace Org.OpenAPITools.Api
/// <summary>
/// Validates the request parameters
/// </summary>
/// <param name="user"></param>
/// <param name="username"></param>
/// <param name="user"></param>
/// <returns></returns>
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));
}
/// <summary>
@ -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");

View File

@ -0,0 +1,39 @@
// <auto-generated>
/*
* 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
{
/// <summary>
/// A wrapper for operation parameters which are not required
/// </summary>
public struct Option<TType>
{
/// <summary>
/// The value to send to the server
/// </summary>
public TType Value { get; }
/// <summary>
/// When true the value will be sent to the server
/// </summary>
internal bool IsSet { get; }
/// <summary>
/// A wrapper for operation parameters which are not required
/// </summary>
/// <param name="value"></param>
public Option(TType value)
{
IsSet = true;
Value = value;
}
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}
}

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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

View File

@ -1357,7 +1357,7 @@ No authorization required
<a id="testqueryparametercollectionformat"></a>
# **TestQueryParameterCollectionFormat**
> void TestQueryParameterCollectionFormat (List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context)
> void TestQueryParameterCollectionFormat (List<string> pipe, List<string> ioutil, List<string> http, List<string> url, List<string> context, string requiredNotNullable, string requiredNullable, string notRequiredNotNullable = null, string notRequiredNullable = null)
@ -1389,10 +1389,14 @@ namespace Example
var http = new List<string>(); // List<string> |
var url = new List<string>(); // List<string> |
var context = new List<string>(); // List<string> |
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&lt;string&gt;**](string.md) | | |
| **url** | [**List&lt;string&gt;**](string.md) | | |
| **context** | [**List&lt;string&gt;**](string.md) | | |
| **requiredNotNullable** | **string** | | |
| **requiredNullable** | **string** | | |
| **notRequiredNotNullable** | **string** | | [optional] |
| **notRequiredNullable** | **string** | | [optional] |
### Return type

Some files were not shown because too many files have changed in this diff Show More