diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java index f2d6552410f..d928016ce94 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenOperation.java @@ -50,6 +50,7 @@ public class CodegenOperation { public List requiredParams = new ArrayList(); public List optionalParams = new ArrayList(); public List requiredAndNotNullableParams = new ArrayList(); + public List notNullableParams = new ArrayList(); public List authMethods; public List tags; public List responses = new ArrayList(); @@ -163,6 +164,10 @@ public class CodegenOperation { return nonEmpty(requiredAndNotNullableParams); } + public boolean getHasNotNullableParams() { + return nonEmpty(notNullableParams); + } + /** * Check if there's at least one required parameter * @@ -372,6 +377,7 @@ public class CodegenOperation { sb.append(", requiredParams=").append(requiredParams); sb.append(", optionalParams=").append(optionalParams); sb.append(", requiredAndNotNullableParams=").append(requiredAndNotNullableParams); + sb.append(", notNullableParams=").append(notNullableParams); sb.append(", authMethods=").append(authMethods); sb.append(", tags=").append(tags); sb.append(", responses=").append(responses); @@ -452,6 +458,7 @@ public class CodegenOperation { Objects.equals(requiredParams, that.requiredParams) && Objects.equals(optionalParams, that.optionalParams) && Objects.equals(requiredAndNotNullableParams, that.requiredAndNotNullableParams) && + Objects.equals(notNullableParams, that.notNullableParams) && Objects.equals(authMethods, that.authMethods) && Objects.equals(tags, that.tags) && Objects.equals(responses, that.responses) && @@ -481,6 +488,6 @@ public class CodegenOperation { pathParams, queryParams, headerParams, formParams, cookieParams, requiredParams, returnProperty, optionalParams, authMethods, tags, responses, callbacks, imports, examples, requestBodyExamples, externalDocs, vendorExtensions, nickname, operationIdOriginal, operationIdLowerCase, operationIdCamelCase, - operationIdSnakeCase, hasErrorResponseObject, requiredAndNotNullableParams); + operationIdSnakeCase, hasErrorResponseObject, requiredAndNotNullableParams, notNullableParams); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 2d7680e0880..19fe1addaf7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -4506,6 +4506,7 @@ public class DefaultCodegen implements CodegenConfig { List requiredParams = new ArrayList<>(); List optionalParams = new ArrayList<>(); List requiredAndNotNullableParams = new ArrayList<>(); + List notNullableParams = new ArrayList<>(); CodegenParameter bodyParam = null; RequestBody requestBody = operation.getRequestBody(); @@ -4619,6 +4620,10 @@ public class DefaultCodegen implements CodegenConfig { if (cp.requiredAndNotNullable()) { requiredAndNotNullableParams.add(cp.copy()); } + + if (!cp.isNullable) { + notNullableParams.add(cp.copy()); + } } // add imports to operation import tag @@ -4656,6 +4661,7 @@ public class DefaultCodegen implements CodegenConfig { op.requiredParams = requiredParams; op.optionalParams = optionalParams; op.requiredAndNotNullableParams = requiredAndNotNullableParams; + op.notNullableParams = notNullableParams; op.externalDocs = operation.getExternalDocs(); // legacy support op.nickname = op.operationId; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java index 0a82338ec5f..575664eba13 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java @@ -725,82 +725,50 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co CodegenModel codegenModel = modelHashMap.getModel(); for (CodegenParameter parameter : operation.allParams) { - patchParameter(parameter); + patchParameter(parameter, allModels); } for (CodegenParameter parameter : operation.bodyParams) { - patchParameter(parameter); + patchParameter(parameter, allModels); } for (CodegenParameter parameter : operation.cookieParams) { - patchParameter(parameter); + patchParameter(parameter, allModels); } for (CodegenParameter parameter : operation.formParams) { - patchParameter(parameter); + patchParameter(parameter, allModels); } for (CodegenParameter parameter : operation.headerParams) { - patchParameter(parameter); + patchParameter(parameter, allModels); } for (CodegenParameter parameter : operation.implicitHeadersParams) { - patchParameter(parameter); + patchParameter(parameter, allModels); } for (CodegenParameter parameter : operation.optionalParams) { - patchParameter(parameter); + patchParameter(parameter, allModels); } for (CodegenParameter parameter : operation.pathParams) { - patchParameter(parameter); + patchParameter(parameter, allModels); } for (CodegenParameter parameter : operation.queryParams) { - patchParameter(parameter); + patchParameter(parameter, allModels); } - for (CodegenParameter parameter : operation.requiredAndNotNullableParams) { - patchParameter(parameter); + for (CodegenParameter parameter : operation.notNullableParams) { + patchParameter(parameter, allModels); } for (CodegenParameter parameter : operation.requiredParams) { - patchParameter(parameter); + patchParameter(parameter, allModels); } } - // TODO: move this into patchParamter - if (!isSupportNullable()) { - for (CodegenParameter parameter : operation.allParams) { - CodegenModel model = null; - for (ModelMap modelHashMap : allModels) { - CodegenModel codegenModel = modelHashMap.getModel(); - if (codegenModel.getClassname().equals(parameter.dataType)) { - model = codegenModel; - break; - } - } - - if (model == null) { - // Primitive data types all come already marked - parameter.isNullable = true; - } else { - // Effectively mark enum models as enums and non-nullable - if (model.isEnum) { - parameter.isEnum = true; - parameter.allowableValues = model.allowableValues; - parameter.isPrimitiveType = true; - parameter.isNullable = false; - } else { - parameter.isNullable = true; - } - } - } - } else { - // Effectively mark enum models as enums - updateCodegenParametersEnum(operation.allParams, allModels); - } - processOperation(operation); } } @@ -809,7 +777,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co return objs; } - private void patchParameter(CodegenParameter parameter) { + private void patchParameter(CodegenParameter parameter, List allModels) { parameter.paramName = escapeReservedWord(parameter.paramName); if (parameter.isNullable && !parameter.isContainer && (this.getNullableTypes().contains(parameter.dataType) || parameter.isEnum)) { @@ -819,38 +787,52 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co if (this.getNullableReferencesTypes() || (parameter.vendorExtensions.get("x-nullable-value-type") != null)) { parameter.vendorExtensions.put("x-nullable-type", true); } + + + CodegenModel model = null; + for (ModelMap modelHashMap : allModels) { + CodegenModel codegenModel = modelHashMap.getModel(); + if (codegenModel.getClassname().equals(parameter.dataType)) { + model = codegenModel; + break; + } + } + + if (!isSupportNullable()) { + if (model == null) { + parameter.isNullable = true; + } else { + if (model.isEnum) { + parameter.isEnum = true; + parameter.allowableValues = model.allowableValues; + parameter.isPrimitiveType = true; + parameter.isNullable = false; + } else { + parameter.isNullable = true; + } + } + } else { + updateCodegenParameterEnum(parameter, model); + } } protected void processOperation(CodegenOperation operation) { // default noop } - // TODO: move this into patchParamter - protected void updateCodegenParametersEnum(List parameters, List allModels) { - for (CodegenParameter parameter : parameters) { - CodegenModel model = null; - for (ModelMap modelHashMap : allModels) { - CodegenModel codegenModel = modelHashMap.getModel(); - if (codegenModel.getClassname().equals(parameter.dataType)) { - model = codegenModel; - break; - } - } - - if (model != null) { - // Effectively mark enum models as enums and non-nullable - if (model.isEnum) { - parameter.isEnum = true; - parameter.allowableValues = model.allowableValues; - parameter.isPrimitiveType = true; - parameter.vendorExtensions.put("x-csharp-value-type", true); - } - } - - if (!parameter.isContainer && this.getNullableTypes().contains(parameter.dataType)) { + protected void updateCodegenParameterEnum(CodegenParameter parameter, CodegenModel model) { + if (model != null) { + if (model.isEnum) { + parameter.isEnum = true; + parameter.allowableValues = model.allowableValues; + parameter.isPrimitiveType = true; parameter.vendorExtensions.put("x-csharp-value-type", true); } } + + if (!parameter.isContainer && this.getNullableTypes().contains(parameter.dataType)) { + parameter.vendorExtensions.put("x-csharp-value-type", true); + } } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetServerCodegen.java index 30f8c7799d1..f6c24c621db 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetServerCodegen.java @@ -337,13 +337,11 @@ public class AspNetServerCodegen extends AbstractCSharpCodegen { } @Override - protected void updateCodegenParametersEnum(List parameters, List allModels) { - super.updateCodegenParametersEnum(parameters, allModels); + protected void updateCodegenParameterEnum(CodegenParameter parameter, CodegenModel model) { + super.updateCodegenParameterEnum(parameter, model); - for (CodegenParameter parameter : parameters) { - if (!parameter.required && parameter.vendorExtensions.get("x-csharp-value-type") != null) { //optional - parameter.dataType = parameter.dataType + "?"; - } + if (!parameter.required && parameter.vendorExtensions.get("x-csharp-value-type") != null) { //optional + parameter.dataType = parameter.dataType + "?"; } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java index 290de46cefd..cbf9d648037 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java @@ -385,13 +385,11 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { } @Override - protected void updateCodegenParametersEnum(List parameters, List allModels) { - super.updateCodegenParametersEnum(parameters, allModels); + protected void updateCodegenParameterEnum(CodegenParameter parameter, CodegenModel model) { + super.updateCodegenParameterEnum(parameter, model); - for (CodegenParameter parameter : parameters) { - if (!parameter.required && parameter.vendorExtensions.get("x-csharp-value-type") != null) { //optional - parameter.dataType = parameter.dataType + "?"; - } + if (!parameter.required && parameter.vendorExtensions.get("x-csharp-value-type") != null) { //optional + parameter.dataType = parameter.dataType + "?"; } } @@ -932,7 +930,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { Collections.sort(op.cookieParams, parameterComparatorByDataType); Collections.sort(op.requiredParams, parameterComparatorByDataType); Collections.sort(op.optionalParams, parameterComparatorByDataType); - Collections.sort(op.requiredAndNotNullableParams, parameterComparatorByDataType); + Collections.sort(op.notNullableParams, parameterComparatorByDataType); Comparator comparator = parameterComparatorByRequired.thenComparing(parameterComparatorByDefaultValue); Collections.sort(op.allParams, comparator); @@ -945,7 +943,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { Collections.sort(op.cookieParams, comparator); Collections.sort(op.requiredParams, comparator); Collections.sort(op.optionalParams, comparator); - Collections.sort(op.requiredAndNotNullableParams, comparator); + Collections.sort(op.notNullableParams, comparator); return op; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpFunctionsServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpFunctionsServerCodegen.java index 37eac40fe5c..966dcad9a25 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpFunctionsServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpFunctionsServerCodegen.java @@ -287,13 +287,11 @@ public class CSharpFunctionsServerCodegen extends AbstractCSharpCodegen { } @Override - protected void updateCodegenParametersEnum(List parameters, List allModels) { - super.updateCodegenParametersEnum(parameters, allModels); + protected void updateCodegenParameterEnum(CodegenParameter parameter, CodegenModel model) { + super.updateCodegenParameterEnum(parameter, model); - for (CodegenParameter parameter : parameters) { - if (!parameter.required && parameter.vendorExtensions.get("x-csharp-value-type") != null) { //optional - parameter.dataType = parameter.dataType + "?"; - } + if (!parameter.required && parameter.vendorExtensions.get("x-csharp-value-type") != null) { //optional + parameter.dataType = parameter.dataType + "?"; } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpReducedClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpReducedClientCodegen.java index d6af60c68b6..755effd5248 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpReducedClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpReducedClientCodegen.java @@ -345,13 +345,11 @@ public class CSharpReducedClientCodegen extends AbstractCSharpCodegen { } @Override - protected void updateCodegenParametersEnum(List parameters, List allModels) { - super.updateCodegenParametersEnum(parameters, allModels); + protected void updateCodegenParameterEnum(CodegenParameter parameter, CodegenModel model) { + super.updateCodegenParameterEnum(parameter, model); - for (CodegenParameter parameter : parameters) { - if (!parameter.required && parameter.vendorExtensions.get("x-csharp-value-type") != null) { //optional - parameter.dataType = parameter.dataType + "?"; - } + if (!parameter.required && parameter.vendorExtensions.get("x-csharp-value-type") != null) { //optional + parameter.dataType = parameter.dataType + "?"; } } diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/generichost/api.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/generichost/api.mustache index a3923ff23aa..2feb139949d 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/generichost/api.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/generichost/api.mustache @@ -132,7 +132,7 @@ namespace {{packageName}}.{{apiPackage}} {{/-first}} {{/allParams}} - {{#requiredAndNotNullableParams}} + {{#notNullableParams}} {{#-first}} /// /// Validates the request parameters @@ -141,9 +141,9 @@ namespace {{packageName}}.{{apiPackage}} /// {{#-last}} /// - private void Validate{{operationId}}({{#requiredAndNotNullableParams}}{{#lambda.required}}{{{dataType}}}{{/lambda.required}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredAndNotNullableParams}}) + private void Validate{{operationId}}({{#notNullableParams}}{{#required}}{{#lambda.required}}{{{dataType}}}{{/lambda.required}}{{/required}}{{^required}}{{#lambda.optional}}{{{dataType}}}{{/lambda.optional}}{{/required}} {{paramName}}{{^-last}}, {{/-last}}{{/notNullableParams}}) { - {{#requiredAndNotNullableParams}} + {{#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' @@ -155,21 +155,25 @@ namespace {{packageName}}.{{apiPackage}} {{/nrt}} {{^nrt}} - {{^vendorExtensions.x-csharp-value-type}} + {{^vendorExtensions.x-is-value-type}} if ({{paramName}} == null) throw new ArgumentNullException(nameof({{paramName}})); - {{/vendorExtensions.x-csharp-value-type}} + {{/vendorExtensions.x-is-value-type}} + {{#vendorExtensions.x-is-value-type}} + if ({{paramName}} == 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}} - {{/requiredAndNotNullableParams}} + {{/notNullableParams}} } {{/-last}} - {{/requiredAndNotNullableParams}} + {{/notNullableParams}} /// /// Processes the server response /// @@ -254,12 +258,12 @@ namespace {{packageName}}.{{apiPackage}} try { - {{#requiredAndNotNullableParams}} + {{#notNullableParams}} {{#-first}} - Validate{{operationId}}({{#requiredAndNotNullableParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredAndNotNullableParams}}); + Validate{{operationId}}({{#notNullableParams}}{{paramName}}{{^-last}}, {{/-last}}{{/notNullableParams}}); {{/-first}} - {{/requiredAndNotNullableParams}} + {{/notNullableParams}} {{#allParams}} {{#-first}} Format{{operationId}}({{#allParams}}{{#isPrimitiveType}}ref {{/isPrimitiveType}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); diff --git a/samples/client/others/csharp-netcore-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs b/samples/client/others/csharp-netcore-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs index 6ab39ceb685..029274a3f70 100644 --- a/samples/client/others/csharp-netcore-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs +++ b/samples/client/others/csharp-netcore-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs @@ -508,7 +508,7 @@ namespace Org.OpenAPITools.Api localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); } - localVarRequestOptions.FormParameters.Add("status", Org.OpenAPITools.Client.ClientUtils.Serialize(status)); // form parameter + localVarRequestOptions.FormParameters.Add("status", Org.OpenAPITools.Client.ClientUtils.ParameterToString(status)); // form parameter if (marker != null) { localVarRequestOptions.FormParameters.Add("marker", Org.OpenAPITools.Client.ClientUtils.ParameterToString(marker)); // form parameter diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeApi.cs index e31726e2459..8a9ea237de2 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeApi.cs @@ -609,6 +609,23 @@ namespace Org.OpenAPITools.Api partial void FormatFakeOuterBooleanSerialize(ref bool? body); + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFakeOuterBooleanSerialize(bool? body) + { + #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + if (body == null) + throw new ArgumentNullException(nameof(body)); + + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + } + /// /// Processes the server response /// @@ -680,6 +697,8 @@ namespace Org.OpenAPITools.Api try { + ValidateFakeOuterBooleanSerialize(body); + FormatFakeOuterBooleanSerialize(ref body); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -738,6 +757,23 @@ namespace Org.OpenAPITools.Api partial void FormatFakeOuterCompositeSerialize(OuterComposite? outerComposite); + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFakeOuterCompositeSerialize(OuterComposite? outerComposite) + { + #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + if (outerComposite == null) + throw new ArgumentNullException(nameof(outerComposite)); + + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + } + /// /// Processes the server response /// @@ -809,6 +845,8 @@ namespace Org.OpenAPITools.Api try { + ValidateFakeOuterCompositeSerialize(outerComposite); + FormatFakeOuterCompositeSerialize(outerComposite); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -867,6 +905,23 @@ namespace Org.OpenAPITools.Api partial void FormatFakeOuterNumberSerialize(ref decimal? body); + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFakeOuterNumberSerialize(decimal? body) + { + #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + if (body == null) + throw new ArgumentNullException(nameof(body)); + + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + } + /// /// Processes the server response /// @@ -938,6 +993,8 @@ namespace Org.OpenAPITools.Api try { + ValidateFakeOuterNumberSerialize(body); + FormatFakeOuterNumberSerialize(ref body); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -1000,8 +1057,9 @@ namespace Org.OpenAPITools.Api /// Validates the request parameters /// /// + /// /// - private void ValidateFakeOuterStringSerialize(Guid requiredStringUuid) + private void ValidateFakeOuterStringSerialize(Guid requiredStringUuid, string? body) { #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' @@ -1009,6 +1067,9 @@ namespace Org.OpenAPITools.Api if (requiredStringUuid == null) throw new ArgumentNullException(nameof(requiredStringUuid)); + if (body == null) + throw new ArgumentNullException(nameof(body)); + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } @@ -1090,7 +1151,7 @@ namespace Org.OpenAPITools.Api try { - ValidateFakeOuterStringSerialize(requiredStringUuid); + ValidateFakeOuterStringSerialize(requiredStringUuid, body); FormatFakeOuterStringSerialize(ref requiredStringUuid, ref body); @@ -1711,8 +1772,18 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// /// - private void ValidateTestEndpointParameters(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter) + private void ValidateTestEndpointParameters(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date, System.IO.Stream? binary, float? varFloat, int? integer, int? int32, long? int64, string? varString, string? password, string? callback, DateTime? dateTime) { #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' @@ -1729,6 +1800,36 @@ namespace Org.OpenAPITools.Api if (patternWithoutDelimiter == null) throw new ArgumentNullException(nameof(patternWithoutDelimiter)); + if (date == null) + throw new ArgumentNullException(nameof(date)); + + if (binary == null) + throw new ArgumentNullException(nameof(binary)); + + if (varFloat == null) + throw new ArgumentNullException(nameof(varFloat)); + + if (integer == null) + throw new ArgumentNullException(nameof(integer)); + + if (int32 == null) + throw new ArgumentNullException(nameof(int32)); + + if (int64 == null) + throw new ArgumentNullException(nameof(int64)); + + if (varString == null) + throw new ArgumentNullException(nameof(varString)); + + if (password == null) + throw new ArgumentNullException(nameof(password)); + + if (callback == null) + throw new ArgumentNullException(nameof(callback)); + + if (dateTime == null) + throw new ArgumentNullException(nameof(dateTime)); + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } @@ -1882,7 +1983,7 @@ namespace Org.OpenAPITools.Api try { - ValidateTestEndpointParameters(varByte, number, varDouble, patternWithoutDelimiter); + ValidateTestEndpointParameters(varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime); FormatTestEndpointParameters(ref varByte, ref number, ref varDouble, ref patternWithoutDelimiter, ref date, ref binary, ref varFloat, ref integer, ref int32, ref int64, ref varString, ref password, ref callback, ref dateTime); @@ -1987,6 +2088,51 @@ namespace Org.OpenAPITools.Api partial void FormatTestEnumParameters(List? enumHeaderStringArray, List? enumQueryStringArray, ref double? enumQueryDouble, ref int? enumQueryInteger, List? enumFormStringArray, ref string? enumHeaderString, ref string? enumQueryString, ref string? enumFormString); + /// + /// Validates the request parameters + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void ValidateTestEnumParameters(List? enumHeaderStringArray, List? enumQueryStringArray, double? enumQueryDouble, int? enumQueryInteger, List? enumFormStringArray, string? enumHeaderString, string? enumQueryString, string? enumFormString) + { + #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + if (enumHeaderStringArray == null) + throw new ArgumentNullException(nameof(enumHeaderStringArray)); + + if (enumQueryStringArray == null) + throw new ArgumentNullException(nameof(enumQueryStringArray)); + + if (enumQueryDouble == null) + throw new ArgumentNullException(nameof(enumQueryDouble)); + + if (enumQueryInteger == null) + throw new ArgumentNullException(nameof(enumQueryInteger)); + + if (enumFormStringArray == null) + throw new ArgumentNullException(nameof(enumFormStringArray)); + + if (enumHeaderString == null) + throw new ArgumentNullException(nameof(enumHeaderString)); + + if (enumQueryString == null) + throw new ArgumentNullException(nameof(enumQueryString)); + + if (enumFormString == null) + throw new ArgumentNullException(nameof(enumFormString)); + + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + } + /// /// Processes the server response /// @@ -2100,6 +2246,8 @@ namespace Org.OpenAPITools.Api try { + ValidateTestEnumParameters(enumHeaderStringArray, enumQueryStringArray, enumQueryDouble, enumQueryInteger, enumFormStringArray, enumHeaderString, enumQueryString, enumFormString); + FormatTestEnumParameters(enumHeaderStringArray, enumQueryStringArray, ref enumQueryDouble, ref enumQueryInteger, enumFormStringArray, ref enumHeaderString, ref enumQueryString, ref enumFormString); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -2185,8 +2333,11 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// /// - private void ValidateTestGroupParameters(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group) + private void ValidateTestGroupParameters(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup, int? stringGroup, long? int64Group) { #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' @@ -2200,6 +2351,15 @@ namespace Org.OpenAPITools.Api if (requiredInt64Group == null) throw new ArgumentNullException(nameof(requiredInt64Group)); + if (booleanGroup == null) + throw new ArgumentNullException(nameof(booleanGroup)); + + if (stringGroup == null) + throw new ArgumentNullException(nameof(stringGroup)); + + if (int64Group == null) + throw new ArgumentNullException(nameof(int64Group)); + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } @@ -2305,7 +2465,7 @@ namespace Org.OpenAPITools.Api try { - ValidateTestGroupParameters(requiredBooleanGroup, requiredStringGroup, requiredInt64Group); + ValidateTestGroupParameters(requiredBooleanGroup, requiredStringGroup, requiredInt64Group, booleanGroup, stringGroup, int64Group); FormatTestGroupParameters(ref requiredBooleanGroup, ref requiredStringGroup, ref requiredInt64Group, ref booleanGroup, ref stringGroup, ref int64Group); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs index 8e2356a871e..12fa5d1425d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs @@ -487,8 +487,9 @@ namespace Org.OpenAPITools.Api /// Validates the request parameters /// /// + /// /// - private void ValidateDeletePet(long petId) + private void ValidateDeletePet(long petId, 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' @@ -496,6 +497,9 @@ namespace Org.OpenAPITools.Api if (petId == null) throw new ArgumentNullException(nameof(petId)); + if (apiKey == 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' } @@ -577,7 +581,7 @@ namespace Org.OpenAPITools.Api try { - ValidateDeletePet(petId); + ValidateDeletePet(petId, apiKey); FormatDeletePet(ref petId, ref apiKey); @@ -1280,8 +1284,10 @@ namespace Org.OpenAPITools.Api /// Validates the request parameters /// /// + /// + /// /// - private void ValidateUpdatePetWithForm(long petId) + private void ValidateUpdatePetWithForm(long petId, string? name, 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' @@ -1289,6 +1295,12 @@ namespace Org.OpenAPITools.Api if (petId == null) throw new ArgumentNullException(nameof(petId)); + if (name == null) + throw new ArgumentNullException(nameof(name)); + + 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' } @@ -1376,7 +1388,7 @@ namespace Org.OpenAPITools.Api try { - ValidateUpdatePetWithForm(petId); + ValidateUpdatePetWithForm(petId, name, status); FormatUpdatePetWithForm(ref petId, ref name, ref status); @@ -1452,8 +1464,10 @@ namespace Org.OpenAPITools.Api /// Validates the request parameters /// /// + /// + /// /// - private void ValidateUploadFile(long petId) + private void ValidateUploadFile(long petId, System.IO.Stream? file, 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' @@ -1461,6 +1475,12 @@ namespace Org.OpenAPITools.Api if (petId == null) throw new ArgumentNullException(nameof(petId)); + if (file == null) + throw new ArgumentNullException(nameof(file)); + + if (additionalMetadata == 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' } @@ -1548,7 +1568,7 @@ namespace Org.OpenAPITools.Api try { - ValidateUploadFile(petId); + ValidateUploadFile(petId, file, additionalMetadata); FormatUploadFile(ref petId, ref file, ref additionalMetadata); @@ -1634,8 +1654,9 @@ namespace Org.OpenAPITools.Api /// /// /// + /// /// - private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, long petId) + private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, long petId, 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' @@ -1646,6 +1667,9 @@ namespace Org.OpenAPITools.Api if (petId == null) throw new ArgumentNullException(nameof(petId)); + if (additionalMetadata == 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' } @@ -1733,7 +1757,7 @@ namespace Org.OpenAPITools.Api try { - ValidateUploadFileWithRequiredFile(requiredFile, petId); + ValidateUploadFileWithRequiredFile(requiredFile, petId, additionalMetadata); FormatUploadFileWithRequiredFile(ref requiredFile, ref petId, ref additionalMetadata); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeApi.cs index c4c63d88a01..5f5fd1c3135 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeApi.cs @@ -607,6 +607,23 @@ namespace Org.OpenAPITools.Api partial void FormatFakeOuterBooleanSerialize(ref bool? body); + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFakeOuterBooleanSerialize(bool? body) + { + #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + if (body == null) + throw new ArgumentNullException(nameof(body)); + + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + } + /// /// Processes the server response /// @@ -678,6 +695,8 @@ namespace Org.OpenAPITools.Api try { + ValidateFakeOuterBooleanSerialize(body); + FormatFakeOuterBooleanSerialize(ref body); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -736,6 +755,23 @@ namespace Org.OpenAPITools.Api partial void FormatFakeOuterCompositeSerialize(OuterComposite outerComposite); + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFakeOuterCompositeSerialize(OuterComposite outerComposite) + { + #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + if (outerComposite == null) + throw new ArgumentNullException(nameof(outerComposite)); + + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + } + /// /// Processes the server response /// @@ -807,6 +843,8 @@ namespace Org.OpenAPITools.Api try { + ValidateFakeOuterCompositeSerialize(outerComposite); + FormatFakeOuterCompositeSerialize(outerComposite); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -865,6 +903,23 @@ namespace Org.OpenAPITools.Api partial void FormatFakeOuterNumberSerialize(ref decimal? body); + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFakeOuterNumberSerialize(decimal? body) + { + #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + if (body == null) + throw new ArgumentNullException(nameof(body)); + + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + } + /// /// Processes the server response /// @@ -936,6 +991,8 @@ namespace Org.OpenAPITools.Api try { + ValidateFakeOuterNumberSerialize(body); + FormatFakeOuterNumberSerialize(ref body); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -998,8 +1055,9 @@ namespace Org.OpenAPITools.Api /// Validates the request parameters /// /// + /// /// - private void ValidateFakeOuterStringSerialize(Guid requiredStringUuid) + private void ValidateFakeOuterStringSerialize(Guid requiredStringUuid, string body) { #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' @@ -1007,6 +1065,9 @@ namespace Org.OpenAPITools.Api if (requiredStringUuid == null) throw new ArgumentNullException(nameof(requiredStringUuid)); + if (body == null) + throw new ArgumentNullException(nameof(body)); + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } @@ -1088,7 +1149,7 @@ namespace Org.OpenAPITools.Api try { - ValidateFakeOuterStringSerialize(requiredStringUuid); + ValidateFakeOuterStringSerialize(requiredStringUuid, body); FormatFakeOuterStringSerialize(ref requiredStringUuid, ref body); @@ -1709,8 +1770,18 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// /// - private void ValidateTestEndpointParameters(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter) + private void ValidateTestEndpointParameters(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date, System.IO.Stream binary, float? varFloat, int? integer, int? int32, long? int64, string varString, string password, string callback, DateTime? dateTime) { #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' @@ -1727,6 +1798,36 @@ namespace Org.OpenAPITools.Api if (patternWithoutDelimiter == null) throw new ArgumentNullException(nameof(patternWithoutDelimiter)); + if (date == null) + throw new ArgumentNullException(nameof(date)); + + if (binary == null) + throw new ArgumentNullException(nameof(binary)); + + if (varFloat == null) + throw new ArgumentNullException(nameof(varFloat)); + + if (integer == null) + throw new ArgumentNullException(nameof(integer)); + + if (int32 == null) + throw new ArgumentNullException(nameof(int32)); + + if (int64 == null) + throw new ArgumentNullException(nameof(int64)); + + if (varString == null) + throw new ArgumentNullException(nameof(varString)); + + if (password == null) + throw new ArgumentNullException(nameof(password)); + + if (callback == null) + throw new ArgumentNullException(nameof(callback)); + + if (dateTime == null) + throw new ArgumentNullException(nameof(dateTime)); + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } @@ -1880,7 +1981,7 @@ namespace Org.OpenAPITools.Api try { - ValidateTestEndpointParameters(varByte, number, varDouble, patternWithoutDelimiter); + ValidateTestEndpointParameters(varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime); FormatTestEndpointParameters(ref varByte, ref number, ref varDouble, ref patternWithoutDelimiter, ref date, ref binary, ref varFloat, ref integer, ref int32, ref int64, ref varString, ref password, ref callback, ref dateTime); @@ -1985,6 +2086,51 @@ namespace Org.OpenAPITools.Api partial void FormatTestEnumParameters(List enumHeaderStringArray, List enumQueryStringArray, ref double? enumQueryDouble, ref int? enumQueryInteger, List enumFormStringArray, ref string enumHeaderString, ref string enumQueryString, ref string enumFormString); + /// + /// Validates the request parameters + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void ValidateTestEnumParameters(List enumHeaderStringArray, List enumQueryStringArray, double? enumQueryDouble, int? enumQueryInteger, List enumFormStringArray, string enumHeaderString, string enumQueryString, string enumFormString) + { + #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + if (enumHeaderStringArray == null) + throw new ArgumentNullException(nameof(enumHeaderStringArray)); + + if (enumQueryStringArray == null) + throw new ArgumentNullException(nameof(enumQueryStringArray)); + + if (enumQueryDouble == null) + throw new ArgumentNullException(nameof(enumQueryDouble)); + + if (enumQueryInteger == null) + throw new ArgumentNullException(nameof(enumQueryInteger)); + + if (enumFormStringArray == null) + throw new ArgumentNullException(nameof(enumFormStringArray)); + + if (enumHeaderString == null) + throw new ArgumentNullException(nameof(enumHeaderString)); + + if (enumQueryString == null) + throw new ArgumentNullException(nameof(enumQueryString)); + + if (enumFormString == null) + throw new ArgumentNullException(nameof(enumFormString)); + + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + } + /// /// Processes the server response /// @@ -2098,6 +2244,8 @@ namespace Org.OpenAPITools.Api try { + ValidateTestEnumParameters(enumHeaderStringArray, enumQueryStringArray, enumQueryDouble, enumQueryInteger, enumFormStringArray, enumHeaderString, enumQueryString, enumFormString); + FormatTestEnumParameters(enumHeaderStringArray, enumQueryStringArray, ref enumQueryDouble, ref enumQueryInteger, enumFormStringArray, ref enumHeaderString, ref enumQueryString, ref enumFormString); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -2183,8 +2331,11 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// /// - private void ValidateTestGroupParameters(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group) + private void ValidateTestGroupParameters(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup, int? stringGroup, long? int64Group) { #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' @@ -2198,6 +2349,15 @@ namespace Org.OpenAPITools.Api if (requiredInt64Group == null) throw new ArgumentNullException(nameof(requiredInt64Group)); + if (booleanGroup == null) + throw new ArgumentNullException(nameof(booleanGroup)); + + if (stringGroup == null) + throw new ArgumentNullException(nameof(stringGroup)); + + if (int64Group == null) + throw new ArgumentNullException(nameof(int64Group)); + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } @@ -2303,7 +2463,7 @@ namespace Org.OpenAPITools.Api try { - ValidateTestGroupParameters(requiredBooleanGroup, requiredStringGroup, requiredInt64Group); + ValidateTestGroupParameters(requiredBooleanGroup, requiredStringGroup, requiredInt64Group, booleanGroup, stringGroup, int64Group); FormatTestGroupParameters(ref requiredBooleanGroup, ref requiredStringGroup, ref requiredInt64Group, ref booleanGroup, ref stringGroup, ref int64Group); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs index 9f0eb4085ed..9b325e60dd8 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs @@ -485,8 +485,9 @@ namespace Org.OpenAPITools.Api /// Validates the request parameters /// /// + /// /// - private void ValidateDeletePet(long petId) + private void ValidateDeletePet(long petId, 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' @@ -494,6 +495,9 @@ namespace Org.OpenAPITools.Api if (petId == null) throw new ArgumentNullException(nameof(petId)); + if (apiKey == 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' } @@ -575,7 +579,7 @@ namespace Org.OpenAPITools.Api try { - ValidateDeletePet(petId); + ValidateDeletePet(petId, apiKey); FormatDeletePet(ref petId, ref apiKey); @@ -1278,8 +1282,10 @@ namespace Org.OpenAPITools.Api /// Validates the request parameters /// /// + /// + /// /// - private void ValidateUpdatePetWithForm(long petId) + private void ValidateUpdatePetWithForm(long petId, string name, 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' @@ -1287,6 +1293,12 @@ namespace Org.OpenAPITools.Api if (petId == null) throw new ArgumentNullException(nameof(petId)); + if (name == null) + throw new ArgumentNullException(nameof(name)); + + 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' } @@ -1374,7 +1386,7 @@ namespace Org.OpenAPITools.Api try { - ValidateUpdatePetWithForm(petId); + ValidateUpdatePetWithForm(petId, name, status); FormatUpdatePetWithForm(ref petId, ref name, ref status); @@ -1450,8 +1462,10 @@ namespace Org.OpenAPITools.Api /// Validates the request parameters /// /// + /// + /// /// - private void ValidateUploadFile(long petId) + private void ValidateUploadFile(long petId, System.IO.Stream file, 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' @@ -1459,6 +1473,12 @@ namespace Org.OpenAPITools.Api if (petId == null) throw new ArgumentNullException(nameof(petId)); + if (file == null) + throw new ArgumentNullException(nameof(file)); + + if (additionalMetadata == 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' } @@ -1546,7 +1566,7 @@ namespace Org.OpenAPITools.Api try { - ValidateUploadFile(petId); + ValidateUploadFile(petId, file, additionalMetadata); FormatUploadFile(ref petId, ref file, ref additionalMetadata); @@ -1632,8 +1652,9 @@ namespace Org.OpenAPITools.Api /// /// /// + /// /// - private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, long petId) + private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, long petId, 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' @@ -1644,6 +1665,9 @@ namespace Org.OpenAPITools.Api if (petId == null) throw new ArgumentNullException(nameof(petId)); + if (additionalMetadata == 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' } @@ -1731,7 +1755,7 @@ namespace Org.OpenAPITools.Api try { - ValidateUploadFileWithRequiredFile(requiredFile, petId); + ValidateUploadFileWithRequiredFile(requiredFile, petId, additionalMetadata); FormatUploadFileWithRequiredFile(ref requiredFile, ref petId, ref additionalMetadata); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeApi.cs index fd5961098ae..70ef3cfb06f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeApi.cs @@ -606,6 +606,23 @@ namespace Org.OpenAPITools.Api partial void FormatFakeOuterBooleanSerialize(ref bool? body); + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFakeOuterBooleanSerialize(bool? body) + { + #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + if (body == null) + throw new ArgumentNullException(nameof(body)); + + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + } + /// /// Processes the server response /// @@ -677,6 +694,8 @@ namespace Org.OpenAPITools.Api try { + ValidateFakeOuterBooleanSerialize(body); + FormatFakeOuterBooleanSerialize(ref body); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -734,6 +753,23 @@ namespace Org.OpenAPITools.Api partial void FormatFakeOuterCompositeSerialize(OuterComposite outerComposite); + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFakeOuterCompositeSerialize(OuterComposite outerComposite) + { + #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + if (outerComposite == null) + throw new ArgumentNullException(nameof(outerComposite)); + + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + } + /// /// Processes the server response /// @@ -805,6 +841,8 @@ namespace Org.OpenAPITools.Api try { + ValidateFakeOuterCompositeSerialize(outerComposite); + FormatFakeOuterCompositeSerialize(outerComposite); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -862,6 +900,23 @@ namespace Org.OpenAPITools.Api partial void FormatFakeOuterNumberSerialize(ref decimal? body); + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFakeOuterNumberSerialize(decimal? body) + { + #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + if (body == null) + throw new ArgumentNullException(nameof(body)); + + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + } + /// /// Processes the server response /// @@ -933,6 +988,8 @@ namespace Org.OpenAPITools.Api try { + ValidateFakeOuterNumberSerialize(body); + FormatFakeOuterNumberSerialize(ref body); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -994,8 +1051,9 @@ namespace Org.OpenAPITools.Api /// Validates the request parameters /// /// + /// /// - private void ValidateFakeOuterStringSerialize(Guid requiredStringUuid) + private void ValidateFakeOuterStringSerialize(Guid requiredStringUuid, string body) { #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' @@ -1003,6 +1061,9 @@ namespace Org.OpenAPITools.Api if (requiredStringUuid == null) throw new ArgumentNullException(nameof(requiredStringUuid)); + if (body == null) + throw new ArgumentNullException(nameof(body)); + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } @@ -1084,7 +1145,7 @@ namespace Org.OpenAPITools.Api try { - ValidateFakeOuterStringSerialize(requiredStringUuid); + ValidateFakeOuterStringSerialize(requiredStringUuid, body); FormatFakeOuterStringSerialize(ref requiredStringUuid, ref body); @@ -1702,8 +1763,18 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// /// - private void ValidateTestEndpointParameters(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter) + private void ValidateTestEndpointParameters(byte[] varByte, decimal number, double varDouble, string patternWithoutDelimiter, DateTime? date, System.IO.Stream binary, float? varFloat, int? integer, int? int32, long? int64, string varString, string password, string callback, DateTime? dateTime) { #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' @@ -1720,6 +1791,36 @@ namespace Org.OpenAPITools.Api if (patternWithoutDelimiter == null) throw new ArgumentNullException(nameof(patternWithoutDelimiter)); + if (date == null) + throw new ArgumentNullException(nameof(date)); + + if (binary == null) + throw new ArgumentNullException(nameof(binary)); + + if (varFloat == null) + throw new ArgumentNullException(nameof(varFloat)); + + if (integer == null) + throw new ArgumentNullException(nameof(integer)); + + if (int32 == null) + throw new ArgumentNullException(nameof(int32)); + + if (int64 == null) + throw new ArgumentNullException(nameof(int64)); + + if (varString == null) + throw new ArgumentNullException(nameof(varString)); + + if (password == null) + throw new ArgumentNullException(nameof(password)); + + if (callback == null) + throw new ArgumentNullException(nameof(callback)); + + if (dateTime == null) + throw new ArgumentNullException(nameof(dateTime)); + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } @@ -1873,7 +1974,7 @@ namespace Org.OpenAPITools.Api try { - ValidateTestEndpointParameters(varByte, number, varDouble, patternWithoutDelimiter); + ValidateTestEndpointParameters(varByte, number, varDouble, patternWithoutDelimiter, date, binary, varFloat, integer, int32, int64, varString, password, callback, dateTime); FormatTestEndpointParameters(ref varByte, ref number, ref varDouble, ref patternWithoutDelimiter, ref date, ref binary, ref varFloat, ref integer, ref int32, ref int64, ref varString, ref password, ref callback, ref dateTime); @@ -1978,6 +2079,51 @@ namespace Org.OpenAPITools.Api partial void FormatTestEnumParameters(List enumHeaderStringArray, List enumQueryStringArray, ref double? enumQueryDouble, ref int? enumQueryInteger, List enumFormStringArray, ref string enumHeaderString, ref string enumQueryString, ref string enumFormString); + /// + /// Validates the request parameters + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void ValidateTestEnumParameters(List enumHeaderStringArray, List enumQueryStringArray, double? enumQueryDouble, int? enumQueryInteger, List enumFormStringArray, string enumHeaderString, string enumQueryString, string enumFormString) + { + #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + + if (enumHeaderStringArray == null) + throw new ArgumentNullException(nameof(enumHeaderStringArray)); + + if (enumQueryStringArray == null) + throw new ArgumentNullException(nameof(enumQueryStringArray)); + + if (enumQueryDouble == null) + throw new ArgumentNullException(nameof(enumQueryDouble)); + + if (enumQueryInteger == null) + throw new ArgumentNullException(nameof(enumQueryInteger)); + + if (enumFormStringArray == null) + throw new ArgumentNullException(nameof(enumFormStringArray)); + + if (enumHeaderString == null) + throw new ArgumentNullException(nameof(enumHeaderString)); + + if (enumQueryString == null) + throw new ArgumentNullException(nameof(enumQueryString)); + + if (enumFormString == null) + throw new ArgumentNullException(nameof(enumFormString)); + + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' + #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' + } + /// /// Processes the server response /// @@ -2091,6 +2237,8 @@ namespace Org.OpenAPITools.Api try { + ValidateTestEnumParameters(enumHeaderStringArray, enumQueryStringArray, enumQueryDouble, enumQueryInteger, enumFormStringArray, enumHeaderString, enumQueryString, enumFormString); + FormatTestEnumParameters(enumHeaderStringArray, enumQueryStringArray, ref enumQueryDouble, ref enumQueryInteger, enumFormStringArray, ref enumHeaderString, ref enumQueryString, ref enumFormString); using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) @@ -2176,8 +2324,11 @@ namespace Org.OpenAPITools.Api /// /// /// + /// + /// + /// /// - private void ValidateTestGroupParameters(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group) + private void ValidateTestGroupParameters(bool requiredBooleanGroup, int requiredStringGroup, long requiredInt64Group, bool? booleanGroup, int? stringGroup, long? int64Group) { #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' #pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' @@ -2191,6 +2342,15 @@ namespace Org.OpenAPITools.Api if (requiredInt64Group == null) throw new ArgumentNullException(nameof(requiredInt64Group)); + if (booleanGroup == null) + throw new ArgumentNullException(nameof(booleanGroup)); + + if (stringGroup == null) + throw new ArgumentNullException(nameof(stringGroup)); + + if (int64Group == null) + throw new ArgumentNullException(nameof(int64Group)); + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } @@ -2296,7 +2456,7 @@ namespace Org.OpenAPITools.Api try { - ValidateTestGroupParameters(requiredBooleanGroup, requiredStringGroup, requiredInt64Group); + ValidateTestGroupParameters(requiredBooleanGroup, requiredStringGroup, requiredInt64Group, booleanGroup, stringGroup, int64Group); FormatTestGroupParameters(ref requiredBooleanGroup, ref requiredStringGroup, ref requiredInt64Group, ref booleanGroup, ref stringGroup, ref int64Group); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs index fd3ecad4c78..c19b67a5d6c 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs @@ -485,8 +485,9 @@ namespace Org.OpenAPITools.Api /// Validates the request parameters /// /// + /// /// - private void ValidateDeletePet(long petId) + private void ValidateDeletePet(long petId, 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' @@ -494,6 +495,9 @@ namespace Org.OpenAPITools.Api if (petId == null) throw new ArgumentNullException(nameof(petId)); + if (apiKey == 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' } @@ -575,7 +579,7 @@ namespace Org.OpenAPITools.Api try { - ValidateDeletePet(petId); + ValidateDeletePet(petId, apiKey); FormatDeletePet(ref petId, ref apiKey); @@ -1274,8 +1278,10 @@ namespace Org.OpenAPITools.Api /// Validates the request parameters /// /// + /// + /// /// - private void ValidateUpdatePetWithForm(long petId) + private void ValidateUpdatePetWithForm(long petId, string name, 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' @@ -1283,6 +1289,12 @@ namespace Org.OpenAPITools.Api if (petId == null) throw new ArgumentNullException(nameof(petId)); + if (name == null) + throw new ArgumentNullException(nameof(name)); + + 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' } @@ -1370,7 +1382,7 @@ namespace Org.OpenAPITools.Api try { - ValidateUpdatePetWithForm(petId); + ValidateUpdatePetWithForm(petId, name, status); FormatUpdatePetWithForm(ref petId, ref name, ref status); @@ -1446,8 +1458,10 @@ namespace Org.OpenAPITools.Api /// Validates the request parameters /// /// + /// + /// /// - private void ValidateUploadFile(long petId) + private void ValidateUploadFile(long petId, System.IO.Stream file, 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' @@ -1455,6 +1469,12 @@ namespace Org.OpenAPITools.Api if (petId == null) throw new ArgumentNullException(nameof(petId)); + if (file == null) + throw new ArgumentNullException(nameof(file)); + + if (additionalMetadata == 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' } @@ -1542,7 +1562,7 @@ namespace Org.OpenAPITools.Api try { - ValidateUploadFile(petId); + ValidateUploadFile(petId, file, additionalMetadata); FormatUploadFile(ref petId, ref file, ref additionalMetadata); @@ -1627,8 +1647,9 @@ namespace Org.OpenAPITools.Api /// /// /// + /// /// - private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, long petId) + private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, long petId, 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' @@ -1639,6 +1660,9 @@ namespace Org.OpenAPITools.Api if (petId == null) throw new ArgumentNullException(nameof(petId)); + if (additionalMetadata == 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' } @@ -1726,7 +1750,7 @@ namespace Org.OpenAPITools.Api try { - ValidateUploadFileWithRequiredFile(requiredFile, petId); + ValidateUploadFileWithRequiredFile(requiredFile, petId, additionalMetadata); FormatUploadFileWithRequiredFile(ref requiredFile, ref petId, ref additionalMetadata);