From 861ab818326c7cfcd622ba9e3e41ff303ba3a4d2 Mon Sep 17 00:00:00 2001 From: Emanuele Saccomandi Date: Mon, 10 Jul 2023 09:57:39 +0200 Subject: [PATCH 1/9] minor zapier api template fixes --- .../src/main/resources/zapier/api.mustache | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/zapier/api.mustache b/modules/openapi-generator/src/main/resources/zapier/api.mustache index 8c1c7d5e34d4..ce417d39c4a3 100644 --- a/modules/openapi-generator/src/main/resources/zapier/api.mustache +++ b/modules/openapi-generator/src/main/resources/zapier/api.mustache @@ -28,7 +28,7 @@ module.exports = { { key: '{{baseName}}', label: '{{description}}', - type: '{{#isInteger}}integer{{/isInteger}}{{^isInteger}}{{#isNumeric}}number{{/isNumeric}}{{/isInteger}}{{#isString}}string{{/isString}}{{#isBoolean}}boolean{{/isBoolean}}{{#isDateTime}}datetime{{/isDateTime}}{{#isDate}}datetime{{/isDate}}{{#isFile}}file{{/isFile}}', + type: '{{dataType}}', {{#required}} required: true, {{/required}} @@ -42,14 +42,25 @@ module.exports = { }, {{/isPrimitiveType}} {{^isPrimitiveType}} + {{#isArray}} + { + key: '{{baseName}}', + label: '{{description}}', + type: 'string', + } + {{/isArray}} + {{^isArray}} ...{{baseType}}.fields(), + {{/isArray}} {{/isPrimitiveType}} {{/allParams}} ], outputFields: [ {{#returnType}} {{^returnTypeIsPrimitive}} + {{^isArray}} ...{{returnType}}.fields('', false), + {{/isArray}} {{/returnTypeIsPrimitive}} {{/returnType}} ], From 5f574614473be0e50cc4cad92c32168cc49a3d65 Mon Sep 17 00:00:00 2001 From: Emanuele Saccomandi Date: Mon, 10 Jul 2023 09:57:53 +0200 Subject: [PATCH 2/9] updated samples --- docs/generators.md | 2 +- docs/generators/zapier.md | 2 +- .../src/Org.OpenAPITools/Model/Apple.cs | 14 +--- .../src/Org.OpenAPITools/Model/FormatTest.cs | 28 +------ ...dPropertiesAndAdditionalPropertiesClass.cs | 7 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 76 +++++++++---------- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +-- .../src/Org.OpenAPITools/Model/Apple.cs | 14 +--- .../src/Org.OpenAPITools/Model/FormatTest.cs | 28 +------ ...dPropertiesAndAdditionalPropertiesClass.cs | 7 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 72 +++++++++--------- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +-- .../src/Org.OpenAPITools/Api/UserApi.cs | 12 +-- .../src/Org.OpenAPITools/Model/Apple.cs | 14 +--- .../src/Org.OpenAPITools/Model/FormatTest.cs | 28 +------ ...dPropertiesAndAdditionalPropertiesClass.cs | 7 +- .../Model/PolymorphicProperty.cs | 6 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 72 +++++++++--------- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +-- .../src/Org.OpenAPITools/Api/UserApi.cs | 12 +-- .../src/Org.OpenAPITools/Model/Apple.cs | 14 +--- .../src/Org.OpenAPITools/Model/FormatTest.cs | 28 +------ ...dPropertiesAndAdditionalPropertiesClass.cs | 7 +- .../Model/PolymorphicProperty.cs | 6 +- .../src/Org.OpenAPITools/Model/Apple.cs | 14 +--- .../src/Org.OpenAPITools/Model/FormatTest.cs | 28 +------ ...dPropertiesAndAdditionalPropertiesClass.cs | 7 +- .../src/Org.OpenAPITools/Model/Apple.cs | 14 +--- .../src/Org.OpenAPITools/Model/FormatTest.cs | 28 +------ ...dPropertiesAndAdditionalPropertiesClass.cs | 7 +- .../src/Org.OpenAPITools/Model/Apple.cs | 14 +--- .../src/Org.OpenAPITools/Model/FormatTest.cs | 28 +------ ...dPropertiesAndAdditionalPropertiesClass.cs | 7 +- .../src/Org.OpenAPITools/Model/Apple.cs | 14 +--- .../src/Org.OpenAPITools/Model/FormatTest.cs | 28 +------ ...dPropertiesAndAdditionalPropertiesClass.cs | 7 +- .../src/Org.OpenAPITools/Model/Apple.cs | 14 +--- .../src/Org.OpenAPITools/Model/FormatTest.cs | 28 +------ ...dPropertiesAndAdditionalPropertiesClass.cs | 7 +- .../src/Org.OpenAPITools/Model/Apple.cs | 14 +--- .../src/Org.OpenAPITools/Model/FormatTest.cs | 28 +------ ...dPropertiesAndAdditionalPropertiesClass.cs | 7 +- .../src/Org.OpenAPITools/Model/Category.cs | 7 +- samples/client/petstore/zapier/apis/PetApi.js | 22 ++++-- .../client/petstore/zapier/apis/StoreApi.js | 2 +- .../client/petstore/zapier/apis/UserApi.js | 12 ++- .../java/org/openapitools/model/Fruit.java | 2 +- .../schema/postman-collection/postman.json | 18 ++--- 48 files changed, 254 insertions(+), 595 deletions(-) diff --git a/docs/generators.md b/docs/generators.md index ca61ed840c42..6b175338702f 100644 --- a/docs/generators.md +++ b/docs/generators.md @@ -74,7 +74,7 @@ The following generators are available: * [typescript-redux-query](generators/typescript-redux-query.md) * [typescript-rxjs](generators/typescript-rxjs.md) * [xojo-client](generators/xojo-client.md) -* [zapier (beta)](generators/zapier.md) +* [zapier](generators/zapier.md) ## SERVER generators diff --git a/docs/generators/zapier.md b/docs/generators/zapier.md index aa6dca2ee845..f054dcd0a6c2 100644 --- a/docs/generators/zapier.md +++ b/docs/generators/zapier.md @@ -7,7 +7,7 @@ title: Documentation for the zapier Generator | Property | Value | Notes | | -------- | ----- | ----- | | generator name | zapier | pass this to the generate command after -g | -| generator stability | BETA | | +| generator stability | STABLE | | | generator type | CLIENT | | | generator default templating engine | mustache | | | helpTxt | Generates a zapier client. | | diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Apple.cs index 74d3c8a0b161..3e683d7bc7cb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Apple.cs @@ -183,20 +183,10 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.Cultivar != null) { - // Cultivar (string) pattern - Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); - } } + } if (this.Origin != null) { - // Origin (string) pattern - Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FormatTest.cs index d0ca5935cc32..58d3f6d34ebc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FormatTest.cs @@ -832,12 +832,7 @@ public override int GetHashCode() } if (this.VarString != null) { - // VarString (string) pattern - Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); - } } + } // Password (string) maxLength if (this.Password != null && this.Password.Length > 64) @@ -852,28 +847,13 @@ public override int GetHashCode() } if (this.PatternWithDigits != null) { - // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); - } } + } if (this.PatternWithDigitsAndDelimiter != null) { - // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); - } } + } if (this.PatternWithBackslash != null) { - // PatternWithBackslash (string) pattern - Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 328a1e2f3f87..24e660398f6b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -253,12 +253,7 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.UuidWithPattern != null) { - // UuidWithPattern (Guid) pattern - Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeApi.cs index 7868e9af6735..6ffeef01e096 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1736,31 +1736,31 @@ public async Task> TestClientModelAsync(ModelClient mod /// Validates the request parameters /// /// - /// + /// /// - /// /// - /// + /// + /// /// - private void ValidateTestEndpointParameters(byte[] varByte, string patternWithoutDelimiter, Option binary, Option varString, Option password, Option callback) + private void ValidateTestEndpointParameters(byte[] varByte, Option callback, Option binary, Option password, string patternWithoutDelimiter, Option varString) { if (varByte == null) throw new ArgumentNullException(nameof(varByte)); - if (patternWithoutDelimiter == null) - throw new ArgumentNullException(nameof(patternWithoutDelimiter)); + if (callback.IsSet && callback.Value == null) + throw new ArgumentNullException(nameof(callback)); if (binary.IsSet && binary.Value == null) throw new ArgumentNullException(nameof(binary)); - if (varString.IsSet && varString.Value == null) - throw new ArgumentNullException(nameof(varString)); - if (password.IsSet && password.Value == null) throw new ArgumentNullException(nameof(password)); - if (callback.IsSet && callback.Value == null) - throw new ArgumentNullException(nameof(callback)); + if (patternWithoutDelimiter == null) + throw new ArgumentNullException(nameof(patternWithoutDelimiter)); + + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString)); } /// @@ -1915,7 +1915,7 @@ public async Task> TestEndpointParametersAsync(byte[] varByt try { - ValidateTestEndpointParameters(varByte, patternWithoutDelimiter, binary, varString, password, callback); + ValidateTestEndpointParameters(varByte, callback, binary, password, patternWithoutDelimiter, varString); FormatTestEndpointParameters(ref varByte, ref number, ref varDouble, ref patternWithoutDelimiter, ref date, ref binary, ref varFloat, ref integer, ref int32, ref int64, ref varString, ref password, ref callback, ref dateTime); @@ -2023,15 +2023,18 @@ public async Task> TestEndpointParametersAsync(byte[] varByt /// /// Validates the request parameters /// + /// /// /// /// - /// - /// /// + /// /// - private void ValidateTestEnumParameters(Option> enumHeaderStringArray, Option> enumQueryStringArray, Option> enumFormStringArray, Option enumHeaderString, Option enumQueryString, Option enumFormString) + private void ValidateTestEnumParameters(Option enumHeaderString, Option> enumHeaderStringArray, Option> enumQueryStringArray, Option> enumFormStringArray, Option enumFormString, Option enumQueryString) { + if (enumHeaderString.IsSet && enumHeaderString.Value == null) + throw new ArgumentNullException(nameof(enumHeaderString)); + if (enumHeaderStringArray.IsSet && enumHeaderStringArray.Value == null) throw new ArgumentNullException(nameof(enumHeaderStringArray)); @@ -2041,14 +2044,11 @@ private void ValidateTestEnumParameters(Option> enumHeaderStringArr if (enumFormStringArray.IsSet && enumFormStringArray.Value == null) throw new ArgumentNullException(nameof(enumFormStringArray)); - if (enumHeaderString.IsSet && enumHeaderString.Value == null) - throw new ArgumentNullException(nameof(enumHeaderString)); + if (enumFormString.IsSet && enumFormString.Value == null) + throw new ArgumentNullException(nameof(enumFormString)); if (enumQueryString.IsSet && enumQueryString.Value == null) throw new ArgumentNullException(nameof(enumQueryString)); - - if (enumFormString.IsSet && enumFormString.Value == null) - throw new ArgumentNullException(nameof(enumFormString)); } /// @@ -2167,7 +2167,7 @@ public async Task> TestEnumParametersAsync(Option> TestJsonFormDataAsync(string param, strin /// /// Validates the request parameters /// - /// - /// - /// - /// /// /// /// + /// + /// + /// + /// /// - private void ValidateTestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, Option notRequiredNotNullable) + private void ValidateTestQueryParameterCollectionFormat(List context, string requiredNotNullable, Option notRequiredNotNullable, List pipe, List ioutil, List url, List http) { + if (context == null) + throw new ArgumentNullException(nameof(context)); + + if (requiredNotNullable == null) + throw new ArgumentNullException(nameof(requiredNotNullable)); + + if (notRequiredNotNullable.IsSet && notRequiredNotNullable.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotNullable)); + if (pipe == null) throw new ArgumentNullException(nameof(pipe)); if (ioutil == null) throw new ArgumentNullException(nameof(ioutil)); - if (http == null) - throw new ArgumentNullException(nameof(http)); - if (url == null) throw new ArgumentNullException(nameof(url)); - if (context == null) - throw new ArgumentNullException(nameof(context)); - - if (requiredNotNullable == null) - throw new ArgumentNullException(nameof(requiredNotNullable)); - - if (notRequiredNotNullable.IsSet && notRequiredNotNullable.Value == null) - throw new ArgumentNullException(nameof(notRequiredNotNullable)); + if (http == null) + throw new ArgumentNullException(nameof(http)); } /// @@ -2865,7 +2865,7 @@ public async Task> TestQueryParameterCollectionFormatAsync(L try { - ValidateTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, requiredNotNullable, notRequiredNotNullable); + ValidateTestQueryParameterCollectionFormat(context, requiredNotNullable, notRequiredNotNullable, pipe, ioutil, url, http); FormatTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, ref requiredNotNullable, ref requiredNullable, ref notRequiredNotNullable, ref notRequiredNullable); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs index eb1c51189b3b..b1cedb94aa2a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs @@ -1429,16 +1429,16 @@ public async Task> UpdatePetWithFormAsync(long petId, Option /// /// Validates the request parameters /// - /// /// + /// /// - private void ValidateUploadFile(Option file, Option additionalMetadata) + private void ValidateUploadFile(Option additionalMetadata, Option file) { - if (file.IsSet && file.Value == null) - throw new ArgumentNullException(nameof(file)); - if (additionalMetadata.IsSet && additionalMetadata.Value == null) throw new ArgumentNullException(nameof(additionalMetadata)); + + if (file.IsSet && file.Value == null) + throw new ArgumentNullException(nameof(file)); } /// @@ -1527,7 +1527,7 @@ public async Task> UploadFileAsync(long petId, Option IValidatableObject.Validate(ValidationContext validationContext) { if (this.Cultivar != null) { - // Cultivar (string) pattern - Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); - } } + } if (this.Origin != null) { - // Origin (string) pattern - Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs index 193939b3374e..1a3918581cab 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs @@ -317,36 +317,16 @@ public override string ToString() } if (this.PatternWithBackslash != null) { - // PatternWithBackslash (string) pattern - Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); - } } + } if (this.PatternWithDigits != null) { - // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); - } } + } if (this.PatternWithDigitsAndDelimiter != null) { - // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); - } } + } if (this.VarString != null) { - // VarString (string) pattern - Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); - } } + } // UnsignedInteger (uint) maximum if (this.UnsignedInteger > (uint)200) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index cd0327b6a594..f56b5f34263e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -103,12 +103,7 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - // UuidWithPattern (Guid) pattern - Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); - } yield break; + yield break; } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeApi.cs index 95491ea8c68b..99d28891c266 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1436,16 +1436,16 @@ public async Task> TestBodyWithFileSchemaAsync(FileSchemaTes /// /// Validates the request parameters /// - /// /// + /// /// - private void ValidateTestBodyWithQueryParams(User user, string query) + private void ValidateTestBodyWithQueryParams(string query, User user) { - if (user == null) - throw new ArgumentNullException(nameof(user)); - if (query == null) throw new ArgumentNullException(nameof(query)); + + if (user == null) + throw new ArgumentNullException(nameof(user)); } /// @@ -1528,7 +1528,7 @@ public async Task> TestBodyWithQueryParamsAsync(User user, s try { - ValidateTestBodyWithQueryParams(user, query); + ValidateTestBodyWithQueryParams(query, user); FormatTestBodyWithQueryParams(user, ref query); @@ -1733,17 +1733,17 @@ public async Task> TestClientModelAsync(ModelClient mod /// /// Validates the request parameters /// - /// + /// /// /// /// - /// /// + /// /// - private void ValidateTestEndpointParameters(byte[] varByte, string patternWithoutDelimiter, Option binary, Option varString, Option password, Option callback) + private void ValidateTestEndpointParameters(Option password, string patternWithoutDelimiter, Option binary, Option varString, Option callback, byte[] varByte) { - if (varByte == null) - throw new ArgumentNullException(nameof(varByte)); + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password)); if (patternWithoutDelimiter == null) throw new ArgumentNullException(nameof(patternWithoutDelimiter)); @@ -1754,11 +1754,11 @@ private void ValidateTestEndpointParameters(byte[] varByte, string patternWithou if (varString.IsSet && varString.Value == null) throw new ArgumentNullException(nameof(varString)); - if (password.IsSet && password.Value == null) - throw new ArgumentNullException(nameof(password)); - if (callback.IsSet && callback.Value == null) throw new ArgumentNullException(nameof(callback)); + + if (varByte == null) + throw new ArgumentNullException(nameof(varByte)); } /// @@ -1913,7 +1913,7 @@ public async Task> TestEndpointParametersAsync(byte[] varByt try { - ValidateTestEndpointParameters(varByte, patternWithoutDelimiter, binary, varString, password, callback); + ValidateTestEndpointParameters(password, patternWithoutDelimiter, binary, varString, callback, varByte); FormatTestEndpointParameters(ref varByte, ref number, ref varDouble, ref patternWithoutDelimiter, ref date, ref binary, ref varFloat, ref integer, ref int32, ref int64, ref varString, ref password, ref callback, ref dateTime); @@ -2021,18 +2021,15 @@ public async Task> TestEndpointParametersAsync(byte[] varByt /// /// Validates the request parameters /// - /// /// /// /// - /// + /// /// + /// /// - private void ValidateTestEnumParameters(Option> enumHeaderStringArray, Option> enumQueryStringArray, Option> enumFormStringArray, Option enumHeaderString, Option enumQueryString, Option enumFormString) + private void ValidateTestEnumParameters(Option> enumQueryStringArray, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumFormString, Option enumQueryString) { - if (enumHeaderStringArray.IsSet && enumHeaderStringArray.Value == null) - throw new ArgumentNullException(nameof(enumHeaderStringArray)); - if (enumQueryStringArray.IsSet && enumQueryStringArray.Value == null) throw new ArgumentNullException(nameof(enumQueryStringArray)); @@ -2042,11 +2039,14 @@ private void ValidateTestEnumParameters(Option> enumHeaderStringArr if (enumHeaderString.IsSet && enumHeaderString.Value == null) throw new ArgumentNullException(nameof(enumHeaderString)); - if (enumQueryString.IsSet && enumQueryString.Value == null) - throw new ArgumentNullException(nameof(enumQueryString)); + if (enumHeaderStringArray.IsSet && enumHeaderStringArray.Value == null) + throw new ArgumentNullException(nameof(enumHeaderStringArray)); if (enumFormString.IsSet && enumFormString.Value == null) throw new ArgumentNullException(nameof(enumFormString)); + + if (enumQueryString.IsSet && enumQueryString.Value == null) + throw new ArgumentNullException(nameof(enumQueryString)); } /// @@ -2165,7 +2165,7 @@ public async Task> TestEnumParametersAsync(Option> TestJsonFormDataAsync(string param, strin /// Validates the request parameters /// /// - /// /// - /// + /// /// + /// /// - /// + /// /// - private void ValidateTestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, Option notRequiredNotNullable) + private void ValidateTestQueryParameterCollectionFormat(List pipe, List http, Option notRequiredNotNullable, List context, List ioutil, string requiredNotNullable, List url) { if (pipe == null) throw new ArgumentNullException(nameof(pipe)); - if (ioutil == null) - throw new ArgumentNullException(nameof(ioutil)); - if (http == null) throw new ArgumentNullException(nameof(http)); - if (url == null) - throw new ArgumentNullException(nameof(url)); + if (notRequiredNotNullable.IsSet && notRequiredNotNullable.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotNullable)); if (context == null) throw new ArgumentNullException(nameof(context)); + if (ioutil == null) + throw new ArgumentNullException(nameof(ioutil)); + if (requiredNotNullable == null) throw new ArgumentNullException(nameof(requiredNotNullable)); - if (notRequiredNotNullable.IsSet && notRequiredNotNullable.Value == null) - throw new ArgumentNullException(nameof(notRequiredNotNullable)); + if (url == null) + throw new ArgumentNullException(nameof(url)); } /// @@ -2863,7 +2863,7 @@ public async Task> TestQueryParameterCollectionFormatAsync(L try { - ValidateTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, requiredNotNullable, notRequiredNotNullable); + ValidateTestQueryParameterCollectionFormat(pipe, http, notRequiredNotNullable, context, ioutil, requiredNotNullable, url); FormatTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, ref requiredNotNullable, ref requiredNullable, ref notRequiredNotNullable, ref notRequiredNullable); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs index 93759837a2e0..6321536be539 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs @@ -1254,16 +1254,16 @@ public async Task> UpdatePetAsync(Pet pet, System.Threading. /// /// Validates the request parameters /// - /// /// + /// /// - private void ValidateUpdatePetWithForm(Option name, Option status) + private void ValidateUpdatePetWithForm(Option status, Option name) { - if (name.IsSet && name.Value == null) - throw new ArgumentNullException(nameof(name)); - if (status.IsSet && status.Value == null) throw new ArgumentNullException(nameof(status)); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name)); } /// @@ -1352,7 +1352,7 @@ public async Task> UpdatePetWithFormAsync(long petId, Option try { - ValidateUpdatePetWithForm(name, status); + ValidateUpdatePetWithForm(status, name); FormatUpdatePetWithForm(ref petId, ref name, ref status); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/UserApi.cs index 24aa1eb01cb4..3d47c7f53c3b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/UserApi.cs @@ -1201,16 +1201,16 @@ public async Task> LogoutUserAsync(System.Threading.Cancella /// /// Validates the request parameters /// - /// /// + /// /// - private void ValidateUpdateUser(User user, string username) + private void ValidateUpdateUser(string username, User user) { - if (user == null) - throw new ArgumentNullException(nameof(user)); - if (username == null) throw new ArgumentNullException(nameof(username)); + + if (user == null) + throw new ArgumentNullException(nameof(user)); } /// @@ -1293,7 +1293,7 @@ public async Task> UpdateUserAsync(User user, string usernam try { - ValidateUpdateUser(user, username); + ValidateUpdateUser(username, user); FormatUpdateUser(user, ref username); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs index 4650e92b669d..27dec76ae662 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs @@ -84,20 +84,10 @@ public override string ToString() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.Cultivar != null) { - // Cultivar (string) pattern - Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); - } } + } if (this.Origin != null) { - // Origin (string) pattern - Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs index c9cba490ff14..d07e9eda69c3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -315,36 +315,16 @@ public override string ToString() } if (this.PatternWithBackslash != null) { - // PatternWithBackslash (string) pattern - Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); - } } + } if (this.PatternWithDigits != null) { - // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); - } } + } if (this.PatternWithDigitsAndDelimiter != null) { - // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); - } } + } if (this.VarString != null) { - // VarString (string) pattern - Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); - } } + } // UnsignedInteger (uint) maximum if (this.UnsignedInteger > (uint)200) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index fb1b11e6ba6f..5ec6b05a8319 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -101,12 +101,7 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - // UuidWithPattern (Guid) pattern - Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); - } yield break; + yield break; } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index 82846ccdd0d4..12a84ed46728 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -77,7 +77,7 @@ internal PolymorphicProperty(List list) /// /// Gets or Sets VarBool /// - public bool? VarBool { get; set; } + public bool VarBool { get; set; } /// /// Gets or Sets VarString @@ -146,7 +146,7 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - bool? varBool = default; + bool varBool = default; string varString = default; Object varObject = default; List list = default; @@ -163,7 +163,7 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) { Utf8JsonReader utf8JsonReaderVarBool = utf8JsonReader; - OpenAPIClientUtils.TryDeserialize(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool); + OpenAPIClientUtils.TryDeserialize(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool); Utf8JsonReader utf8JsonReaderVarString = utf8JsonReader; OpenAPIClientUtils.TryDeserialize(ref utf8JsonReaderVarString, jsonSerializerOptions, out varString); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeApi.cs index 67c82a343707..4a6bc73783da 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1430,16 +1430,16 @@ public async Task> TestBodyWithFileSchemaAsync(FileSchemaTes /// /// Validates the request parameters /// - /// /// + /// /// - private void ValidateTestBodyWithQueryParams(User user, string query) + private void ValidateTestBodyWithQueryParams(string query, User user) { - if (user == null) - throw new ArgumentNullException(nameof(user)); - if (query == null) throw new ArgumentNullException(nameof(query)); + + if (user == null) + throw new ArgumentNullException(nameof(user)); } /// @@ -1522,7 +1522,7 @@ public async Task> TestBodyWithQueryParamsAsync(User user, s try { - ValidateTestBodyWithQueryParams(user, query); + ValidateTestBodyWithQueryParams(query, user); FormatTestBodyWithQueryParams(user, ref query); @@ -1726,17 +1726,17 @@ public async Task> TestClientModelAsync(ModelClient mod /// /// Validates the request parameters /// - /// + /// /// /// /// - /// /// + /// /// - private void ValidateTestEndpointParameters(byte[] varByte, string patternWithoutDelimiter, Option binary, Option varString, Option password, Option callback) + private void ValidateTestEndpointParameters(Option password, string patternWithoutDelimiter, Option binary, Option varString, Option callback, byte[] varByte) { - if (varByte == null) - throw new ArgumentNullException(nameof(varByte)); + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password)); if (patternWithoutDelimiter == null) throw new ArgumentNullException(nameof(patternWithoutDelimiter)); @@ -1747,11 +1747,11 @@ private void ValidateTestEndpointParameters(byte[] varByte, string patternWithou if (varString.IsSet && varString.Value == null) throw new ArgumentNullException(nameof(varString)); - if (password.IsSet && password.Value == null) - throw new ArgumentNullException(nameof(password)); - if (callback.IsSet && callback.Value == null) throw new ArgumentNullException(nameof(callback)); + + if (varByte == null) + throw new ArgumentNullException(nameof(varByte)); } /// @@ -1906,7 +1906,7 @@ public async Task> TestEndpointParametersAsync(byte[] varByt try { - ValidateTestEndpointParameters(varByte, patternWithoutDelimiter, binary, varString, password, callback); + ValidateTestEndpointParameters(password, patternWithoutDelimiter, binary, varString, callback, varByte); FormatTestEndpointParameters(ref varByte, ref number, ref varDouble, ref patternWithoutDelimiter, ref date, ref binary, ref varFloat, ref integer, ref int32, ref int64, ref varString, ref password, ref callback, ref dateTime); @@ -2014,18 +2014,15 @@ public async Task> TestEndpointParametersAsync(byte[] varByt /// /// Validates the request parameters /// - /// /// /// /// - /// + /// /// + /// /// - private void ValidateTestEnumParameters(Option> enumHeaderStringArray, Option> enumQueryStringArray, Option> enumFormStringArray, Option enumHeaderString, Option enumQueryString, Option enumFormString) + private void ValidateTestEnumParameters(Option> enumQueryStringArray, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumFormString, Option enumQueryString) { - if (enumHeaderStringArray.IsSet && enumHeaderStringArray.Value == null) - throw new ArgumentNullException(nameof(enumHeaderStringArray)); - if (enumQueryStringArray.IsSet && enumQueryStringArray.Value == null) throw new ArgumentNullException(nameof(enumQueryStringArray)); @@ -2035,11 +2032,14 @@ private void ValidateTestEnumParameters(Option> enumHeaderStringArr if (enumHeaderString.IsSet && enumHeaderString.Value == null) throw new ArgumentNullException(nameof(enumHeaderString)); - if (enumQueryString.IsSet && enumQueryString.Value == null) - throw new ArgumentNullException(nameof(enumQueryString)); + if (enumHeaderStringArray.IsSet && enumHeaderStringArray.Value == null) + throw new ArgumentNullException(nameof(enumHeaderStringArray)); if (enumFormString.IsSet && enumFormString.Value == null) throw new ArgumentNullException(nameof(enumFormString)); + + if (enumQueryString.IsSet && enumQueryString.Value == null) + throw new ArgumentNullException(nameof(enumQueryString)); } /// @@ -2158,7 +2158,7 @@ public async Task> TestEnumParametersAsync(Option> TestJsonFormDataAsync(string param, strin /// Validates the request parameters /// /// - /// /// - /// + /// /// + /// /// - /// + /// /// - private void ValidateTestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, Option notRequiredNotNullable) + private void ValidateTestQueryParameterCollectionFormat(List pipe, List http, Option notRequiredNotNullable, List context, List ioutil, string requiredNotNullable, List url) { if (pipe == null) throw new ArgumentNullException(nameof(pipe)); - if (ioutil == null) - throw new ArgumentNullException(nameof(ioutil)); - if (http == null) throw new ArgumentNullException(nameof(http)); - if (url == null) - throw new ArgumentNullException(nameof(url)); + if (notRequiredNotNullable.IsSet && notRequiredNotNullable.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotNullable)); if (context == null) throw new ArgumentNullException(nameof(context)); + if (ioutil == null) + throw new ArgumentNullException(nameof(ioutil)); + if (requiredNotNullable == null) throw new ArgumentNullException(nameof(requiredNotNullable)); - if (notRequiredNotNullable.IsSet && notRequiredNotNullable.Value == null) - throw new ArgumentNullException(nameof(notRequiredNotNullable)); + if (url == null) + throw new ArgumentNullException(nameof(url)); } /// @@ -2855,7 +2855,7 @@ public async Task> TestQueryParameterCollectionFormatAsync(L try { - ValidateTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, requiredNotNullable, notRequiredNotNullable); + ValidateTestQueryParameterCollectionFormat(pipe, http, notRequiredNotNullable, context, ioutil, requiredNotNullable, url); FormatTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, ref requiredNotNullable, ref requiredNullable, ref notRequiredNotNullable, ref notRequiredNullable); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs index 3f5d4b0467d3..7c0b69f44372 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs @@ -1250,16 +1250,16 @@ public async Task> UpdatePetAsync(Pet pet, System.Threading. /// /// Validates the request parameters /// - /// /// + /// /// - private void ValidateUpdatePetWithForm(Option name, Option status) + private void ValidateUpdatePetWithForm(Option status, Option name) { - if (name.IsSet && name.Value == null) - throw new ArgumentNullException(nameof(name)); - if (status.IsSet && status.Value == null) throw new ArgumentNullException(nameof(status)); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name)); } /// @@ -1348,7 +1348,7 @@ public async Task> UpdatePetWithFormAsync(long petId, Option try { - ValidateUpdatePetWithForm(name, status); + ValidateUpdatePetWithForm(status, name); FormatUpdatePetWithForm(ref petId, ref name, ref status); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/UserApi.cs index 86d0c81dd43f..a26f9f1fc650 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/UserApi.cs @@ -1197,16 +1197,16 @@ public async Task> LogoutUserAsync(System.Threading.Cancella /// /// Validates the request parameters /// - /// /// + /// /// - private void ValidateUpdateUser(User user, string username) + private void ValidateUpdateUser(string username, User user) { - if (user == null) - throw new ArgumentNullException(nameof(user)); - if (username == null) throw new ArgumentNullException(nameof(username)); + + if (user == null) + throw new ArgumentNullException(nameof(user)); } /// @@ -1289,7 +1289,7 @@ public async Task> UpdateUserAsync(User user, string usernam try { - ValidateUpdateUser(user, username); + ValidateUpdateUser(username, user); FormatUpdateUser(user, ref username); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs index 4650e92b669d..27dec76ae662 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs @@ -84,20 +84,10 @@ public override string ToString() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.Cultivar != null) { - // Cultivar (string) pattern - Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); - } } + } if (this.Origin != null) { - // Origin (string) pattern - Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs index c9cba490ff14..d07e9eda69c3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -315,36 +315,16 @@ public override string ToString() } if (this.PatternWithBackslash != null) { - // PatternWithBackslash (string) pattern - Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); - } } + } if (this.PatternWithDigits != null) { - // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); - } } + } if (this.PatternWithDigitsAndDelimiter != null) { - // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); - } } + } if (this.VarString != null) { - // VarString (string) pattern - Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); - } } + } // UnsignedInteger (uint) maximum if (this.UnsignedInteger > (uint)200) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index fb1b11e6ba6f..5ec6b05a8319 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -101,12 +101,7 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - // UuidWithPattern (Guid) pattern - Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); - } yield break; + yield break; } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index 82846ccdd0d4..12a84ed46728 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -77,7 +77,7 @@ internal PolymorphicProperty(List list) /// /// Gets or Sets VarBool /// - public bool? VarBool { get; set; } + public bool VarBool { get; set; } /// /// Gets or Sets VarString @@ -146,7 +146,7 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - bool? varBool = default; + bool varBool = default; string varString = default; Object varObject = default; List list = default; @@ -163,7 +163,7 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) { Utf8JsonReader utf8JsonReaderVarBool = utf8JsonReader; - OpenAPIClientUtils.TryDeserialize(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool); + OpenAPIClientUtils.TryDeserialize(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool); Utf8JsonReader utf8JsonReaderVarString = utf8JsonReader; OpenAPIClientUtils.TryDeserialize(ref utf8JsonReaderVarString, jsonSerializerOptions, out varString); diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs index 4795903ff73f..d29c40fbf77d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs @@ -140,20 +140,10 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.Cultivar != null) { - // Cultivar (string) pattern - Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); - } } + } if (this.Origin != null) { - // Origin (string) pattern - Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs index 2695f2f4b878..fb3a43905f45 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs @@ -431,12 +431,7 @@ public override int GetHashCode() } if (this.VarString != null) { - // VarString (string) pattern - Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); - } } + } // Password (string) maxLength if (this.Password != null && this.Password.Length > 64) @@ -451,28 +446,13 @@ public override int GetHashCode() } if (this.PatternWithDigits != null) { - // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); - } } + } if (this.PatternWithDigitsAndDelimiter != null) { - // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); - } } + } if (this.PatternWithBackslash != null) { - // PatternWithBackslash (string) pattern - Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 51f21bf2a383..874763c6927e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -166,12 +166,7 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.UuidWithPattern != null) { - // UuidWithPattern (Guid) pattern - Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Apple.cs index f42201cd5ffa..852e6cef906f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Apple.cs @@ -139,20 +139,10 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.Cultivar != null) { - // Cultivar (string) pattern - Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); - } } + } if (this.Origin != null) { - // Origin (string) pattern - Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FormatTest.cs index a135dbe7d98b..738334e7c693 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FormatTest.cs @@ -430,12 +430,7 @@ public override int GetHashCode() } if (this.VarString != null) { - // VarString (string) pattern - Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); - } } + } // Password (string) maxLength if (this.Password != null && this.Password.Length > 64) @@ -450,28 +445,13 @@ public override int GetHashCode() } if (this.PatternWithDigits != null) { - // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); - } } + } if (this.PatternWithDigitsAndDelimiter != null) { - // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); - } } + } if (this.PatternWithBackslash != null) { - // PatternWithBackslash (string) pattern - Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 929349b42128..2ceec3219fdd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -165,12 +165,7 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.UuidWithPattern != null) { - // UuidWithPattern (Guid) pattern - Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Apple.cs index f42201cd5ffa..852e6cef906f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Apple.cs @@ -139,20 +139,10 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.Cultivar != null) { - // Cultivar (string) pattern - Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); - } } + } if (this.Origin != null) { - // Origin (string) pattern - Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/FormatTest.cs index a135dbe7d98b..738334e7c693 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/FormatTest.cs @@ -430,12 +430,7 @@ public override int GetHashCode() } if (this.VarString != null) { - // VarString (string) pattern - Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); - } } + } // Password (string) maxLength if (this.Password != null && this.Password.Length > 64) @@ -450,28 +445,13 @@ public override int GetHashCode() } if (this.PatternWithDigits != null) { - // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); - } } + } if (this.PatternWithDigitsAndDelimiter != null) { - // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); - } } + } if (this.PatternWithBackslash != null) { - // PatternWithBackslash (string) pattern - Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 929349b42128..2ceec3219fdd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -165,12 +165,7 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.UuidWithPattern != null) { - // UuidWithPattern (Guid) pattern - Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Apple.cs index f42201cd5ffa..852e6cef906f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Apple.cs @@ -139,20 +139,10 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.Cultivar != null) { - // Cultivar (string) pattern - Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); - } } + } if (this.Origin != null) { - // Origin (string) pattern - Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FormatTest.cs index a135dbe7d98b..738334e7c693 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -430,12 +430,7 @@ public override int GetHashCode() } if (this.VarString != null) { - // VarString (string) pattern - Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); - } } + } // Password (string) maxLength if (this.Password != null && this.Password.Length > 64) @@ -450,28 +445,13 @@ public override int GetHashCode() } if (this.PatternWithDigits != null) { - // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); - } } + } if (this.PatternWithDigitsAndDelimiter != null) { - // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); - } } + } if (this.PatternWithBackslash != null) { - // PatternWithBackslash (string) pattern - Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 929349b42128..2ceec3219fdd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -165,12 +165,7 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.UuidWithPattern != null) { - // UuidWithPattern (Guid) pattern - Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Apple.cs index f42201cd5ffa..852e6cef906f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Apple.cs @@ -139,20 +139,10 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.Cultivar != null) { - // Cultivar (string) pattern - Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); - } } + } if (this.Origin != null) { - // Origin (string) pattern - Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs index a135dbe7d98b..738334e7c693 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs @@ -430,12 +430,7 @@ public override int GetHashCode() } if (this.VarString != null) { - // VarString (string) pattern - Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); - } } + } // Password (string) maxLength if (this.Password != null && this.Password.Length > 64) @@ -450,28 +445,13 @@ public override int GetHashCode() } if (this.PatternWithDigits != null) { - // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); - } } + } if (this.PatternWithDigitsAndDelimiter != null) { - // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); - } } + } if (this.PatternWithBackslash != null) { - // PatternWithBackslash (string) pattern - Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 929349b42128..2ceec3219fdd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -165,12 +165,7 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.UuidWithPattern != null) { - // UuidWithPattern (Guid) pattern - Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/Apple.cs index 9eb4962e6f8c..46b360a5d7fd 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/Apple.cs @@ -127,20 +127,10 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.Cultivar != null) { - // Cultivar (string) pattern - Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); - } } + } if (this.Origin != null) { - // Origin (string) pattern - Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs index 3ec69a6af858..9fb6f363050f 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -415,12 +415,7 @@ public override int GetHashCode() } if (this.VarString != null) { - // VarString (string) pattern - Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); - } } + } // Password (string) maxLength if (this.Password != null && this.Password.Length > 64) @@ -435,28 +430,13 @@ public override int GetHashCode() } if (this.PatternWithDigits != null) { - // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); - } } + } if (this.PatternWithDigitsAndDelimiter != null) { - // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); - } } + } if (this.PatternWithBackslash != null) { - // PatternWithBackslash (string) pattern - Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 075124bed503..975a3b29adbc 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -153,12 +153,7 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.UuidWithPattern != null) { - // UuidWithPattern (Guid) pattern - Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); - } } + } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Model/Category.cs index dc47fe171f80..6b72d1198afd 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Model/Category.cs @@ -124,12 +124,7 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.Name != null) { - // Name (string) pattern - Regex regexName = new Regex(@"^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$", RegexOptions.CultureInvariant); - if (!regexName.Match(this.Name).Success) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Name, must match a pattern of " + regexName, new [] { "Name" }); - } } + } yield break; } diff --git a/samples/client/petstore/zapier/apis/PetApi.js b/samples/client/petstore/zapier/apis/PetApi.js index 473dcea31c11..12eab471316f 100644 --- a/samples/client/petstore/zapier/apis/PetApi.js +++ b/samples/client/petstore/zapier/apis/PetApi.js @@ -58,7 +58,7 @@ module.exports = { { key: 'petId', label: 'Pet id to delete', - type: '', + type: 'number', required: true, }, { @@ -103,10 +103,13 @@ module.exports = { }, operation: { inputFields: [ - ...string.fields(), + { + key: 'status', + label: 'Status values that need to be considered for filter', + type: 'string', + } ], outputFields: [ - ...array.fields('', false), ], perform: async (z, bundle) => { const options = { @@ -143,10 +146,13 @@ module.exports = { }, operation: { inputFields: [ - ...string.fields(), + { + key: 'tags', + label: 'Tags to filter by', + type: 'string', + } ], outputFields: [ - ...array.fields('', false), ], perform: async (z, bundle) => { const options = { @@ -186,7 +192,7 @@ module.exports = { { key: 'petId', label: 'ID of pet to return', - type: '', + type: 'number', required: true, }, ], @@ -270,7 +276,7 @@ module.exports = { { key: 'petId', label: 'ID of pet that needs to be updated', - type: '', + type: 'number', required: true, }, { @@ -323,7 +329,7 @@ module.exports = { { key: 'petId', label: 'ID of pet to update', - type: '', + type: 'number', required: true, }, { diff --git a/samples/client/petstore/zapier/apis/StoreApi.js b/samples/client/petstore/zapier/apis/StoreApi.js index 0292fa8fb3b3..7371fdf1e7ec 100644 --- a/samples/client/petstore/zapier/apis/StoreApi.js +++ b/samples/client/petstore/zapier/apis/StoreApi.js @@ -96,7 +96,7 @@ module.exports = { { key: 'orderId', label: 'ID of pet that needs to be fetched', - type: '', + type: 'number', required: true, }, ], diff --git a/samples/client/petstore/zapier/apis/UserApi.js b/samples/client/petstore/zapier/apis/UserApi.js index 47b16423539a..c5ec0831dc64 100644 --- a/samples/client/petstore/zapier/apis/UserApi.js +++ b/samples/client/petstore/zapier/apis/UserApi.js @@ -52,7 +52,11 @@ module.exports = { }, operation: { inputFields: [ - ...User.fields(), + { + key: 'User', + label: 'List of user object', + type: 'string', + } ], outputFields: [ ], @@ -91,7 +95,11 @@ module.exports = { }, operation: { inputFields: [ - ...User.fields(), + { + key: 'User', + label: 'List of user object', + type: 'string', + } ], outputFields: [ ], diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Fruit.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Fruit.java index bd1beceb21b8..c3d58677ee9f 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Fruit.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Fruit.java @@ -36,5 +36,5 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen") public interface Fruit { - public FruitType getFruitType(); + public String getFruitType(); } diff --git a/samples/schema/postman-collection/postman.json b/samples/schema/postman-collection/postman.json index ed3485075642..c9e33d612a04 100644 --- a/samples/schema/postman-collection/postman.json +++ b/samples/schema/postman-collection/postman.json @@ -38,8 +38,8 @@ }, { "key": "strCode2", - "value": "", - "disabled": true + "value": "null", + "disabled": false } ], "body": { @@ -149,8 +149,8 @@ }, { "key": "strCode2", - "value": "", - "disabled": true + "value": "null", + "disabled": false } ], "body": { @@ -207,8 +207,8 @@ }, { "key": "Custom-Header", - "value": "", - "disabled": true + "value": "null", + "disabled": false }, { "key": "Another-Custom-Header", @@ -325,17 +325,17 @@ }, { "key": "version", - "value": "v1", + "value": "", "type": "string" }, { "key": "groupId", - "value": "1", + "value": "", "type": "number" }, { "key": "port", - "value": "5000", + "value": "", "type": "string" }, { From f6f637aaac00ef92bb6bf054c5843e373c467e3e Mon Sep 17 00:00:00 2001 From: Emanuele Saccomandi Date: Mon, 10 Jul 2023 10:56:50 +0200 Subject: [PATCH 3/9] added zapier validation action --- .github/workflows/samples-zapier.yaml | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/samples-zapier.yaml diff --git a/.github/workflows/samples-zapier.yaml b/.github/workflows/samples-zapier.yaml new file mode 100644 index 000000000000..5c936cd631b1 --- /dev/null +++ b/.github/workflows/samples-zapier.yaml @@ -0,0 +1,31 @@ +name: Samples Zapier + +on: + push: + branches: + - 'samples/client/petstore/zapier/**' + pull_request: + paths: + - 'samples/client/petstore/zapier/**' + +jobs: + validate: + name: Test zapier generation + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sample: + - samples/client/petstore/zapier + steps: + - uses: actions/checkout@v3 + - name: Setup node + uses: actions/setup-node@v3 + - name: Install dependencies + working-directory: ${{ matrix.sample }} + run: | + npm install -g zapier-platform-cli + npm install + - name: Validate + working-directory: ${{ matrix.sample }} + run: zapier validate \ No newline at end of file From 84519d0b9e3ef8fbfb57ae0a41bef8c1897d4ad4 Mon Sep 17 00:00:00 2001 From: Emanuele Saccomandi Date: Mon, 10 Jul 2023 11:00:40 +0200 Subject: [PATCH 4/9] readded zapier beta tags --- docs/generators.md | 2 +- docs/generators/zapier.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/generators.md b/docs/generators.md index 6b175338702f..ca61ed840c42 100644 --- a/docs/generators.md +++ b/docs/generators.md @@ -74,7 +74,7 @@ The following generators are available: * [typescript-redux-query](generators/typescript-redux-query.md) * [typescript-rxjs](generators/typescript-rxjs.md) * [xojo-client](generators/xojo-client.md) -* [zapier](generators/zapier.md) +* [zapier (beta)](generators/zapier.md) ## SERVER generators diff --git a/docs/generators/zapier.md b/docs/generators/zapier.md index f054dcd0a6c2..aa6dca2ee845 100644 --- a/docs/generators/zapier.md +++ b/docs/generators/zapier.md @@ -7,7 +7,7 @@ title: Documentation for the zapier Generator | Property | Value | Notes | | -------- | ----- | ----- | | generator name | zapier | pass this to the generate command after -g | -| generator stability | STABLE | | +| generator stability | BETA | | | generator type | CLIENT | | | generator default templating engine | mustache | | | helpTxt | Generates a zapier client. | | From 52c682678cf3dcf5d59e9be065db9eaed787b915 Mon Sep 17 00:00:00 2001 From: Emanuele Saccomandi Date: Mon, 10 Jul 2023 11:38:48 +0200 Subject: [PATCH 5/9] fixed zapier validation action --- .github/workflows/samples-zapier.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/samples-zapier.yaml b/.github/workflows/samples-zapier.yaml index 5c936cd631b1..728ebbfd291a 100644 --- a/.github/workflows/samples-zapier.yaml +++ b/.github/workflows/samples-zapier.yaml @@ -24,8 +24,7 @@ jobs: - name: Install dependencies working-directory: ${{ matrix.sample }} run: | - npm install -g zapier-platform-cli npm install - name: Validate working-directory: ${{ matrix.sample }} - run: zapier validate \ No newline at end of file + run: node index.js \ No newline at end of file From e75cc2edf25a009b852822085bfaa9e7949f27cc Mon Sep 17 00:00:00 2001 From: Emanuele Saccomandi Date: Mon, 10 Jul 2023 14:22:45 +0200 Subject: [PATCH 6/9] updated samples --- .../src/Org.OpenAPITools/Model/Apple.cs | 14 +++- .../src/Org.OpenAPITools/Model/FormatTest.cs | 28 ++++++- ...dPropertiesAndAdditionalPropertiesClass.cs | 7 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 76 +++++++++---------- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +-- .../src/Org.OpenAPITools/Model/Apple.cs | 14 +++- .../src/Org.OpenAPITools/Model/FormatTest.cs | 28 ++++++- ...dPropertiesAndAdditionalPropertiesClass.cs | 7 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 72 +++++++++--------- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +-- .../src/Org.OpenAPITools/Api/UserApi.cs | 12 +-- .../src/Org.OpenAPITools/Model/Apple.cs | 14 +++- .../src/Org.OpenAPITools/Model/FormatTest.cs | 28 ++++++- ...dPropertiesAndAdditionalPropertiesClass.cs | 7 +- .../Model/PolymorphicProperty.cs | 6 +- .../src/Org.OpenAPITools/Api/FakeApi.cs | 72 +++++++++--------- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +-- .../src/Org.OpenAPITools/Api/UserApi.cs | 12 +-- .../src/Org.OpenAPITools/Model/Apple.cs | 14 +++- .../src/Org.OpenAPITools/Model/FormatTest.cs | 28 ++++++- ...dPropertiesAndAdditionalPropertiesClass.cs | 7 +- .../Model/PolymorphicProperty.cs | 6 +- .../src/Org.OpenAPITools/Model/Apple.cs | 14 +++- .../src/Org.OpenAPITools/Model/FormatTest.cs | 28 ++++++- ...dPropertiesAndAdditionalPropertiesClass.cs | 7 +- .../src/Org.OpenAPITools/Model/Apple.cs | 14 +++- .../src/Org.OpenAPITools/Model/FormatTest.cs | 28 ++++++- ...dPropertiesAndAdditionalPropertiesClass.cs | 7 +- .../src/Org.OpenAPITools/Model/Apple.cs | 14 +++- .../src/Org.OpenAPITools/Model/FormatTest.cs | 28 ++++++- ...dPropertiesAndAdditionalPropertiesClass.cs | 7 +- .../src/Org.OpenAPITools/Model/Apple.cs | 14 +++- .../src/Org.OpenAPITools/Model/FormatTest.cs | 28 ++++++- ...dPropertiesAndAdditionalPropertiesClass.cs | 7 +- .../src/Org.OpenAPITools/Model/Apple.cs | 14 +++- .../src/Org.OpenAPITools/Model/FormatTest.cs | 28 ++++++- ...dPropertiesAndAdditionalPropertiesClass.cs | 7 +- .../src/Org.OpenAPITools/Model/Apple.cs | 14 +++- .../src/Org.OpenAPITools/Model/FormatTest.cs | 28 ++++++- ...dPropertiesAndAdditionalPropertiesClass.cs | 7 +- .../src/Org.OpenAPITools/Model/Category.cs | 7 +- .../java/org/openapitools/model/Fruit.java | 2 +- .../schema/postman-collection/postman.json | 18 ++--- 43 files changed, 582 insertions(+), 227 deletions(-) diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Apple.cs index 3e683d7bc7cb..74d3c8a0b161 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Apple.cs @@ -183,10 +183,20 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.Cultivar != null) { - } + // Cultivar (string) pattern + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); + if (!regexCultivar.Match(this.Cultivar).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); + } } if (this.Origin != null) { - } + // Origin (string) pattern + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexOrigin.Match(this.Origin).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FormatTest.cs index 58d3f6d34ebc..d0ca5935cc32 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FormatTest.cs @@ -832,7 +832,12 @@ public override int GetHashCode() } if (this.VarString != null) { - } + // VarString (string) pattern + Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexVarString.Match(this.VarString).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); + } } // Password (string) maxLength if (this.Password != null && this.Password.Length > 64) @@ -847,13 +852,28 @@ public override int GetHashCode() } if (this.PatternWithDigits != null) { - } + // PatternWithDigits (string) pattern + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); + } } if (this.PatternWithDigitsAndDelimiter != null) { - } + // PatternWithDigitsAndDelimiter (string) pattern + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); + } } if (this.PatternWithBackslash != null) { - } + // PatternWithBackslash (string) pattern + Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 24e660398f6b..328a1e2f3f87 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -253,7 +253,12 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.UuidWithPattern != null) { - } + // UuidWithPattern (Guid) pattern + Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeApi.cs index 6ffeef01e096..7868e9af6735 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1736,31 +1736,31 @@ public async Task> TestClientModelAsync(ModelClient mod /// Validates the request parameters /// /// - /// - /// - /// /// + /// /// + /// + /// /// - private void ValidateTestEndpointParameters(byte[] varByte, Option callback, Option binary, Option password, string patternWithoutDelimiter, Option varString) + private void ValidateTestEndpointParameters(byte[] varByte, string patternWithoutDelimiter, Option binary, Option varString, Option password, Option callback) { if (varByte == null) throw new ArgumentNullException(nameof(varByte)); - if (callback.IsSet && callback.Value == null) - throw new ArgumentNullException(nameof(callback)); + if (patternWithoutDelimiter == null) + throw new ArgumentNullException(nameof(patternWithoutDelimiter)); if (binary.IsSet && binary.Value == null) throw new ArgumentNullException(nameof(binary)); + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString)); + if (password.IsSet && password.Value == null) throw new ArgumentNullException(nameof(password)); - if (patternWithoutDelimiter == null) - throw new ArgumentNullException(nameof(patternWithoutDelimiter)); - - if (varString.IsSet && varString.Value == null) - throw new ArgumentNullException(nameof(varString)); + if (callback.IsSet && callback.Value == null) + throw new ArgumentNullException(nameof(callback)); } /// @@ -1915,7 +1915,7 @@ public async Task> TestEndpointParametersAsync(byte[] varByt try { - ValidateTestEndpointParameters(varByte, callback, binary, password, patternWithoutDelimiter, varString); + ValidateTestEndpointParameters(varByte, patternWithoutDelimiter, binary, varString, password, callback); 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); @@ -2023,18 +2023,15 @@ public async Task> TestEndpointParametersAsync(byte[] varByt /// /// Validates the request parameters /// - /// /// /// /// - /// + /// /// + /// /// - private void ValidateTestEnumParameters(Option enumHeaderString, Option> enumHeaderStringArray, Option> enumQueryStringArray, Option> enumFormStringArray, Option enumFormString, Option enumQueryString) + private void ValidateTestEnumParameters(Option> enumHeaderStringArray, Option> enumQueryStringArray, Option> enumFormStringArray, Option enumHeaderString, Option enumQueryString, Option enumFormString) { - if (enumHeaderString.IsSet && enumHeaderString.Value == null) - throw new ArgumentNullException(nameof(enumHeaderString)); - if (enumHeaderStringArray.IsSet && enumHeaderStringArray.Value == null) throw new ArgumentNullException(nameof(enumHeaderStringArray)); @@ -2044,11 +2041,14 @@ private void ValidateTestEnumParameters(Option enumHeaderString, Option< if (enumFormStringArray.IsSet && enumFormStringArray.Value == null) throw new ArgumentNullException(nameof(enumFormStringArray)); - if (enumFormString.IsSet && enumFormString.Value == null) - throw new ArgumentNullException(nameof(enumFormString)); + if (enumHeaderString.IsSet && enumHeaderString.Value == null) + throw new ArgumentNullException(nameof(enumHeaderString)); if (enumQueryString.IsSet && enumQueryString.Value == null) throw new ArgumentNullException(nameof(enumQueryString)); + + if (enumFormString.IsSet && enumFormString.Value == null) + throw new ArgumentNullException(nameof(enumFormString)); } /// @@ -2167,7 +2167,7 @@ public async Task> TestEnumParametersAsync(Option> TestJsonFormDataAsync(string param, strin /// /// Validates the request parameters /// - /// - /// - /// /// /// - /// /// + /// + /// + /// + /// /// - private void ValidateTestQueryParameterCollectionFormat(List context, string requiredNotNullable, Option notRequiredNotNullable, List pipe, List ioutil, List url, List http) + private void ValidateTestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, Option notRequiredNotNullable) { - if (context == null) - throw new ArgumentNullException(nameof(context)); - - if (requiredNotNullable == null) - throw new ArgumentNullException(nameof(requiredNotNullable)); - - if (notRequiredNotNullable.IsSet && notRequiredNotNullable.Value == null) - throw new ArgumentNullException(nameof(notRequiredNotNullable)); - if (pipe == null) throw new ArgumentNullException(nameof(pipe)); if (ioutil == null) throw new ArgumentNullException(nameof(ioutil)); + if (http == null) + throw new ArgumentNullException(nameof(http)); + if (url == null) throw new ArgumentNullException(nameof(url)); - if (http == null) - throw new ArgumentNullException(nameof(http)); + if (context == null) + throw new ArgumentNullException(nameof(context)); + + if (requiredNotNullable == null) + throw new ArgumentNullException(nameof(requiredNotNullable)); + + if (notRequiredNotNullable.IsSet && notRequiredNotNullable.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotNullable)); } /// @@ -2865,7 +2865,7 @@ public async Task> TestQueryParameterCollectionFormatAsync(L try { - ValidateTestQueryParameterCollectionFormat(context, requiredNotNullable, notRequiredNotNullable, pipe, ioutil, url, http); + ValidateTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, requiredNotNullable, notRequiredNotNullable); FormatTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, ref requiredNotNullable, ref requiredNullable, ref notRequiredNotNullable, ref notRequiredNullable); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs index b1cedb94aa2a..eb1c51189b3b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Api/PetApi.cs @@ -1429,16 +1429,16 @@ public async Task> UpdatePetWithFormAsync(long petId, Option /// /// Validates the request parameters /// - /// /// + /// /// - private void ValidateUploadFile(Option additionalMetadata, Option file) + private void ValidateUploadFile(Option file, Option additionalMetadata) { - if (additionalMetadata.IsSet && additionalMetadata.Value == null) - throw new ArgumentNullException(nameof(additionalMetadata)); - if (file.IsSet && file.Value == null) throw new ArgumentNullException(nameof(file)); + + if (additionalMetadata.IsSet && additionalMetadata.Value == null) + throw new ArgumentNullException(nameof(additionalMetadata)); } /// @@ -1527,7 +1527,7 @@ public async Task> UploadFileAsync(long petId, Option IValidatableObject.Validate(ValidationContext validationContext) { if (this.Cultivar != null) { - } + // Cultivar (string) pattern + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); + if (!regexCultivar.Match(this.Cultivar).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); + } } if (this.Origin != null) { - } + // Origin (string) pattern + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexOrigin.Match(this.Origin).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs index 1a3918581cab..193939b3374e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs @@ -317,16 +317,36 @@ public override string ToString() } if (this.PatternWithBackslash != null) { - } + // PatternWithBackslash (string) pattern + Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); + } } if (this.PatternWithDigits != null) { - } + // PatternWithDigits (string) pattern + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); + } } if (this.PatternWithDigitsAndDelimiter != null) { - } + // PatternWithDigitsAndDelimiter (string) pattern + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); + } } if (this.VarString != null) { - } + // VarString (string) pattern + Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexVarString.Match(this.VarString).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); + } } // UnsignedInteger (uint) maximum if (this.UnsignedInteger > (uint)200) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index f56b5f34263e..cd0327b6a594 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -103,7 +103,12 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - yield break; + // UuidWithPattern (Guid) pattern + Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); + } yield break; } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeApi.cs index 99d28891c266..95491ea8c68b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1436,16 +1436,16 @@ public async Task> TestBodyWithFileSchemaAsync(FileSchemaTes /// /// Validates the request parameters /// - /// /// + /// /// - private void ValidateTestBodyWithQueryParams(string query, User user) + private void ValidateTestBodyWithQueryParams(User user, string query) { - if (query == null) - throw new ArgumentNullException(nameof(query)); - if (user == null) throw new ArgumentNullException(nameof(user)); + + if (query == null) + throw new ArgumentNullException(nameof(query)); } /// @@ -1528,7 +1528,7 @@ public async Task> TestBodyWithQueryParamsAsync(User user, s try { - ValidateTestBodyWithQueryParams(query, user); + ValidateTestBodyWithQueryParams(user, query); FormatTestBodyWithQueryParams(user, ref query); @@ -1733,17 +1733,17 @@ public async Task> TestClientModelAsync(ModelClient mod /// /// Validates the request parameters /// - /// + /// /// /// /// + /// /// - /// /// - private void ValidateTestEndpointParameters(Option password, string patternWithoutDelimiter, Option binary, Option varString, Option callback, byte[] varByte) + private void ValidateTestEndpointParameters(byte[] varByte, string patternWithoutDelimiter, Option binary, Option varString, Option password, Option callback) { - if (password.IsSet && password.Value == null) - throw new ArgumentNullException(nameof(password)); + if (varByte == null) + throw new ArgumentNullException(nameof(varByte)); if (patternWithoutDelimiter == null) throw new ArgumentNullException(nameof(patternWithoutDelimiter)); @@ -1754,11 +1754,11 @@ private void ValidateTestEndpointParameters(Option password, string patt if (varString.IsSet && varString.Value == null) throw new ArgumentNullException(nameof(varString)); + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password)); + if (callback.IsSet && callback.Value == null) throw new ArgumentNullException(nameof(callback)); - - if (varByte == null) - throw new ArgumentNullException(nameof(varByte)); } /// @@ -1913,7 +1913,7 @@ public async Task> TestEndpointParametersAsync(byte[] varByt try { - ValidateTestEndpointParameters(password, patternWithoutDelimiter, binary, varString, callback, varByte); + ValidateTestEndpointParameters(varByte, patternWithoutDelimiter, binary, varString, password, callback); 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); @@ -2021,15 +2021,18 @@ public async Task> TestEndpointParametersAsync(byte[] varByt /// /// Validates the request parameters /// + /// /// /// /// - /// - /// /// + /// /// - private void ValidateTestEnumParameters(Option> enumQueryStringArray, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumFormString, Option enumQueryString) + private void ValidateTestEnumParameters(Option> enumHeaderStringArray, Option> enumQueryStringArray, Option> enumFormStringArray, Option enumHeaderString, Option enumQueryString, Option enumFormString) { + if (enumHeaderStringArray.IsSet && enumHeaderStringArray.Value == null) + throw new ArgumentNullException(nameof(enumHeaderStringArray)); + if (enumQueryStringArray.IsSet && enumQueryStringArray.Value == null) throw new ArgumentNullException(nameof(enumQueryStringArray)); @@ -2039,14 +2042,11 @@ private void ValidateTestEnumParameters(Option> enumQueryStringArra if (enumHeaderString.IsSet && enumHeaderString.Value == null) throw new ArgumentNullException(nameof(enumHeaderString)); - if (enumHeaderStringArray.IsSet && enumHeaderStringArray.Value == null) - throw new ArgumentNullException(nameof(enumHeaderStringArray)); + if (enumQueryString.IsSet && enumQueryString.Value == null) + throw new ArgumentNullException(nameof(enumQueryString)); if (enumFormString.IsSet && enumFormString.Value == null) throw new ArgumentNullException(nameof(enumFormString)); - - if (enumQueryString.IsSet && enumQueryString.Value == null) - throw new ArgumentNullException(nameof(enumQueryString)); } /// @@ -2165,7 +2165,7 @@ public async Task> TestEnumParametersAsync(Option> TestJsonFormDataAsync(string param, strin /// Validates the request parameters /// /// + /// /// - /// + /// /// - /// /// - /// + /// /// - private void ValidateTestQueryParameterCollectionFormat(List pipe, List http, Option notRequiredNotNullable, List context, List ioutil, string requiredNotNullable, List url) + private void ValidateTestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, Option notRequiredNotNullable) { if (pipe == null) throw new ArgumentNullException(nameof(pipe)); + if (ioutil == null) + throw new ArgumentNullException(nameof(ioutil)); + if (http == null) throw new ArgumentNullException(nameof(http)); - if (notRequiredNotNullable.IsSet && notRequiredNotNullable.Value == null) - throw new ArgumentNullException(nameof(notRequiredNotNullable)); + if (url == null) + throw new ArgumentNullException(nameof(url)); if (context == null) throw new ArgumentNullException(nameof(context)); - if (ioutil == null) - throw new ArgumentNullException(nameof(ioutil)); - if (requiredNotNullable == null) throw new ArgumentNullException(nameof(requiredNotNullable)); - if (url == null) - throw new ArgumentNullException(nameof(url)); + if (notRequiredNotNullable.IsSet && notRequiredNotNullable.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotNullable)); } /// @@ -2863,7 +2863,7 @@ public async Task> TestQueryParameterCollectionFormatAsync(L try { - ValidateTestQueryParameterCollectionFormat(pipe, http, notRequiredNotNullable, context, ioutil, requiredNotNullable, url); + ValidateTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, requiredNotNullable, notRequiredNotNullable); FormatTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, ref requiredNotNullable, ref requiredNullable, ref notRequiredNotNullable, ref notRequiredNullable); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs index 6321536be539..93759837a2e0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/PetApi.cs @@ -1254,16 +1254,16 @@ public async Task> UpdatePetAsync(Pet pet, System.Threading. /// /// Validates the request parameters /// - /// /// + /// /// - private void ValidateUpdatePetWithForm(Option status, Option name) + private void ValidateUpdatePetWithForm(Option name, Option status) { - if (status.IsSet && status.Value == null) - throw new ArgumentNullException(nameof(status)); - if (name.IsSet && name.Value == null) throw new ArgumentNullException(nameof(name)); + + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status)); } /// @@ -1352,7 +1352,7 @@ public async Task> UpdatePetWithFormAsync(long petId, Option try { - ValidateUpdatePetWithForm(status, name); + ValidateUpdatePetWithForm(name, status); FormatUpdatePetWithForm(ref petId, ref name, ref status); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/UserApi.cs index 3d47c7f53c3b..24aa1eb01cb4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Api/UserApi.cs @@ -1201,16 +1201,16 @@ public async Task> LogoutUserAsync(System.Threading.Cancella /// /// Validates the request parameters /// - /// /// + /// /// - private void ValidateUpdateUser(string username, User user) + private void ValidateUpdateUser(User user, string username) { - if (username == null) - throw new ArgumentNullException(nameof(username)); - if (user == null) throw new ArgumentNullException(nameof(user)); + + if (username == null) + throw new ArgumentNullException(nameof(username)); } /// @@ -1293,7 +1293,7 @@ public async Task> UpdateUserAsync(User user, string usernam try { - ValidateUpdateUser(username, user); + ValidateUpdateUser(user, username); FormatUpdateUser(user, ref username); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs index 27dec76ae662..4650e92b669d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs @@ -84,10 +84,20 @@ public override string ToString() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.Cultivar != null) { - } + // Cultivar (string) pattern + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); + if (!regexCultivar.Match(this.Cultivar).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); + } } if (this.Origin != null) { - } + // Origin (string) pattern + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexOrigin.Match(this.Origin).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs index d07e9eda69c3..c9cba490ff14 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -315,16 +315,36 @@ public override string ToString() } if (this.PatternWithBackslash != null) { - } + // PatternWithBackslash (string) pattern + Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); + } } if (this.PatternWithDigits != null) { - } + // PatternWithDigits (string) pattern + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); + } } if (this.PatternWithDigitsAndDelimiter != null) { - } + // PatternWithDigitsAndDelimiter (string) pattern + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); + } } if (this.VarString != null) { - } + // VarString (string) pattern + Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexVarString.Match(this.VarString).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); + } } // UnsignedInteger (uint) maximum if (this.UnsignedInteger > (uint)200) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 5ec6b05a8319..fb1b11e6ba6f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -101,7 +101,12 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - yield break; + // UuidWithPattern (Guid) pattern + Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); + } yield break; } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index 12a84ed46728..82846ccdd0d4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -77,7 +77,7 @@ internal PolymorphicProperty(List list) /// /// Gets or Sets VarBool /// - public bool VarBool { get; set; } + public bool? VarBool { get; set; } /// /// Gets or Sets VarString @@ -146,7 +146,7 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - bool varBool = default; + bool? varBool = default; string varString = default; Object varObject = default; List list = default; @@ -163,7 +163,7 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) { Utf8JsonReader utf8JsonReaderVarBool = utf8JsonReader; - OpenAPIClientUtils.TryDeserialize(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool); + OpenAPIClientUtils.TryDeserialize(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool); Utf8JsonReader utf8JsonReaderVarString = utf8JsonReader; OpenAPIClientUtils.TryDeserialize(ref utf8JsonReaderVarString, jsonSerializerOptions, out varString); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeApi.cs index 4a6bc73783da..67c82a343707 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/FakeApi.cs @@ -1430,16 +1430,16 @@ public async Task> TestBodyWithFileSchemaAsync(FileSchemaTes /// /// Validates the request parameters /// - /// /// + /// /// - private void ValidateTestBodyWithQueryParams(string query, User user) + private void ValidateTestBodyWithQueryParams(User user, string query) { - if (query == null) - throw new ArgumentNullException(nameof(query)); - if (user == null) throw new ArgumentNullException(nameof(user)); + + if (query == null) + throw new ArgumentNullException(nameof(query)); } /// @@ -1522,7 +1522,7 @@ public async Task> TestBodyWithQueryParamsAsync(User user, s try { - ValidateTestBodyWithQueryParams(query, user); + ValidateTestBodyWithQueryParams(user, query); FormatTestBodyWithQueryParams(user, ref query); @@ -1726,17 +1726,17 @@ public async Task> TestClientModelAsync(ModelClient mod /// /// Validates the request parameters /// - /// + /// /// /// /// + /// /// - /// /// - private void ValidateTestEndpointParameters(Option password, string patternWithoutDelimiter, Option binary, Option varString, Option callback, byte[] varByte) + private void ValidateTestEndpointParameters(byte[] varByte, string patternWithoutDelimiter, Option binary, Option varString, Option password, Option callback) { - if (password.IsSet && password.Value == null) - throw new ArgumentNullException(nameof(password)); + if (varByte == null) + throw new ArgumentNullException(nameof(varByte)); if (patternWithoutDelimiter == null) throw new ArgumentNullException(nameof(patternWithoutDelimiter)); @@ -1747,11 +1747,11 @@ private void ValidateTestEndpointParameters(Option password, string patt if (varString.IsSet && varString.Value == null) throw new ArgumentNullException(nameof(varString)); + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password)); + if (callback.IsSet && callback.Value == null) throw new ArgumentNullException(nameof(callback)); - - if (varByte == null) - throw new ArgumentNullException(nameof(varByte)); } /// @@ -1906,7 +1906,7 @@ public async Task> TestEndpointParametersAsync(byte[] varByt try { - ValidateTestEndpointParameters(password, patternWithoutDelimiter, binary, varString, callback, varByte); + ValidateTestEndpointParameters(varByte, patternWithoutDelimiter, binary, varString, password, callback); 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); @@ -2014,15 +2014,18 @@ public async Task> TestEndpointParametersAsync(byte[] varByt /// /// Validates the request parameters /// + /// /// /// /// - /// - /// /// + /// /// - private void ValidateTestEnumParameters(Option> enumQueryStringArray, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumFormString, Option enumQueryString) + private void ValidateTestEnumParameters(Option> enumHeaderStringArray, Option> enumQueryStringArray, Option> enumFormStringArray, Option enumHeaderString, Option enumQueryString, Option enumFormString) { + if (enumHeaderStringArray.IsSet && enumHeaderStringArray.Value == null) + throw new ArgumentNullException(nameof(enumHeaderStringArray)); + if (enumQueryStringArray.IsSet && enumQueryStringArray.Value == null) throw new ArgumentNullException(nameof(enumQueryStringArray)); @@ -2032,14 +2035,11 @@ private void ValidateTestEnumParameters(Option> enumQueryStringArra if (enumHeaderString.IsSet && enumHeaderString.Value == null) throw new ArgumentNullException(nameof(enumHeaderString)); - if (enumHeaderStringArray.IsSet && enumHeaderStringArray.Value == null) - throw new ArgumentNullException(nameof(enumHeaderStringArray)); + if (enumQueryString.IsSet && enumQueryString.Value == null) + throw new ArgumentNullException(nameof(enumQueryString)); if (enumFormString.IsSet && enumFormString.Value == null) throw new ArgumentNullException(nameof(enumFormString)); - - if (enumQueryString.IsSet && enumQueryString.Value == null) - throw new ArgumentNullException(nameof(enumQueryString)); } /// @@ -2158,7 +2158,7 @@ public async Task> TestEnumParametersAsync(Option> TestJsonFormDataAsync(string param, strin /// Validates the request parameters /// /// + /// /// - /// + /// /// - /// /// - /// + /// /// - private void ValidateTestQueryParameterCollectionFormat(List pipe, List http, Option notRequiredNotNullable, List context, List ioutil, string requiredNotNullable, List url) + private void ValidateTestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, Option notRequiredNotNullable) { if (pipe == null) throw new ArgumentNullException(nameof(pipe)); + if (ioutil == null) + throw new ArgumentNullException(nameof(ioutil)); + if (http == null) throw new ArgumentNullException(nameof(http)); - if (notRequiredNotNullable.IsSet && notRequiredNotNullable.Value == null) - throw new ArgumentNullException(nameof(notRequiredNotNullable)); + if (url == null) + throw new ArgumentNullException(nameof(url)); if (context == null) throw new ArgumentNullException(nameof(context)); - if (ioutil == null) - throw new ArgumentNullException(nameof(ioutil)); - if (requiredNotNullable == null) throw new ArgumentNullException(nameof(requiredNotNullable)); - if (url == null) - throw new ArgumentNullException(nameof(url)); + if (notRequiredNotNullable.IsSet && notRequiredNotNullable.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotNullable)); } /// @@ -2855,7 +2855,7 @@ public async Task> TestQueryParameterCollectionFormatAsync(L try { - ValidateTestQueryParameterCollectionFormat(pipe, http, notRequiredNotNullable, context, ioutil, requiredNotNullable, url); + ValidateTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, requiredNotNullable, notRequiredNotNullable); FormatTestQueryParameterCollectionFormat(pipe, ioutil, http, url, context, ref requiredNotNullable, ref requiredNullable, ref notRequiredNotNullable, ref notRequiredNullable); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs index 7c0b69f44372..3f5d4b0467d3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/PetApi.cs @@ -1250,16 +1250,16 @@ public async Task> UpdatePetAsync(Pet pet, System.Threading. /// /// Validates the request parameters /// - /// /// + /// /// - private void ValidateUpdatePetWithForm(Option status, Option name) + private void ValidateUpdatePetWithForm(Option name, Option status) { - if (status.IsSet && status.Value == null) - throw new ArgumentNullException(nameof(status)); - if (name.IsSet && name.Value == null) throw new ArgumentNullException(nameof(name)); + + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status)); } /// @@ -1348,7 +1348,7 @@ public async Task> UpdatePetWithFormAsync(long petId, Option try { - ValidateUpdatePetWithForm(status, name); + ValidateUpdatePetWithForm(name, status); FormatUpdatePetWithForm(ref petId, ref name, ref status); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/UserApi.cs index a26f9f1fc650..86d0c81dd43f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Api/UserApi.cs @@ -1197,16 +1197,16 @@ public async Task> LogoutUserAsync(System.Threading.Cancella /// /// Validates the request parameters /// - /// /// + /// /// - private void ValidateUpdateUser(string username, User user) + private void ValidateUpdateUser(User user, string username) { - if (username == null) - throw new ArgumentNullException(nameof(username)); - if (user == null) throw new ArgumentNullException(nameof(user)); + + if (username == null) + throw new ArgumentNullException(nameof(username)); } /// @@ -1289,7 +1289,7 @@ public async Task> UpdateUserAsync(User user, string usernam try { - ValidateUpdateUser(username, user); + ValidateUpdateUser(user, username); FormatUpdateUser(user, ref username); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs index 27dec76ae662..4650e92b669d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs @@ -84,10 +84,20 @@ public override string ToString() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.Cultivar != null) { - } + // Cultivar (string) pattern + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); + if (!regexCultivar.Match(this.Cultivar).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); + } } if (this.Origin != null) { - } + // Origin (string) pattern + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexOrigin.Match(this.Origin).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs index d07e9eda69c3..c9cba490ff14 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -315,16 +315,36 @@ public override string ToString() } if (this.PatternWithBackslash != null) { - } + // PatternWithBackslash (string) pattern + Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); + } } if (this.PatternWithDigits != null) { - } + // PatternWithDigits (string) pattern + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); + } } if (this.PatternWithDigitsAndDelimiter != null) { - } + // PatternWithDigitsAndDelimiter (string) pattern + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); + } } if (this.VarString != null) { - } + // VarString (string) pattern + Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexVarString.Match(this.VarString).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); + } } // UnsignedInteger (uint) maximum if (this.UnsignedInteger > (uint)200) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 5ec6b05a8319..fb1b11e6ba6f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -101,7 +101,12 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - yield break; + // UuidWithPattern (Guid) pattern + Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); + } yield break; } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index 12a84ed46728..82846ccdd0d4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -77,7 +77,7 @@ internal PolymorphicProperty(List list) /// /// Gets or Sets VarBool /// - public bool VarBool { get; set; } + public bool? VarBool { get; set; } /// /// Gets or Sets VarString @@ -146,7 +146,7 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - bool varBool = default; + bool? varBool = default; string varString = default; Object varObject = default; List list = default; @@ -163,7 +163,7 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) { Utf8JsonReader utf8JsonReaderVarBool = utf8JsonReader; - OpenAPIClientUtils.TryDeserialize(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool); + OpenAPIClientUtils.TryDeserialize(ref utf8JsonReaderVarBool, jsonSerializerOptions, out varBool); Utf8JsonReader utf8JsonReaderVarString = utf8JsonReader; OpenAPIClientUtils.TryDeserialize(ref utf8JsonReaderVarString, jsonSerializerOptions, out varString); diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs index d29c40fbf77d..4795903ff73f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs @@ -140,10 +140,20 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.Cultivar != null) { - } + // Cultivar (string) pattern + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); + if (!regexCultivar.Match(this.Cultivar).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); + } } if (this.Origin != null) { - } + // Origin (string) pattern + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexOrigin.Match(this.Origin).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs index fb3a43905f45..2695f2f4b878 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs @@ -431,7 +431,12 @@ public override int GetHashCode() } if (this.VarString != null) { - } + // VarString (string) pattern + Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexVarString.Match(this.VarString).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); + } } // Password (string) maxLength if (this.Password != null && this.Password.Length > 64) @@ -446,13 +451,28 @@ public override int GetHashCode() } if (this.PatternWithDigits != null) { - } + // PatternWithDigits (string) pattern + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); + } } if (this.PatternWithDigitsAndDelimiter != null) { - } + // PatternWithDigitsAndDelimiter (string) pattern + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); + } } if (this.PatternWithBackslash != null) { - } + // PatternWithBackslash (string) pattern + Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 874763c6927e..51f21bf2a383 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -166,7 +166,12 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.UuidWithPattern != null) { - } + // UuidWithPattern (Guid) pattern + Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Apple.cs index 852e6cef906f..f42201cd5ffa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Apple.cs @@ -139,10 +139,20 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.Cultivar != null) { - } + // Cultivar (string) pattern + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); + if (!regexCultivar.Match(this.Cultivar).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); + } } if (this.Origin != null) { - } + // Origin (string) pattern + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexOrigin.Match(this.Origin).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FormatTest.cs index 738334e7c693..a135dbe7d98b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FormatTest.cs @@ -430,7 +430,12 @@ public override int GetHashCode() } if (this.VarString != null) { - } + // VarString (string) pattern + Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexVarString.Match(this.VarString).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); + } } // Password (string) maxLength if (this.Password != null && this.Password.Length > 64) @@ -445,13 +450,28 @@ public override int GetHashCode() } if (this.PatternWithDigits != null) { - } + // PatternWithDigits (string) pattern + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); + } } if (this.PatternWithDigitsAndDelimiter != null) { - } + // PatternWithDigitsAndDelimiter (string) pattern + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); + } } if (this.PatternWithBackslash != null) { - } + // PatternWithBackslash (string) pattern + Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 2ceec3219fdd..929349b42128 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -165,7 +165,12 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.UuidWithPattern != null) { - } + // UuidWithPattern (Guid) pattern + Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Apple.cs index 852e6cef906f..f42201cd5ffa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Apple.cs @@ -139,10 +139,20 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.Cultivar != null) { - } + // Cultivar (string) pattern + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); + if (!regexCultivar.Match(this.Cultivar).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); + } } if (this.Origin != null) { - } + // Origin (string) pattern + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexOrigin.Match(this.Origin).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/FormatTest.cs index 738334e7c693..a135dbe7d98b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/FormatTest.cs @@ -430,7 +430,12 @@ public override int GetHashCode() } if (this.VarString != null) { - } + // VarString (string) pattern + Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexVarString.Match(this.VarString).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); + } } // Password (string) maxLength if (this.Password != null && this.Password.Length > 64) @@ -445,13 +450,28 @@ public override int GetHashCode() } if (this.PatternWithDigits != null) { - } + // PatternWithDigits (string) pattern + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); + } } if (this.PatternWithDigitsAndDelimiter != null) { - } + // PatternWithDigitsAndDelimiter (string) pattern + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); + } } if (this.PatternWithBackslash != null) { - } + // PatternWithBackslash (string) pattern + Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 2ceec3219fdd..929349b42128 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -165,7 +165,12 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.UuidWithPattern != null) { - } + // UuidWithPattern (Guid) pattern + Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Apple.cs index 852e6cef906f..f42201cd5ffa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Apple.cs @@ -139,10 +139,20 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.Cultivar != null) { - } + // Cultivar (string) pattern + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); + if (!regexCultivar.Match(this.Cultivar).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); + } } if (this.Origin != null) { - } + // Origin (string) pattern + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexOrigin.Match(this.Origin).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FormatTest.cs index 738334e7c693..a135dbe7d98b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -430,7 +430,12 @@ public override int GetHashCode() } if (this.VarString != null) { - } + // VarString (string) pattern + Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexVarString.Match(this.VarString).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); + } } // Password (string) maxLength if (this.Password != null && this.Password.Length > 64) @@ -445,13 +450,28 @@ public override int GetHashCode() } if (this.PatternWithDigits != null) { - } + // PatternWithDigits (string) pattern + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); + } } if (this.PatternWithDigitsAndDelimiter != null) { - } + // PatternWithDigitsAndDelimiter (string) pattern + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); + } } if (this.PatternWithBackslash != null) { - } + // PatternWithBackslash (string) pattern + Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 2ceec3219fdd..929349b42128 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -165,7 +165,12 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.UuidWithPattern != null) { - } + // UuidWithPattern (Guid) pattern + Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Apple.cs index 852e6cef906f..f42201cd5ffa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Apple.cs @@ -139,10 +139,20 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.Cultivar != null) { - } + // Cultivar (string) pattern + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); + if (!regexCultivar.Match(this.Cultivar).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); + } } if (this.Origin != null) { - } + // Origin (string) pattern + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexOrigin.Match(this.Origin).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs index 738334e7c693..a135dbe7d98b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs @@ -430,7 +430,12 @@ public override int GetHashCode() } if (this.VarString != null) { - } + // VarString (string) pattern + Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexVarString.Match(this.VarString).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); + } } // Password (string) maxLength if (this.Password != null && this.Password.Length > 64) @@ -445,13 +450,28 @@ public override int GetHashCode() } if (this.PatternWithDigits != null) { - } + // PatternWithDigits (string) pattern + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); + } } if (this.PatternWithDigitsAndDelimiter != null) { - } + // PatternWithDigitsAndDelimiter (string) pattern + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); + } } if (this.PatternWithBackslash != null) { - } + // PatternWithBackslash (string) pattern + Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 2ceec3219fdd..929349b42128 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -165,7 +165,12 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.UuidWithPattern != null) { - } + // UuidWithPattern (Guid) pattern + Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/Apple.cs index 46b360a5d7fd..9eb4962e6f8c 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/Apple.cs @@ -127,10 +127,20 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.Cultivar != null) { - } + // Cultivar (string) pattern + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); + if (!regexCultivar.Match(this.Cultivar).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); + } } if (this.Origin != null) { - } + // Origin (string) pattern + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexOrigin.Match(this.Origin).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs index 9fb6f363050f..3ec69a6af858 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -415,7 +415,12 @@ public override int GetHashCode() } if (this.VarString != null) { - } + // VarString (string) pattern + Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexVarString.Match(this.VarString).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); + } } // Password (string) maxLength if (this.Password != null && this.Password.Length > 64) @@ -430,13 +435,28 @@ public override int GetHashCode() } if (this.PatternWithDigits != null) { - } + // PatternWithDigits (string) pattern + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); + } } if (this.PatternWithDigitsAndDelimiter != null) { - } + // PatternWithDigitsAndDelimiter (string) pattern + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); + } } if (this.PatternWithBackslash != null) { - } + // PatternWithBackslash (string) pattern + Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 975a3b29adbc..075124bed503 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -153,7 +153,12 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.UuidWithPattern != null) { - } + // UuidWithPattern (Guid) pattern + Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); + } } yield break; } diff --git a/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Model/Category.cs index 6b72d1198afd..dc47fe171f80 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Model/Category.cs @@ -124,7 +124,12 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { if (this.Name != null) { - } + // Name (string) pattern + Regex regexName = new Regex(@"^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$", RegexOptions.CultureInvariant); + if (!regexName.Match(this.Name).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Name, must match a pattern of " + regexName, new [] { "Name" }); + } } yield break; } diff --git a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Fruit.java b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Fruit.java index c3d58677ee9f..bd1beceb21b8 100644 --- a/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Fruit.java +++ b/samples/openapi3/server/petstore/spring-boot-oneof/src/main/java/org/openapitools/model/Fruit.java @@ -36,5 +36,5 @@ @Generated(value = "org.openapitools.codegen.languages.SpringCodegen") public interface Fruit { - public String getFruitType(); + public FruitType getFruitType(); } diff --git a/samples/schema/postman-collection/postman.json b/samples/schema/postman-collection/postman.json index c9e33d612a04..ed3485075642 100644 --- a/samples/schema/postman-collection/postman.json +++ b/samples/schema/postman-collection/postman.json @@ -38,8 +38,8 @@ }, { "key": "strCode2", - "value": "null", - "disabled": false + "value": "", + "disabled": true } ], "body": { @@ -149,8 +149,8 @@ }, { "key": "strCode2", - "value": "null", - "disabled": false + "value": "", + "disabled": true } ], "body": { @@ -207,8 +207,8 @@ }, { "key": "Custom-Header", - "value": "null", - "disabled": false + "value": "", + "disabled": true }, { "key": "Another-Custom-Header", @@ -325,17 +325,17 @@ }, { "key": "version", - "value": "", + "value": "v1", "type": "string" }, { "key": "groupId", - "value": "", + "value": "1", "type": "number" }, { "key": "port", - "value": "", + "value": "5000", "type": "string" }, { From 48a9d355bbf1bb990e5c204b64d9b2e531f60f23 Mon Sep 17 00:00:00 2001 From: Emanuele Saccomandi Date: Tue, 18 Jul 2023 14:50:29 +0200 Subject: [PATCH 7/9] improved zapier api names --- .../openapi-generator/src/main/resources/zapier/api.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/openapi-generator/src/main/resources/zapier/api.mustache b/modules/openapi-generator/src/main/resources/zapier/api.mustache index ce417d39c4a3..437e95255061 100644 --- a/modules/openapi-generator/src/main/resources/zapier/api.mustache +++ b/modules/openapi-generator/src/main/resources/zapier/api.mustache @@ -15,7 +15,7 @@ module.exports = { {{#operation}} {{operationId}}: { key: '{{operationId}}', - noun: '{{baseName}}', + noun: '{{summary}}', display: { label: '{{operationId}}', description: '{{#notes}}{{.}}{{/notes}}', From f4cea38371152dff51fe2f3b519f0ea5a052259e Mon Sep 17 00:00:00 2001 From: Emanuele Saccomandi Date: Tue, 18 Jul 2023 15:20:00 +0200 Subject: [PATCH 8/9] updated samples --- samples/client/petstore/zapier/apis/PetApi.js | 16 ++++++++-------- samples/client/petstore/zapier/apis/StoreApi.js | 8 ++++---- samples/client/petstore/zapier/apis/UserApi.js | 16 ++++++++-------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/samples/client/petstore/zapier/apis/PetApi.js b/samples/client/petstore/zapier/apis/PetApi.js index 12eab471316f..67ef560e5b02 100644 --- a/samples/client/petstore/zapier/apis/PetApi.js +++ b/samples/client/petstore/zapier/apis/PetApi.js @@ -7,7 +7,7 @@ const FormData = require('form-data'); module.exports = { addPet: { key: 'addPet', - noun: 'Pet', + noun: 'Add a new pet to the store', display: { label: 'addPet', description: '', @@ -47,7 +47,7 @@ module.exports = { }, deletePet: { key: 'deletePet', - noun: 'Pet', + noun: 'Deletes a pet', display: { label: 'deletePet', description: '', @@ -95,7 +95,7 @@ module.exports = { }, findPetsByStatus: { key: 'findPetsByStatus', - noun: 'Pet', + noun: 'Finds Pets by status', display: { label: 'findPetsByStatus', description: 'Multiple status values can be provided with comma separated strings', @@ -138,7 +138,7 @@ module.exports = { }, findPetsByTags: { key: 'findPetsByTags', - noun: 'Pet', + noun: 'Finds Pets by tags', display: { label: 'findPetsByTags', description: 'Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.', @@ -181,7 +181,7 @@ module.exports = { }, getPetById: { key: 'getPetById', - noun: 'Pet', + noun: 'Find pet by ID', display: { label: 'getPetById', description: 'Returns a single pet', @@ -225,7 +225,7 @@ module.exports = { }, updatePet: { key: 'updatePet', - noun: 'Pet', + noun: 'Update an existing pet', display: { label: 'updatePet', description: '', @@ -265,7 +265,7 @@ module.exports = { }, updatePetWithForm: { key: 'updatePetWithForm', - noun: 'Pet', + noun: 'Updates a pet in the store with form data', display: { label: 'updatePetWithForm', description: '', @@ -318,7 +318,7 @@ module.exports = { }, uploadFile: { key: 'uploadFile', - noun: 'Pet', + noun: 'uploads an image', display: { label: 'uploadFile', description: '', diff --git a/samples/client/petstore/zapier/apis/StoreApi.js b/samples/client/petstore/zapier/apis/StoreApi.js index 7371fdf1e7ec..3f42b248156e 100644 --- a/samples/client/petstore/zapier/apis/StoreApi.js +++ b/samples/client/petstore/zapier/apis/StoreApi.js @@ -5,7 +5,7 @@ const utils = require('../utils/utils'); module.exports = { deleteOrder: { key: 'deleteOrder', - noun: 'Store', + noun: 'Delete purchase order by ID', display: { label: 'deleteOrder', description: 'For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors', @@ -48,7 +48,7 @@ module.exports = { }, getInventory: { key: 'getInventory', - noun: 'Store', + noun: 'Returns pet inventories by status', display: { label: 'getInventory', description: 'Returns a map of status codes to quantities', @@ -85,7 +85,7 @@ module.exports = { }, getOrderById: { key: 'getOrderById', - noun: 'Store', + noun: 'Find purchase order by ID', display: { label: 'getOrderById', description: 'For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions', @@ -129,7 +129,7 @@ module.exports = { }, placeOrder: { key: 'placeOrder', - noun: 'Store', + noun: 'Place an order for a pet', display: { label: 'placeOrder', description: '', diff --git a/samples/client/petstore/zapier/apis/UserApi.js b/samples/client/petstore/zapier/apis/UserApi.js index c5ec0831dc64..b0dca3084372 100644 --- a/samples/client/petstore/zapier/apis/UserApi.js +++ b/samples/client/petstore/zapier/apis/UserApi.js @@ -5,7 +5,7 @@ const utils = require('../utils/utils'); module.exports = { createUser: { key: 'createUser', - noun: 'User', + noun: 'Create user', display: { label: 'createUser', description: 'This can only be done by the logged in user.', @@ -44,7 +44,7 @@ module.exports = { }, createUsersWithArrayInput: { key: 'createUsersWithArrayInput', - noun: 'User', + noun: 'Creates list of users with given input array', display: { label: 'createUsersWithArrayInput', description: '', @@ -87,7 +87,7 @@ module.exports = { }, createUsersWithListInput: { key: 'createUsersWithListInput', - noun: 'User', + noun: 'Creates list of users with given input array', display: { label: 'createUsersWithListInput', description: '', @@ -130,7 +130,7 @@ module.exports = { }, deleteUser: { key: 'deleteUser', - noun: 'User', + noun: 'Delete user', display: { label: 'deleteUser', description: 'This can only be done by the logged in user.', @@ -173,7 +173,7 @@ module.exports = { }, getUserByName: { key: 'getUserByName', - noun: 'User', + noun: 'Get user by user name', display: { label: 'getUserByName', description: '', @@ -217,7 +217,7 @@ module.exports = { }, loginUser: { key: 'loginUser', - noun: 'User', + noun: 'Logs user into the system', display: { label: 'loginUser', description: '', @@ -268,7 +268,7 @@ module.exports = { }, logoutUser: { key: 'logoutUser', - noun: 'User', + noun: 'Logs out current logged in user session', display: { label: 'logoutUser', description: '', @@ -305,7 +305,7 @@ module.exports = { }, updateUser: { key: 'updateUser', - noun: 'User', + noun: 'Updated user', display: { label: 'updateUser', description: 'This can only be done by the logged in user.', From b15f558b29bc4915a3ca5cbed977ffa33b4c229d Mon Sep 17 00:00:00 2001 From: Emanuele Saccomandi Date: Tue, 18 Jul 2023 15:52:54 +0200 Subject: [PATCH 9/9] fixed zapier noun and label --- .../src/main/resources/zapier/api.mustache | 4 +-- samples/client/petstore/zapier/apis/PetApi.js | 32 +++++++++---------- .../client/petstore/zapier/apis/StoreApi.js | 16 +++++----- .../client/petstore/zapier/apis/UserApi.js | 32 +++++++++---------- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/zapier/api.mustache b/modules/openapi-generator/src/main/resources/zapier/api.mustache index 437e95255061..cb56c783b93b 100644 --- a/modules/openapi-generator/src/main/resources/zapier/api.mustache +++ b/modules/openapi-generator/src/main/resources/zapier/api.mustache @@ -15,9 +15,9 @@ module.exports = { {{#operation}} {{operationId}}: { key: '{{operationId}}', - noun: '{{summary}}', + noun: '{{#tags}}{{name}}{{/tags}}', display: { - label: '{{operationId}}', + label: '{{summary}}', description: '{{#notes}}{{.}}{{/notes}}', hidden: false, }, diff --git a/samples/client/petstore/zapier/apis/PetApi.js b/samples/client/petstore/zapier/apis/PetApi.js index 67ef560e5b02..f5a3465c922c 100644 --- a/samples/client/petstore/zapier/apis/PetApi.js +++ b/samples/client/petstore/zapier/apis/PetApi.js @@ -7,9 +7,9 @@ const FormData = require('form-data'); module.exports = { addPet: { key: 'addPet', - noun: 'Add a new pet to the store', + noun: 'pet', display: { - label: 'addPet', + label: 'Add a new pet to the store', description: '', hidden: false, }, @@ -47,9 +47,9 @@ module.exports = { }, deletePet: { key: 'deletePet', - noun: 'Deletes a pet', + noun: 'pet', display: { - label: 'deletePet', + label: 'Deletes a pet', description: '', hidden: false, }, @@ -95,9 +95,9 @@ module.exports = { }, findPetsByStatus: { key: 'findPetsByStatus', - noun: 'Finds Pets by status', + noun: 'pet', display: { - label: 'findPetsByStatus', + label: 'Finds Pets by status', description: 'Multiple status values can be provided with comma separated strings', hidden: false, }, @@ -138,9 +138,9 @@ module.exports = { }, findPetsByTags: { key: 'findPetsByTags', - noun: 'Finds Pets by tags', + noun: 'pet', display: { - label: 'findPetsByTags', + label: 'Finds Pets by tags', description: 'Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.', hidden: false, }, @@ -181,9 +181,9 @@ module.exports = { }, getPetById: { key: 'getPetById', - noun: 'Find pet by ID', + noun: 'pet', display: { - label: 'getPetById', + label: 'Find pet by ID', description: 'Returns a single pet', hidden: false, }, @@ -225,9 +225,9 @@ module.exports = { }, updatePet: { key: 'updatePet', - noun: 'Update an existing pet', + noun: 'pet', display: { - label: 'updatePet', + label: 'Update an existing pet', description: '', hidden: false, }, @@ -265,9 +265,9 @@ module.exports = { }, updatePetWithForm: { key: 'updatePetWithForm', - noun: 'Updates a pet in the store with form data', + noun: 'pet', display: { - label: 'updatePetWithForm', + label: 'Updates a pet in the store with form data', description: '', hidden: false, }, @@ -318,9 +318,9 @@ module.exports = { }, uploadFile: { key: 'uploadFile', - noun: 'uploads an image', + noun: 'pet', display: { - label: 'uploadFile', + label: 'uploads an image', description: '', hidden: false, }, diff --git a/samples/client/petstore/zapier/apis/StoreApi.js b/samples/client/petstore/zapier/apis/StoreApi.js index 3f42b248156e..da883c1377a0 100644 --- a/samples/client/petstore/zapier/apis/StoreApi.js +++ b/samples/client/petstore/zapier/apis/StoreApi.js @@ -5,9 +5,9 @@ const utils = require('../utils/utils'); module.exports = { deleteOrder: { key: 'deleteOrder', - noun: 'Delete purchase order by ID', + noun: 'store', display: { - label: 'deleteOrder', + label: 'Delete purchase order by ID', description: 'For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors', hidden: false, }, @@ -48,9 +48,9 @@ module.exports = { }, getInventory: { key: 'getInventory', - noun: 'Returns pet inventories by status', + noun: 'store', display: { - label: 'getInventory', + label: 'Returns pet inventories by status', description: 'Returns a map of status codes to quantities', hidden: false, }, @@ -85,9 +85,9 @@ module.exports = { }, getOrderById: { key: 'getOrderById', - noun: 'Find purchase order by ID', + noun: 'store', display: { - label: 'getOrderById', + label: 'Find purchase order by ID', description: 'For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions', hidden: false, }, @@ -129,9 +129,9 @@ module.exports = { }, placeOrder: { key: 'placeOrder', - noun: 'Place an order for a pet', + noun: 'store', display: { - label: 'placeOrder', + label: 'Place an order for a pet', description: '', hidden: false, }, diff --git a/samples/client/petstore/zapier/apis/UserApi.js b/samples/client/petstore/zapier/apis/UserApi.js index b0dca3084372..aac909ffd1be 100644 --- a/samples/client/petstore/zapier/apis/UserApi.js +++ b/samples/client/petstore/zapier/apis/UserApi.js @@ -5,9 +5,9 @@ const utils = require('../utils/utils'); module.exports = { createUser: { key: 'createUser', - noun: 'Create user', + noun: 'user', display: { - label: 'createUser', + label: 'Create user', description: 'This can only be done by the logged in user.', hidden: false, }, @@ -44,9 +44,9 @@ module.exports = { }, createUsersWithArrayInput: { key: 'createUsersWithArrayInput', - noun: 'Creates list of users with given input array', + noun: 'user', display: { - label: 'createUsersWithArrayInput', + label: 'Creates list of users with given input array', description: '', hidden: false, }, @@ -87,9 +87,9 @@ module.exports = { }, createUsersWithListInput: { key: 'createUsersWithListInput', - noun: 'Creates list of users with given input array', + noun: 'user', display: { - label: 'createUsersWithListInput', + label: 'Creates list of users with given input array', description: '', hidden: false, }, @@ -130,9 +130,9 @@ module.exports = { }, deleteUser: { key: 'deleteUser', - noun: 'Delete user', + noun: 'user', display: { - label: 'deleteUser', + label: 'Delete user', description: 'This can only be done by the logged in user.', hidden: false, }, @@ -173,9 +173,9 @@ module.exports = { }, getUserByName: { key: 'getUserByName', - noun: 'Get user by user name', + noun: 'user', display: { - label: 'getUserByName', + label: 'Get user by user name', description: '', hidden: false, }, @@ -217,9 +217,9 @@ module.exports = { }, loginUser: { key: 'loginUser', - noun: 'Logs user into the system', + noun: 'user', display: { - label: 'loginUser', + label: 'Logs user into the system', description: '', hidden: false, }, @@ -268,9 +268,9 @@ module.exports = { }, logoutUser: { key: 'logoutUser', - noun: 'Logs out current logged in user session', + noun: 'user', display: { - label: 'logoutUser', + label: 'Logs out current logged in user session', description: '', hidden: false, }, @@ -305,9 +305,9 @@ module.exports = { }, updateUser: { key: 'updateUser', - noun: 'Updated user', + noun: 'user', display: { - label: 'updateUser', + label: 'Updated user', description: 'This can only be done by the logged in user.', hidden: false, },