diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java index 651a015111b7..1a6a38d3acea 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java @@ -506,40 +506,40 @@ public Map postProcessAllModels(Map objs) // https://github.com/OpenAPITools/openapi-generator/issues/12324 // TODO: why do these collections contain different instances? // fixing allVars should suffice instead of patching every collection - for (CodegenProperty property : model.allVars){ + for (CodegenProperty property : model.allVars) { patchProperty(model, property); } - for (CodegenProperty property : model.vars){ + for (CodegenProperty property : model.vars) { patchProperty(model, property); } - for (CodegenProperty property : model.readWriteVars){ + for (CodegenProperty property : model.readWriteVars) { patchProperty(model, property); } - for (CodegenProperty property : model.optionalVars){ + for (CodegenProperty property : model.optionalVars) { patchProperty(model, property); } - for (CodegenProperty property : model.parentVars){ + for (CodegenProperty property : model.parentVars) { patchProperty(model, property); } - for (CodegenProperty property : model.requiredVars){ + for (CodegenProperty property : model.requiredVars) { patchProperty(model, property); } - for (CodegenProperty property : model.readOnlyVars){ + for (CodegenProperty property : model.readOnlyVars) { patchProperty(model, property); } - for (CodegenProperty property : model.nonNullableVars){ + for (CodegenProperty property : model.nonNullableVars) { patchProperty(model, property); } } return processed; } - private void patchProperty(CodegenModel model, CodegenProperty property){ + private void patchProperty(CodegenModel model, CodegenProperty property) { /** - * Hotfix for this issue - * https://github.com/OpenAPITools/openapi-generator/issues/12155 - */ - if (property.dataType.equals("List") && property.getComposedSchemas() != null && property.getComposedSchemas().getAllOf() != null){ + * Hotfix for this issue + * https://github.com/OpenAPITools/openapi-generator/issues/12155 + */ + if (property.dataType.equals("List") && property.getComposedSchemas() != null && property.getComposedSchemas().getAllOf() != null) { List composedSchemas = property.getComposedSchemas().getAllOf(); if (composedSchemas.size() == 0) { return; @@ -567,26 +567,28 @@ private void patchProperty(CodegenModel model, CodegenProperty property){ } } - /** Mitigates https://github.com/OpenAPITools/openapi-generator/issues/13709 */ + /** + * Mitigates https://github.com/OpenAPITools/openapi-generator/issues/13709 + */ private void removeCircularReferencesInComposedSchemas(CodegenModel cm) { cm.anyOf.removeIf(anyOf -> anyOf.equals(cm.classname)); cm.oneOf.removeIf(oneOf -> oneOf.equals(cm.classname)); cm.allOf.removeIf(allOf -> allOf.equals(cm.classname)); CodegenComposedSchemas composedSchemas = cm.getComposedSchemas(); - if (composedSchemas != null){ + if (composedSchemas != null) { List anyOf = composedSchemas.getAnyOf(); if (anyOf != null) { anyOf.removeIf(p -> p.dataType.equals(cm.classname)); } List oneOf = composedSchemas.getOneOf(); - if (oneOf != null){ + if (oneOf != null) { oneOf.removeIf(p -> p.dataType.equals(cm.classname)); } List allOf = composedSchemas.getAllOf(); - if (allOf != null){ + if (allOf != null) { allOf.removeIf(p -> p.dataType.equals(cm.classname)); } } @@ -599,7 +601,7 @@ protected List> buildEnumVars(List values, String da // this is needed for enumRefs like OuterEnum marked as nullable and also have string values // keep isString true so that the index will be used as the enum value instead of a string // this is inline with C# enums with string values - if ("string?".equals(dataType)){ + if ("string?".equals(dataType)) { enumVars.forEach((enumVar) -> { enumVar.put("isString", true); }); @@ -1086,6 +1088,7 @@ public String toExampleValue(Schema p) { /** * Return the default value of the property + * * @param p OpenAPI property object * @return string presentation of the default value of the property */ @@ -1272,9 +1275,13 @@ public String toModelTestFilename(String name) { return toModelName(name) + "Tests"; } - public void setLicenseUrl(String licenseUrl) {this.licenseUrl = licenseUrl;} + public void setLicenseUrl(String licenseUrl) { + this.licenseUrl = licenseUrl; + } - public void setLicenseName(String licenseName) {this.licenseName = licenseName;} + public void setLicenseName(String licenseName) { + this.licenseName = licenseName; + } public void setPackageName(String packageName) { this.packageName = packageName; @@ -1328,12 +1335,12 @@ public String getInterfacePrefix() { return interfacePrefix; } - public void setNullableReferenceTypes(final Boolean nullReferenceTypesFlag){ + public void setNullableReferenceTypes(final Boolean nullReferenceTypesFlag) { this.nullReferenceTypesFlag = nullReferenceTypesFlag; additionalProperties.put("nullableReferenceTypes", nullReferenceTypesFlag); additionalProperties.put("nrt", nullReferenceTypesFlag); - if (nullReferenceTypesFlag){ + if (nullReferenceTypesFlag) { additionalProperties.put("nrt?", "?"); additionalProperties.put("nrt!", "!"); } else { @@ -1342,7 +1349,7 @@ public void setNullableReferenceTypes(final Boolean nullReferenceTypesFlag){ } } - public boolean getNullableReferencesTypes(){ + public boolean getNullableReferencesTypes() { return this.nullReferenceTypesFlag; } @@ -1442,7 +1449,7 @@ public boolean isDataTypeString(String dataType) { */ protected boolean isValueType(CodegenProperty var) { - return (valueTypes.contains(var.dataType) || var.isEnum ) ; + return (valueTypes.contains(var.dataType) || var.isEnum); } @Override @@ -1581,8 +1588,8 @@ public void postProcessParameter(CodegenParameter parameter) { // use isNullable, OptionalParameterLambda, or RequiredParameterLambda if (!parameter.required && (nullReferenceTypesFlag || nullableType.contains(parameter.dataType))) { parameter.dataType = parameter.dataType.endsWith("?") - ? parameter.dataType - : parameter.dataType + "?"; + ? parameter.dataType + : parameter.dataType + "?"; } } @@ -1617,5 +1624,12 @@ public void postProcessFile(File file, String fileType) { } @Override - public GeneratorLanguage generatorLanguage() { return GeneratorLanguage.C_SHARP; } + public GeneratorLanguage generatorLanguage() { + return GeneratorLanguage.C_SHARP; + } + + public String toRegularExpression(String pattern) { + return addRegularExpressionDelimiter(pattern); + } + } diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/ClientUtils.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/ClientUtils.mustache index ffd28edb4a24..ab126614f96a 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/ClientUtils.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/ClientUtils.mustache @@ -42,7 +42,7 @@ namespace {{packageName}}.Client /// Filename public static string SanitizeFilename(string filename) { - Match match = Regex.Match(filename, ".*[/\\](.*)$"); + Match match = Regex.Match(filename, @".*[/\\](.*)$"); return match.Success ? match.Groups[1].Value : filename; } diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/generichost/ClientUtils.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/generichost/ClientUtils.mustache index 7e59130d6eb6..a8a92172aaf5 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/generichost/ClientUtils.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/libraries/generichost/ClientUtils.mustache @@ -96,7 +96,7 @@ namespace {{packageName}}.{{clientPackage}} /// Filename public static string SanitizeFilename(string filename) { - Match match = Regex.Match(filename, ".*[/\\](.*)$"); + Match match = Regex.Match(filename, @".*[/\\](.*)$"); return match.Success ? match.Groups[1].Value : filename; } diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/validatable.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/validatable.mustache index 7ec9e9870552..cf24f2f94fd1 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/validatable.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/validatable.mustache @@ -74,7 +74,7 @@ {{#pattern}} {{^isByteArray}} // {{{name}}} ({{{dataType}}}) pattern - Regex regex{{{name}}} = new Regex("{{{vendorExtensions.x-regex}}}"{{#vendorExtensions.x-modifiers}}{{#-first}}, {{/-first}}RegexOptions.{{{.}}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}); + Regex regex{{{name}}} = new Regex(@"{{{vendorExtensions.x-regex}}}"{{#vendorExtensions.x-modifiers}}{{#-first}}, {{/-first}}RegexOptions.{{{.}}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}); if (false == regex{{{name}}}.Match(this.{{{name}}}{{#isUuid}}.ToString(){{/isUuid}}).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must match a pattern of " + regex{{{name}}}, new [] { "{{{name}}}" }); diff --git a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index c9d94efc91f8..d1ee80f8fe61 100644 --- a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -1571,6 +1571,10 @@ components: description: A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. type: string pattern: '/^image_\d{1,3}$/i' + pattern_with_backslash: + description: None + type: string + pattern: '^(([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]))$' EnumClass: type: string default: '-efg' @@ -2268,4 +2272,4 @@ components: default: C:\\Users\\username unescapedLiteralString: type: string - default: C:\Users\username \ No newline at end of file + default: C:\Users\username diff --git a/samples/client/others/csharp-netcore-complex-files/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/others/csharp-netcore-complex-files/src/Org.OpenAPITools/Client/ClientUtils.cs index d434ef6ec95c..3bcd98df7caa 100644 --- a/samples/client/others/csharp-netcore-complex-files/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/others/csharp-netcore-complex-files/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -46,7 +46,7 @@ static ClientUtils() /// Filename public static string SanitizeFilename(string filename) { - Match match = Regex.Match(filename, ".*[/\\](.*)$"); + Match match = Regex.Match(filename, @".*[/\\](.*)$"); return match.Success ? match.Groups[1].Value : filename; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/api/openapi.yaml index 7942c294daca..8c4f6ce53f6d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/api/openapi.yaml @@ -1497,6 +1497,11 @@ components: to three digits following i.e. Image_01. pattern: "/^image_\\d{1,3}$/i" type: string + pattern_with_backslash: + description: None + pattern: "^(([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]))$" + type: string required: - byte - date diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/FormatTest.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/FormatTest.md index 1664a9d7c72b..c2144b5e3cf6 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/FormatTest.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/docs/FormatTest.md @@ -22,6 +22,7 @@ Name | Type | Description | Notes **Password** | **string** | | **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] +**PatternWithBackslash** | **string** | None | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Client/ClientUtils.cs index 85ec43412716..8e33ee2d9b5b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -46,7 +46,7 @@ static ClientUtils() /// Filename public static string SanitizeFilename(string filename) { - Match match = Regex.Match(filename, ".*[/\\](.*)$"); + Match match = Regex.Match(filename, @".*[/\\](.*)$"); return match.Success ? match.Groups[1].Value : filename; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Apple.cs index d89f2a65e76b..eb7befbf4da2 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Apple.cs @@ -183,14 +183,14 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { // Cultivar (string) pattern - Regex regexCultivar = new Regex("^[a-zA-Z\\s]*$", RegexOptions.CultureInvariant); + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); if (false == regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } // Origin (string) pattern - Regex regexOrigin = new Regex("^[A-Z\\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FormatTest.cs index bd57007c09a4..7ce0ca715b1f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FormatTest.cs @@ -61,7 +61,8 @@ protected FormatTest() /// password (required). /// A string that is a 10 digit number. Can have leading zeros.. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.. - public FormatTest(int integer = default(int), int int32 = default(int), uint unsignedInteger = default(uint), long int64 = default(long), ulong unsignedLong = default(ulong), decimal number = default(decimal), float _float = default(float), double _double = default(double), decimal _decimal = default(decimal), string _string = default(string), byte[] _byte = default(byte[]), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), Guid uuid = default(Guid), string password = default(string), string patternWithDigits = default(string), string patternWithDigitsAndDelimiter = default(string)) + /// None. + public FormatTest(int integer = default(int), int int32 = default(int), uint unsignedInteger = default(uint), long int64 = default(long), ulong unsignedLong = default(ulong), decimal number = default(decimal), float _float = default(float), double _double = default(double), decimal _decimal = default(decimal), string _string = default(string), byte[] _byte = default(byte[]), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), Guid uuid = default(Guid), string password = default(string), string patternWithDigits = default(string), string patternWithDigitsAndDelimiter = default(string), string patternWithBackslash = default(string)) { this._Number = number; // to ensure "_byte" is required (not null) @@ -147,6 +148,11 @@ protected FormatTest() { this._flagPatternWithDigitsAndDelimiter = true; } + this._PatternWithBackslash = patternWithBackslash; + if (this.PatternWithBackslash != null) + { + this._flagPatternWithBackslash = true; + } this.AdditionalProperties = new Dictionary(); } @@ -589,6 +595,31 @@ public bool ShouldSerializePatternWithDigitsAndDelimiter() return _flagPatternWithDigitsAndDelimiter; } /// + /// None + /// + /// None + [DataMember(Name = "pattern_with_backslash", EmitDefaultValue = false)] + public string PatternWithBackslash + { + get{ return _PatternWithBackslash;} + set + { + _PatternWithBackslash = value; + _flagPatternWithBackslash = true; + } + } + private string _PatternWithBackslash; + private bool _flagPatternWithBackslash; + + /// + /// Returns false as PatternWithBackslash should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializePatternWithBackslash() + { + return _flagPatternWithBackslash; + } + /// /// Gets or Sets additional properties /// [JsonExtensionData] @@ -620,6 +651,7 @@ public override string ToString() sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); + sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -708,6 +740,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.PatternWithDigitsAndDelimiter.GetHashCode(); } + if (this.PatternWithBackslash != null) + { + hashCode = (hashCode * 59) + this.PatternWithBackslash.GetHashCode(); + } if (this.AdditionalProperties != null) { hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); @@ -796,7 +832,7 @@ public override int GetHashCode() } // String (string) pattern - Regex regexString = new Regex("[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexString.Match(this.String).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for String, must match a pattern of " + regexString, new [] { "String" }); @@ -815,19 +851,26 @@ public override int GetHashCode() } // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex("^\\d{10}$", RegexOptions.CultureInvariant); + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); if (false == regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex("^image_\\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } + // 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 (false == 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-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 219e8b485010..60620f2c4975 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -253,7 +253,7 @@ public override int GetHashCode() 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); + 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 (false == 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" }); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml index 7942c294daca..8c4f6ce53f6d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml @@ -1497,6 +1497,11 @@ components: to three digits following i.e. Image_01. pattern: "/^image_\\d{1,3}$/i" type: string + pattern_with_backslash: + description: None + pattern: "^(([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]))$" + type: string required: - byte - date diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/models/FormatTest.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/models/FormatTest.md index b176ed40f3d1..36cd3190b47e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/models/FormatTest.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/docs/models/FormatTest.md @@ -16,6 +16,7 @@ Name | Type | Description | Notes **Integer** | **int** | | [optional] **Number** | **decimal** | | **Password** | **string** | | +**PatternWithBackslash** | **string** | None | [optional] **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] **StringProperty** | **string** | | [optional] diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs index 4cb4f694a0d1..891954e74238 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -100,7 +100,7 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp /// Filename public static string SanitizeFilename(string filename) { - Match match = Regex.Match(filename, ".*[/\\](.*)$"); + Match match = Regex.Match(filename, @".*[/\\](.*)$"); return match.Success ? match.Groups[1].Value : filename; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs index f084f92dbf86..f1894feba492 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs @@ -83,14 +83,14 @@ public override string ToString() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { // Cultivar (string) pattern - Regex regexCultivar = new Regex("^[a-zA-Z\\s]*$", RegexOptions.CultureInvariant); + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); if (false == regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } // Origin (string) pattern - Regex regexOrigin = new Regex("^[A-Z\\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs index 591888d3b5d9..188e75c3980a 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs @@ -45,6 +45,7 @@ public partial class FormatTest : IValidatableObject /// integer /// number /// password + /// None /// A string that is a 10 digit number. Can have leading zeros. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. /// stringProperty @@ -52,7 +53,7 @@ public partial class FormatTest : IValidatableObject /// unsignedLong /// uuid [JsonConstructor] - public FormatTest(System.IO.Stream binary, byte[] byteProperty, DateTime date, DateTime dateTime, decimal decimalProperty, double doubleProperty, float floatProperty, int int32, long int64, int integer, decimal number, string password, string patternWithDigits, string patternWithDigitsAndDelimiter, string stringProperty, uint unsignedInteger, ulong unsignedLong, Guid uuid) + public FormatTest(System.IO.Stream binary, byte[] byteProperty, DateTime date, DateTime dateTime, decimal decimalProperty, double doubleProperty, float floatProperty, int int32, long int64, int integer, decimal number, string password, string patternWithBackslash, string patternWithDigits, string patternWithDigitsAndDelimiter, string stringProperty, uint unsignedInteger, ulong unsignedLong, Guid uuid) { Binary = binary; ByteProperty = byteProperty; @@ -66,6 +67,7 @@ public FormatTest(System.IO.Stream binary, byte[] byteProperty, DateTime date, D Integer = integer; Number = number; Password = password; + PatternWithBackslash = patternWithBackslash; PatternWithDigits = patternWithDigits; PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; StringProperty = stringProperty; @@ -148,6 +150,13 @@ public FormatTest(System.IO.Stream binary, byte[] byteProperty, DateTime date, D [JsonPropertyName("password")] public string Password { get; set; } + /// + /// None + /// + /// None + [JsonPropertyName("pattern_with_backslash")] + public string PatternWithBackslash { get; set; } + /// /// A string that is a 10 digit number. Can have leading zeros. /// @@ -213,6 +222,7 @@ public override string ToString() sb.Append(" Integer: ").Append(Integer).Append("\n"); sb.Append(" Number: ").Append(Number).Append("\n"); sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); sb.Append(" StringProperty: ").Append(StringProperty).Append("\n"); @@ -303,22 +313,29 @@ public override string ToString() yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); } + // 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 (false == regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); + } + // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex("^\\d{10}$", RegexOptions.CultureInvariant); + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); if (false == regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex("^image_\\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } // StringProperty (string) pattern - Regex regexStringProperty = new Regex("[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexStringProperty = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexStringProperty.Match(this.StringProperty).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for StringProperty, must match a pattern of " + regexStringProperty, new [] { "StringProperty" }); @@ -384,6 +401,7 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo int integer = default; decimal number = default; string password = default; + string patternWithBackslash = default; string patternWithDigits = default; string patternWithDigitsAndDelimiter = default; string stringProperty = default; @@ -453,6 +471,9 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo case "password": password = utf8JsonReader.GetString(); break; + case "pattern_with_backslash": + patternWithBackslash = utf8JsonReader.GetString(); + break; case "pattern_with_digits": patternWithDigits = utf8JsonReader.GetString(); break; @@ -537,10 +558,13 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo if (patternWithDigitsAndDelimiter == null) throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + if (patternWithBackslash == null) + throw new ArgumentNullException(nameof(patternWithBackslash), "Property is required for class FormatTest."); + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - return new FormatTest(binary, byteProperty, date, dateTime, decimalProperty, doubleProperty, floatProperty, int32, int64, integer, number, password, patternWithDigits, patternWithDigitsAndDelimiter, stringProperty, unsignedInteger, unsignedLong, uuid); + return new FormatTest(binary, byteProperty, date, dateTime, decimalProperty, doubleProperty, floatProperty, int32, int64, integer, number, password, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, stringProperty, unsignedInteger, unsignedLong, uuid); } /// @@ -569,6 +593,7 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer writer.WriteNumber("integer", formatTest.Integer); writer.WriteNumber("number", formatTest.Number); writer.WriteString("password", formatTest.Password); + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); writer.WriteString("string", formatTest.StringProperty); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 743d37e3fc1e..2f925154c578 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -101,7 +101,7 @@ public override string ToString() 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); + 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 (false == 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" }); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/api/openapi.yaml index 7942c294daca..8c4f6ce53f6d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/api/openapi.yaml @@ -1497,6 +1497,11 @@ components: to three digits following i.e. Image_01. pattern: "/^image_\\d{1,3}$/i" type: string + pattern_with_backslash: + description: None + pattern: "^(([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]))$" + type: string required: - byte - date diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/models/FormatTest.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/models/FormatTest.md index b176ed40f3d1..36cd3190b47e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/models/FormatTest.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/docs/models/FormatTest.md @@ -16,6 +16,7 @@ Name | Type | Description | Notes **Integer** | **int** | | [optional] **Number** | **decimal** | | **Password** | **string** | | +**PatternWithBackslash** | **string** | None | [optional] **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] **StringProperty** | **string** | | [optional] diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs index dfba54b0e224..812a804966f2 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -98,7 +98,7 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp /// Filename public static string SanitizeFilename(string filename) { - Match match = Regex.Match(filename, ".*[/\\](.*)$"); + Match match = Regex.Match(filename, @".*[/\\](.*)$"); return match.Success ? match.Groups[1].Value : filename; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs index f480b93afa07..13d6d493ffed 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs @@ -81,14 +81,14 @@ public override string ToString() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { // Cultivar (string) pattern - Regex regexCultivar = new Regex("^[a-zA-Z\\s]*$", RegexOptions.CultureInvariant); + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); if (false == regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } // Origin (string) pattern - Regex regexOrigin = new Regex("^[A-Z\\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs index 9c63adbde8e2..d74b13e72ccb 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -43,6 +43,7 @@ public partial class FormatTest : IValidatableObject /// integer /// number /// password + /// None /// A string that is a 10 digit number. Can have leading zeros. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. /// stringProperty @@ -50,7 +51,7 @@ public partial class FormatTest : IValidatableObject /// unsignedLong /// uuid [JsonConstructor] - public FormatTest(System.IO.Stream binary, byte[] byteProperty, DateTime date, DateTime dateTime, decimal decimalProperty, double doubleProperty, float floatProperty, int int32, long int64, int integer, decimal number, string password, string patternWithDigits, string patternWithDigitsAndDelimiter, string stringProperty, uint unsignedInteger, ulong unsignedLong, Guid uuid) + public FormatTest(System.IO.Stream binary, byte[] byteProperty, DateTime date, DateTime dateTime, decimal decimalProperty, double doubleProperty, float floatProperty, int int32, long int64, int integer, decimal number, string password, string patternWithBackslash, string patternWithDigits, string patternWithDigitsAndDelimiter, string stringProperty, uint unsignedInteger, ulong unsignedLong, Guid uuid) { Binary = binary; ByteProperty = byteProperty; @@ -64,6 +65,7 @@ public FormatTest(System.IO.Stream binary, byte[] byteProperty, DateTime date, D Integer = integer; Number = number; Password = password; + PatternWithBackslash = patternWithBackslash; PatternWithDigits = patternWithDigits; PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; StringProperty = stringProperty; @@ -146,6 +148,13 @@ public FormatTest(System.IO.Stream binary, byte[] byteProperty, DateTime date, D [JsonPropertyName("password")] public string Password { get; set; } + /// + /// None + /// + /// None + [JsonPropertyName("pattern_with_backslash")] + public string PatternWithBackslash { get; set; } + /// /// A string that is a 10 digit number. Can have leading zeros. /// @@ -211,6 +220,7 @@ public override string ToString() sb.Append(" Integer: ").Append(Integer).Append("\n"); sb.Append(" Number: ").Append(Number).Append("\n"); sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); sb.Append(" StringProperty: ").Append(StringProperty).Append("\n"); @@ -301,22 +311,29 @@ public override string ToString() yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); } + // 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 (false == regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); + } + // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex("^\\d{10}$", RegexOptions.CultureInvariant); + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); if (false == regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex("^image_\\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } // StringProperty (string) pattern - Regex regexStringProperty = new Regex("[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexStringProperty = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexStringProperty.Match(this.StringProperty).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for StringProperty, must match a pattern of " + regexStringProperty, new [] { "StringProperty" }); @@ -382,6 +399,7 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo int integer = default; decimal number = default; string password = default; + string patternWithBackslash = default; string patternWithDigits = default; string patternWithDigitsAndDelimiter = default; string stringProperty = default; @@ -451,6 +469,9 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo case "password": password = utf8JsonReader.GetString(); break; + case "pattern_with_backslash": + patternWithBackslash = utf8JsonReader.GetString(); + break; case "pattern_with_digits": patternWithDigits = utf8JsonReader.GetString(); break; @@ -535,10 +556,13 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo if (patternWithDigitsAndDelimiter == null) throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + if (patternWithBackslash == null) + throw new ArgumentNullException(nameof(patternWithBackslash), "Property is required for class FormatTest."); + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - return new FormatTest(binary, byteProperty, date, dateTime, decimalProperty, doubleProperty, floatProperty, int32, int64, integer, number, password, patternWithDigits, patternWithDigitsAndDelimiter, stringProperty, unsignedInteger, unsignedLong, uuid); + return new FormatTest(binary, byteProperty, date, dateTime, decimalProperty, doubleProperty, floatProperty, int32, int64, integer, number, password, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, stringProperty, unsignedInteger, unsignedLong, uuid); } /// @@ -567,6 +591,7 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer writer.WriteNumber("integer", formatTest.Integer); writer.WriteNumber("number", formatTest.Number); writer.WriteString("password", formatTest.Password); + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); writer.WriteString("string", formatTest.StringProperty); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index a4b87545f050..37941e11efe3 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -99,7 +99,7 @@ public override string ToString() 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); + 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 (false == 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" }); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Client/ClientUtils.cs index 5ca0572afc1f..d8a9f0ca4a0f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -100,7 +100,7 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp /// Filename public static string SanitizeFilename(string filename) { - Match match = Regex.Match(filename, ".*[/\\](.*)$"); + Match match = Regex.Match(filename, @".*[/\\](.*)$"); return match.Success ? match.Groups[1].Value : filename; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Client/ClientUtils.cs index f751f61c7597..6eb7acc88f4b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -100,7 +100,7 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp /// Filename public static string SanitizeFilename(string filename) { - Match match = Regex.Match(filename, ".*[/\\](.*)$"); + Match match = Regex.Match(filename, @".*[/\\](.*)$"); return match.Success ? match.Groups[1].Value : filename; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Client/ClientUtils.cs index f751f61c7597..6eb7acc88f4b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -100,7 +100,7 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp /// Filename public static string SanitizeFilename(string filename) { - Match match = Regex.Match(filename, ".*[/\\](.*)$"); + Match match = Regex.Match(filename, @".*[/\\](.*)$"); return match.Success ? match.Groups[1].Value : filename; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml index 7942c294daca..8c4f6ce53f6d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml @@ -1497,6 +1497,11 @@ components: to three digits following i.e. Image_01. pattern: "/^image_\\d{1,3}$/i" type: string + pattern_with_backslash: + description: None + pattern: "^(([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]))$" + type: string required: - byte - date diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/models/FormatTest.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/models/FormatTest.md index b176ed40f3d1..36cd3190b47e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/models/FormatTest.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/docs/models/FormatTest.md @@ -16,6 +16,7 @@ Name | Type | Description | Notes **Integer** | **int** | | [optional] **Number** | **decimal** | | **Password** | **string** | | +**PatternWithBackslash** | **string** | None | [optional] **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] **StringProperty** | **string** | | [optional] diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs index 0ad137a07072..46f2d9ea2b3f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -98,7 +98,7 @@ public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOp /// Filename public static string SanitizeFilename(string filename) { - Match match = Regex.Match(filename, ".*[/\\](.*)$"); + Match match = Regex.Match(filename, @".*[/\\](.*)$"); return match.Success ? match.Groups[1].Value : filename; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs index f480b93afa07..13d6d493ffed 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs @@ -81,14 +81,14 @@ public override string ToString() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { // Cultivar (string) pattern - Regex regexCultivar = new Regex("^[a-zA-Z\\s]*$", RegexOptions.CultureInvariant); + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); if (false == regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } // Origin (string) pattern - Regex regexOrigin = new Regex("^[A-Z\\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs index 9c63adbde8e2..d74b13e72ccb 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -43,6 +43,7 @@ public partial class FormatTest : IValidatableObject /// integer /// number /// password + /// None /// A string that is a 10 digit number. Can have leading zeros. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. /// stringProperty @@ -50,7 +51,7 @@ public partial class FormatTest : IValidatableObject /// unsignedLong /// uuid [JsonConstructor] - public FormatTest(System.IO.Stream binary, byte[] byteProperty, DateTime date, DateTime dateTime, decimal decimalProperty, double doubleProperty, float floatProperty, int int32, long int64, int integer, decimal number, string password, string patternWithDigits, string patternWithDigitsAndDelimiter, string stringProperty, uint unsignedInteger, ulong unsignedLong, Guid uuid) + public FormatTest(System.IO.Stream binary, byte[] byteProperty, DateTime date, DateTime dateTime, decimal decimalProperty, double doubleProperty, float floatProperty, int int32, long int64, int integer, decimal number, string password, string patternWithBackslash, string patternWithDigits, string patternWithDigitsAndDelimiter, string stringProperty, uint unsignedInteger, ulong unsignedLong, Guid uuid) { Binary = binary; ByteProperty = byteProperty; @@ -64,6 +65,7 @@ public FormatTest(System.IO.Stream binary, byte[] byteProperty, DateTime date, D Integer = integer; Number = number; Password = password; + PatternWithBackslash = patternWithBackslash; PatternWithDigits = patternWithDigits; PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; StringProperty = stringProperty; @@ -146,6 +148,13 @@ public FormatTest(System.IO.Stream binary, byte[] byteProperty, DateTime date, D [JsonPropertyName("password")] public string Password { get; set; } + /// + /// None + /// + /// None + [JsonPropertyName("pattern_with_backslash")] + public string PatternWithBackslash { get; set; } + /// /// A string that is a 10 digit number. Can have leading zeros. /// @@ -211,6 +220,7 @@ public override string ToString() sb.Append(" Integer: ").Append(Integer).Append("\n"); sb.Append(" Number: ").Append(Number).Append("\n"); sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); sb.Append(" StringProperty: ").Append(StringProperty).Append("\n"); @@ -301,22 +311,29 @@ public override string ToString() yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); } + // 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 (false == regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); + } + // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex("^\\d{10}$", RegexOptions.CultureInvariant); + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); if (false == regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex("^image_\\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } // StringProperty (string) pattern - Regex regexStringProperty = new Regex("[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexStringProperty = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexStringProperty.Match(this.StringProperty).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for StringProperty, must match a pattern of " + regexStringProperty, new [] { "StringProperty" }); @@ -382,6 +399,7 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo int integer = default; decimal number = default; string password = default; + string patternWithBackslash = default; string patternWithDigits = default; string patternWithDigitsAndDelimiter = default; string stringProperty = default; @@ -451,6 +469,9 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo case "password": password = utf8JsonReader.GetString(); break; + case "pattern_with_backslash": + patternWithBackslash = utf8JsonReader.GetString(); + break; case "pattern_with_digits": patternWithDigits = utf8JsonReader.GetString(); break; @@ -535,10 +556,13 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo if (patternWithDigitsAndDelimiter == null) throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + if (patternWithBackslash == null) + throw new ArgumentNullException(nameof(patternWithBackslash), "Property is required for class FormatTest."); + #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' - return new FormatTest(binary, byteProperty, date, dateTime, decimalProperty, doubleProperty, floatProperty, int32, int64, integer, number, password, patternWithDigits, patternWithDigitsAndDelimiter, stringProperty, unsignedInteger, unsignedLong, uuid); + return new FormatTest(binary, byteProperty, date, dateTime, decimalProperty, doubleProperty, floatProperty, int32, int64, integer, number, password, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, stringProperty, unsignedInteger, unsignedLong, uuid); } /// @@ -567,6 +591,7 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer writer.WriteNumber("integer", formatTest.Integer); writer.WriteNumber("number", formatTest.Number); writer.WriteString("password", formatTest.Password); + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); writer.WriteString("string", formatTest.StringProperty); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index a4b87545f050..37941e11efe3 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -99,7 +99,7 @@ public override string ToString() 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); + 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 (false == 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" }); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/api/openapi.yaml index 7942c294daca..8c4f6ce53f6d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/api/openapi.yaml @@ -1497,6 +1497,11 @@ components: to three digits following i.e. Image_01. pattern: "/^image_\\d{1,3}$/i" type: string + pattern_with_backslash: + description: None + pattern: "^(([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]))$" + type: string required: - byte - date diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/FormatTest.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/FormatTest.md index bd9e50f80af2..7c06c37839c3 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/FormatTest.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/docs/FormatTest.md @@ -22,6 +22,7 @@ Name | Type | Description | Notes **Password** | **string** | | **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] +**PatternWithBackslash** | **string** | None | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/ClientUtils.cs index 85ec43412716..8e33ee2d9b5b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -46,7 +46,7 @@ static ClientUtils() /// Filename public static string SanitizeFilename(string filename) { - Match match = Regex.Match(filename, ".*[/\\](.*)$"); + Match match = Regex.Match(filename, @".*[/\\](.*)$"); return match.Success ? match.Groups[1].Value : filename; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs index d410331bf57a..eff6f3caccc4 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs @@ -140,14 +140,14 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { // Cultivar (string) pattern - Regex regexCultivar = new Regex("^[a-zA-Z\\s]*$", RegexOptions.CultureInvariant); + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); if (false == regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } // Origin (string) pattern - Regex regexOrigin = new Regex("^[A-Z\\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs index b905f6c95269..3757014f532f 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs @@ -62,7 +62,8 @@ protected FormatTest() /// password (required). /// A string that is a 10 digit number. Can have leading zeros.. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.. - public FormatTest(int integer = default(int), int int32 = default(int), uint unsignedInteger = default(uint), long int64 = default(long), ulong unsignedLong = default(ulong), decimal number = default(decimal), float _float = default(float), double _double = default(double), decimal _decimal = default(decimal), string _string = default(string), byte[] _byte = default(byte[]), FileParameter binary = default(FileParameter), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), Guid uuid = default(Guid), string password = default(string), string patternWithDigits = default(string), string patternWithDigitsAndDelimiter = default(string)) + /// None. + public FormatTest(int integer = default(int), int int32 = default(int), uint unsignedInteger = default(uint), long int64 = default(long), ulong unsignedLong = default(ulong), decimal number = default(decimal), float _float = default(float), double _double = default(double), decimal _decimal = default(decimal), string _string = default(string), byte[] _byte = default(byte[]), FileParameter binary = default(FileParameter), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), Guid uuid = default(Guid), string password = default(string), string patternWithDigits = default(string), string patternWithDigitsAndDelimiter = default(string), string patternWithBackslash = default(string)) { this.Number = number; // to ensure "_byte" is required (not null) @@ -92,6 +93,7 @@ protected FormatTest() this.Uuid = uuid; this.PatternWithDigits = patternWithDigits; this.PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + this.PatternWithBackslash = patternWithBackslash; this.AdditionalProperties = new Dictionary(); } @@ -209,6 +211,13 @@ protected FormatTest() [DataMember(Name = "pattern_with_digits_and_delimiter", EmitDefaultValue = false)] public string PatternWithDigitsAndDelimiter { get; set; } + /// + /// None + /// + /// None + [DataMember(Name = "pattern_with_backslash", EmitDefaultValue = false)] + public string PatternWithBackslash { get; set; } + /// /// Gets or Sets additional properties /// @@ -241,6 +250,7 @@ public override string ToString() sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); + sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -329,6 +339,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.PatternWithDigitsAndDelimiter.GetHashCode(); } + if (this.PatternWithBackslash != null) + { + hashCode = (hashCode * 59) + this.PatternWithBackslash.GetHashCode(); + } if (this.AdditionalProperties != null) { hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); @@ -417,7 +431,7 @@ public override int GetHashCode() } // String (string) pattern - Regex regexString = new Regex("[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexString.Match(this.String).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for String, must match a pattern of " + regexString, new [] { "String" }); @@ -436,19 +450,26 @@ public override int GetHashCode() } // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex("^\\d{10}$", RegexOptions.CultureInvariant); + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); if (false == regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex("^image_\\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } + // 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 (false == 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-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 8d0985961a8a..bca954875aaa 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -166,7 +166,7 @@ public override int GetHashCode() 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); + 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 (false == 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" }); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/api/openapi.yaml index 7942c294daca..8c4f6ce53f6d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/api/openapi.yaml @@ -1497,6 +1497,11 @@ components: to three digits following i.e. Image_01. pattern: "/^image_\\d{1,3}$/i" type: string + pattern_with_backslash: + description: None + pattern: "^(([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]))$" + type: string required: - byte - date diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/FormatTest.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/FormatTest.md index 1664a9d7c72b..c2144b5e3cf6 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/FormatTest.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/docs/FormatTest.md @@ -22,6 +22,7 @@ Name | Type | Description | Notes **Password** | **string** | | **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] +**PatternWithBackslash** | **string** | None | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Client/ClientUtils.cs index 85ec43412716..8e33ee2d9b5b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -46,7 +46,7 @@ static ClientUtils() /// Filename public static string SanitizeFilename(string filename) { - Match match = Regex.Match(filename, ".*[/\\](.*)$"); + Match match = Regex.Match(filename, @".*[/\\](.*)$"); return match.Success ? match.Groups[1].Value : filename; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Apple.cs index c8ffe52a70af..852a74fb6e65 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Apple.cs @@ -139,14 +139,14 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { // Cultivar (string) pattern - Regex regexCultivar = new Regex("^[a-zA-Z\\s]*$", RegexOptions.CultureInvariant); + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); if (false == regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } // Origin (string) pattern - Regex regexOrigin = new Regex("^[A-Z\\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FormatTest.cs index c3fa57791cfe..6a81d63215f0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FormatTest.cs @@ -61,7 +61,8 @@ protected FormatTest() /// password (required). /// A string that is a 10 digit number. Can have leading zeros.. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.. - public FormatTest(int integer = default(int), int int32 = default(int), uint unsignedInteger = default(uint), long int64 = default(long), ulong unsignedLong = default(ulong), decimal number = default(decimal), float _float = default(float), double _double = default(double), decimal _decimal = default(decimal), string _string = default(string), byte[] _byte = default(byte[]), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), Guid uuid = default(Guid), string password = default(string), string patternWithDigits = default(string), string patternWithDigitsAndDelimiter = default(string)) + /// None. + public FormatTest(int integer = default(int), int int32 = default(int), uint unsignedInteger = default(uint), long int64 = default(long), ulong unsignedLong = default(ulong), decimal number = default(decimal), float _float = default(float), double _double = default(double), decimal _decimal = default(decimal), string _string = default(string), byte[] _byte = default(byte[]), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), Guid uuid = default(Guid), string password = default(string), string patternWithDigits = default(string), string patternWithDigitsAndDelimiter = default(string), string patternWithBackslash = default(string)) { this.Number = number; // to ensure "_byte" is required (not null) @@ -91,6 +92,7 @@ protected FormatTest() this.Uuid = uuid; this.PatternWithDigits = patternWithDigits; this.PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + this.PatternWithBackslash = patternWithBackslash; this.AdditionalProperties = new Dictionary(); } @@ -208,6 +210,13 @@ protected FormatTest() [DataMember(Name = "pattern_with_digits_and_delimiter", EmitDefaultValue = false)] public string PatternWithDigitsAndDelimiter { get; set; } + /// + /// None + /// + /// None + [DataMember(Name = "pattern_with_backslash", EmitDefaultValue = false)] + public string PatternWithBackslash { get; set; } + /// /// Gets or Sets additional properties /// @@ -240,6 +249,7 @@ public override string ToString() sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); + sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -328,6 +338,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.PatternWithDigitsAndDelimiter.GetHashCode(); } + if (this.PatternWithBackslash != null) + { + hashCode = (hashCode * 59) + this.PatternWithBackslash.GetHashCode(); + } if (this.AdditionalProperties != null) { hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); @@ -416,7 +430,7 @@ public override int GetHashCode() } // String (string) pattern - Regex regexString = new Regex("[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexString.Match(this.String).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for String, must match a pattern of " + regexString, new [] { "String" }); @@ -435,19 +449,26 @@ public override int GetHashCode() } // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex("^\\d{10}$", RegexOptions.CultureInvariant); + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); if (false == regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex("^image_\\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } + // 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 (false == 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-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 01215c659711..2f284e4c6238 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net47/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -165,7 +165,7 @@ public override int GetHashCode() 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); + 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 (false == 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" }); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/api/openapi.yaml index 7942c294daca..8c4f6ce53f6d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/api/openapi.yaml @@ -1497,6 +1497,11 @@ components: to three digits following i.e. Image_01. pattern: "/^image_\\d{1,3}$/i" type: string + pattern_with_backslash: + description: None + pattern: "^(([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]))$" + type: string required: - byte - date diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/docs/FormatTest.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/docs/FormatTest.md index 1664a9d7c72b..c2144b5e3cf6 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/docs/FormatTest.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/docs/FormatTest.md @@ -22,6 +22,7 @@ Name | Type | Description | Notes **Password** | **string** | | **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] +**PatternWithBackslash** | **string** | None | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Client/ClientUtils.cs index 85ec43412716..8e33ee2d9b5b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -46,7 +46,7 @@ static ClientUtils() /// Filename public static string SanitizeFilename(string filename) { - Match match = Regex.Match(filename, ".*[/\\](.*)$"); + Match match = Regex.Match(filename, @".*[/\\](.*)$"); return match.Success ? match.Groups[1].Value : filename; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Apple.cs index c8ffe52a70af..852a74fb6e65 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Apple.cs @@ -139,14 +139,14 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { // Cultivar (string) pattern - Regex regexCultivar = new Regex("^[a-zA-Z\\s]*$", RegexOptions.CultureInvariant); + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); if (false == regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } // Origin (string) pattern - Regex regexOrigin = new Regex("^[A-Z\\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/FormatTest.cs index c3fa57791cfe..6a81d63215f0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/FormatTest.cs @@ -61,7 +61,8 @@ protected FormatTest() /// password (required). /// A string that is a 10 digit number. Can have leading zeros.. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.. - public FormatTest(int integer = default(int), int int32 = default(int), uint unsignedInteger = default(uint), long int64 = default(long), ulong unsignedLong = default(ulong), decimal number = default(decimal), float _float = default(float), double _double = default(double), decimal _decimal = default(decimal), string _string = default(string), byte[] _byte = default(byte[]), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), Guid uuid = default(Guid), string password = default(string), string patternWithDigits = default(string), string patternWithDigitsAndDelimiter = default(string)) + /// None. + public FormatTest(int integer = default(int), int int32 = default(int), uint unsignedInteger = default(uint), long int64 = default(long), ulong unsignedLong = default(ulong), decimal number = default(decimal), float _float = default(float), double _double = default(double), decimal _decimal = default(decimal), string _string = default(string), byte[] _byte = default(byte[]), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), Guid uuid = default(Guid), string password = default(string), string patternWithDigits = default(string), string patternWithDigitsAndDelimiter = default(string), string patternWithBackslash = default(string)) { this.Number = number; // to ensure "_byte" is required (not null) @@ -91,6 +92,7 @@ protected FormatTest() this.Uuid = uuid; this.PatternWithDigits = patternWithDigits; this.PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + this.PatternWithBackslash = patternWithBackslash; this.AdditionalProperties = new Dictionary(); } @@ -208,6 +210,13 @@ protected FormatTest() [DataMember(Name = "pattern_with_digits_and_delimiter", EmitDefaultValue = false)] public string PatternWithDigitsAndDelimiter { get; set; } + /// + /// None + /// + /// None + [DataMember(Name = "pattern_with_backslash", EmitDefaultValue = false)] + public string PatternWithBackslash { get; set; } + /// /// Gets or Sets additional properties /// @@ -240,6 +249,7 @@ public override string ToString() sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); + sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -328,6 +338,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.PatternWithDigitsAndDelimiter.GetHashCode(); } + if (this.PatternWithBackslash != null) + { + hashCode = (hashCode * 59) + this.PatternWithBackslash.GetHashCode(); + } if (this.AdditionalProperties != null) { hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); @@ -416,7 +430,7 @@ public override int GetHashCode() } // String (string) pattern - Regex regexString = new Regex("[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexString.Match(this.String).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for String, must match a pattern of " + regexString, new [] { "String" }); @@ -435,19 +449,26 @@ public override int GetHashCode() } // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex("^\\d{10}$", RegexOptions.CultureInvariant); + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); if (false == regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex("^image_\\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } + // 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 (false == 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-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 01215c659711..2f284e4c6238 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net48/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -165,7 +165,7 @@ public override int GetHashCode() 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); + 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 (false == 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" }); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/api/openapi.yaml index 7942c294daca..8c4f6ce53f6d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/api/openapi.yaml @@ -1497,6 +1497,11 @@ components: to three digits following i.e. Image_01. pattern: "/^image_\\d{1,3}$/i" type: string + pattern_with_backslash: + description: None + pattern: "^(([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]))$" + type: string required: - byte - date diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/FormatTest.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/FormatTest.md index 1664a9d7c72b..c2144b5e3cf6 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/FormatTest.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/docs/FormatTest.md @@ -22,6 +22,7 @@ Name | Type | Description | Notes **Password** | **string** | | **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] +**PatternWithBackslash** | **string** | None | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ClientUtils.cs index 85ec43412716..8e33ee2d9b5b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -46,7 +46,7 @@ static ClientUtils() /// Filename public static string SanitizeFilename(string filename) { - Match match = Regex.Match(filename, ".*[/\\](.*)$"); + Match match = Regex.Match(filename, @".*[/\\](.*)$"); return match.Success ? match.Groups[1].Value : filename; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Apple.cs index c8ffe52a70af..852a74fb6e65 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Apple.cs @@ -139,14 +139,14 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { // Cultivar (string) pattern - Regex regexCultivar = new Regex("^[a-zA-Z\\s]*$", RegexOptions.CultureInvariant); + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); if (false == regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } // Origin (string) pattern - Regex regexOrigin = new Regex("^[A-Z\\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FormatTest.cs index c3fa57791cfe..6a81d63215f0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -61,7 +61,8 @@ protected FormatTest() /// password (required). /// A string that is a 10 digit number. Can have leading zeros.. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.. - public FormatTest(int integer = default(int), int int32 = default(int), uint unsignedInteger = default(uint), long int64 = default(long), ulong unsignedLong = default(ulong), decimal number = default(decimal), float _float = default(float), double _double = default(double), decimal _decimal = default(decimal), string _string = default(string), byte[] _byte = default(byte[]), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), Guid uuid = default(Guid), string password = default(string), string patternWithDigits = default(string), string patternWithDigitsAndDelimiter = default(string)) + /// None. + public FormatTest(int integer = default(int), int int32 = default(int), uint unsignedInteger = default(uint), long int64 = default(long), ulong unsignedLong = default(ulong), decimal number = default(decimal), float _float = default(float), double _double = default(double), decimal _decimal = default(decimal), string _string = default(string), byte[] _byte = default(byte[]), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), Guid uuid = default(Guid), string password = default(string), string patternWithDigits = default(string), string patternWithDigitsAndDelimiter = default(string), string patternWithBackslash = default(string)) { this.Number = number; // to ensure "_byte" is required (not null) @@ -91,6 +92,7 @@ protected FormatTest() this.Uuid = uuid; this.PatternWithDigits = patternWithDigits; this.PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + this.PatternWithBackslash = patternWithBackslash; this.AdditionalProperties = new Dictionary(); } @@ -208,6 +210,13 @@ protected FormatTest() [DataMember(Name = "pattern_with_digits_and_delimiter", EmitDefaultValue = false)] public string PatternWithDigitsAndDelimiter { get; set; } + /// + /// None + /// + /// None + [DataMember(Name = "pattern_with_backslash", EmitDefaultValue = false)] + public string PatternWithBackslash { get; set; } + /// /// Gets or Sets additional properties /// @@ -240,6 +249,7 @@ public override string ToString() sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); + sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -328,6 +338,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.PatternWithDigitsAndDelimiter.GetHashCode(); } + if (this.PatternWithBackslash != null) + { + hashCode = (hashCode * 59) + this.PatternWithBackslash.GetHashCode(); + } if (this.AdditionalProperties != null) { hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); @@ -416,7 +430,7 @@ public override int GetHashCode() } // String (string) pattern - Regex regexString = new Regex("[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexString.Match(this.String).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for String, must match a pattern of " + regexString, new [] { "String" }); @@ -435,19 +449,26 @@ public override int GetHashCode() } // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex("^\\d{10}$", RegexOptions.CultureInvariant); + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); if (false == regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex("^image_\\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } + // 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 (false == 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-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 01215c659711..2f284e4c6238 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -165,7 +165,7 @@ public override int GetHashCode() 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); + 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 (false == 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" }); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/api/openapi.yaml index 7942c294daca..8c4f6ce53f6d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/api/openapi.yaml @@ -1497,6 +1497,11 @@ components: to three digits following i.e. Image_01. pattern: "/^image_\\d{1,3}$/i" type: string + pattern_with_backslash: + description: None + pattern: "^(([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]))$" + type: string required: - byte - date diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/docs/FormatTest.md b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/docs/FormatTest.md index 1664a9d7c72b..c2144b5e3cf6 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/docs/FormatTest.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/docs/FormatTest.md @@ -22,6 +22,7 @@ Name | Type | Description | Notes **Password** | **string** | | **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] +**PatternWithBackslash** | **string** | None | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Client/ClientUtils.cs index 362905a2e52a..6653454671d2 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -32,7 +32,7 @@ public static class ClientUtils /// Filename public static string SanitizeFilename(string filename) { - Match match = Regex.Match(filename, ".*[/\\](.*)$"); + Match match = Regex.Match(filename, @".*[/\\](.*)$"); return match.Success ? match.Groups[1].Value : filename; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/FormatTest.cs index 2883d3eb9665..aaf92bb3848c 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/FormatTest.cs @@ -56,7 +56,8 @@ protected FormatTest() { } /// password (required). /// A string that is a 10 digit number. Can have leading zeros.. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.. - public FormatTest(int integer = default(int), int int32 = default(int), uint unsignedInteger = default(uint), long int64 = default(long), ulong unsignedLong = default(ulong), decimal number = default(decimal), float _float = default(float), double _double = default(double), decimal _decimal = default(decimal), string _string = default(string), byte[] _byte = default(byte[]), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), Guid uuid = default(Guid), string password = default(string), string patternWithDigits = default(string), string patternWithDigitsAndDelimiter = default(string)) + /// None. + public FormatTest(int integer = default(int), int int32 = default(int), uint unsignedInteger = default(uint), long int64 = default(long), ulong unsignedLong = default(ulong), decimal number = default(decimal), float _float = default(float), double _double = default(double), decimal _decimal = default(decimal), string _string = default(string), byte[] _byte = default(byte[]), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), Guid uuid = default(Guid), string password = default(string), string patternWithDigits = default(string), string patternWithDigitsAndDelimiter = default(string), string patternWithBackslash = default(string)) { this.Number = number; // to ensure "_byte" is required (not null) @@ -86,6 +87,7 @@ protected FormatTest() { } this.Uuid = uuid; this.PatternWithDigits = patternWithDigits; this.PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + this.PatternWithBackslash = patternWithBackslash; } /// @@ -202,6 +204,13 @@ protected FormatTest() { } [DataMember(Name = "pattern_with_digits_and_delimiter", EmitDefaultValue = false)] public string PatternWithDigitsAndDelimiter { get; set; } + /// + /// None + /// + /// None + [DataMember(Name = "pattern_with_backslash", EmitDefaultValue = false)] + public string PatternWithBackslash { get; set; } + /// /// Returns the string presentation of the object /// @@ -228,6 +237,7 @@ public override string ToString() sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); + sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -343,6 +353,11 @@ public bool Equals(FormatTest input) this.PatternWithDigitsAndDelimiter == input.PatternWithDigitsAndDelimiter || (this.PatternWithDigitsAndDelimiter != null && this.PatternWithDigitsAndDelimiter.Equals(input.PatternWithDigitsAndDelimiter)) + ) && + ( + this.PatternWithBackslash == input.PatternWithBackslash || + (this.PatternWithBackslash != null && + this.PatternWithBackslash.Equals(input.PatternWithBackslash)) ); } @@ -400,6 +415,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.PatternWithDigitsAndDelimiter.GetHashCode(); } + if (this.PatternWithBackslash != null) + { + hashCode = (hashCode * 59) + this.PatternWithBackslash.GetHashCode(); + } return hashCode; } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClient/api/openapi.yaml index 7942c294daca..8c4f6ce53f6d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/api/openapi.yaml @@ -1497,6 +1497,11 @@ components: to three digits following i.e. Image_01. pattern: "/^image_\\d{1,3}$/i" type: string + pattern_with_backslash: + description: None + pattern: "^(([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]))$" + type: string required: - byte - date diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/FormatTest.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/FormatTest.md index 1664a9d7c72b..c2144b5e3cf6 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/FormatTest.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/FormatTest.md @@ -22,6 +22,7 @@ Name | Type | Description | Notes **Password** | **string** | | **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] +**PatternWithBackslash** | **string** | None | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Client/ClientUtils.cs index 85ec43412716..8e33ee2d9b5b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -46,7 +46,7 @@ static ClientUtils() /// Filename public static string SanitizeFilename(string filename) { - Match match = Regex.Match(filename, ".*[/\\](.*)$"); + Match match = Regex.Match(filename, @".*[/\\](.*)$"); return match.Success ? match.Groups[1].Value : filename; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Apple.cs index c8ffe52a70af..852a74fb6e65 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/Apple.cs @@ -139,14 +139,14 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { // Cultivar (string) pattern - Regex regexCultivar = new Regex("^[a-zA-Z\\s]*$", RegexOptions.CultureInvariant); + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); if (false == regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } // Origin (string) pattern - Regex regexOrigin = new Regex("^[A-Z\\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs index c3fa57791cfe..6a81d63215f0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs @@ -61,7 +61,8 @@ protected FormatTest() /// password (required). /// A string that is a 10 digit number. Can have leading zeros.. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.. - public FormatTest(int integer = default(int), int int32 = default(int), uint unsignedInteger = default(uint), long int64 = default(long), ulong unsignedLong = default(ulong), decimal number = default(decimal), float _float = default(float), double _double = default(double), decimal _decimal = default(decimal), string _string = default(string), byte[] _byte = default(byte[]), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), Guid uuid = default(Guid), string password = default(string), string patternWithDigits = default(string), string patternWithDigitsAndDelimiter = default(string)) + /// None. + public FormatTest(int integer = default(int), int int32 = default(int), uint unsignedInteger = default(uint), long int64 = default(long), ulong unsignedLong = default(ulong), decimal number = default(decimal), float _float = default(float), double _double = default(double), decimal _decimal = default(decimal), string _string = default(string), byte[] _byte = default(byte[]), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), Guid uuid = default(Guid), string password = default(string), string patternWithDigits = default(string), string patternWithDigitsAndDelimiter = default(string), string patternWithBackslash = default(string)) { this.Number = number; // to ensure "_byte" is required (not null) @@ -91,6 +92,7 @@ protected FormatTest() this.Uuid = uuid; this.PatternWithDigits = patternWithDigits; this.PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + this.PatternWithBackslash = patternWithBackslash; this.AdditionalProperties = new Dictionary(); } @@ -208,6 +210,13 @@ protected FormatTest() [DataMember(Name = "pattern_with_digits_and_delimiter", EmitDefaultValue = false)] public string PatternWithDigitsAndDelimiter { get; set; } + /// + /// None + /// + /// None + [DataMember(Name = "pattern_with_backslash", EmitDefaultValue = false)] + public string PatternWithBackslash { get; set; } + /// /// Gets or Sets additional properties /// @@ -240,6 +249,7 @@ public override string ToString() sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); + sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -328,6 +338,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.PatternWithDigitsAndDelimiter.GetHashCode(); } + if (this.PatternWithBackslash != null) + { + hashCode = (hashCode * 59) + this.PatternWithBackslash.GetHashCode(); + } if (this.AdditionalProperties != null) { hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); @@ -416,7 +430,7 @@ public override int GetHashCode() } // String (string) pattern - Regex regexString = new Regex("[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexString.Match(this.String).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for String, must match a pattern of " + regexString, new [] { "String" }); @@ -435,19 +449,26 @@ public override int GetHashCode() } // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex("^\\d{10}$", RegexOptions.CultureInvariant); + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); if (false == regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex("^image_\\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } + // 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 (false == 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-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 01215c659711..2f284e4c6238 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -165,7 +165,7 @@ public override int GetHashCode() 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); + 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 (false == 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" }); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/api/openapi.yaml b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/api/openapi.yaml index 7942c294daca..8c4f6ce53f6d 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/api/openapi.yaml +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/api/openapi.yaml @@ -1497,6 +1497,11 @@ components: to three digits following i.e. Image_01. pattern: "/^image_\\d{1,3}$/i" type: string + pattern_with_backslash: + description: None + pattern: "^(([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]))$" + type: string required: - byte - date diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/FormatTest.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/FormatTest.md index 1664a9d7c72b..c2144b5e3cf6 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/FormatTest.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/FormatTest.md @@ -22,6 +22,7 @@ Name | Type | Description | Notes **Password** | **string** | | **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] +**PatternWithBackslash** | **string** | None | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Client/ClientUtils.cs index 85ec43412716..8e33ee2d9b5b 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -46,7 +46,7 @@ static ClientUtils() /// Filename public static string SanitizeFilename(string filename) { - Match match = Regex.Match(filename, ".*[/\\](.*)$"); + Match match = Regex.Match(filename, @".*[/\\](.*)$"); return match.Success ? match.Groups[1].Value : filename; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Apple.cs index d5b2f61f0855..dd8a5e7291a2 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/Apple.cs @@ -127,14 +127,14 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { // Cultivar (string) pattern - Regex regexCultivar = new Regex("^[a-zA-Z\\s]*$", RegexOptions.CultureInvariant); + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); if (false == regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } // Origin (string) pattern - Regex regexOrigin = new Regex("^[A-Z\\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs index f70aacdccba2..6139fa7c1f81 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -58,7 +58,8 @@ protected FormatTest() { } /// password (required). /// A string that is a 10 digit number. Can have leading zeros.. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.. - public FormatTest(int integer = default(int), int int32 = default(int), uint unsignedInteger = default(uint), long int64 = default(long), ulong unsignedLong = default(ulong), decimal number = default(decimal), float _float = default(float), double _double = default(double), decimal _decimal = default(decimal), string _string = default(string), byte[] _byte = default(byte[]), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), Guid uuid = default(Guid), string password = default(string), string patternWithDigits = default(string), string patternWithDigitsAndDelimiter = default(string)) + /// None. + public FormatTest(int integer = default(int), int int32 = default(int), uint unsignedInteger = default(uint), long int64 = default(long), ulong unsignedLong = default(ulong), decimal number = default(decimal), float _float = default(float), double _double = default(double), decimal _decimal = default(decimal), string _string = default(string), byte[] _byte = default(byte[]), System.IO.Stream binary = default(System.IO.Stream), DateTime date = default(DateTime), DateTime dateTime = default(DateTime), Guid uuid = default(Guid), string password = default(string), string patternWithDigits = default(string), string patternWithDigitsAndDelimiter = default(string), string patternWithBackslash = default(string)) { this.Number = number; // to ensure "_byte" is required (not null) @@ -88,6 +89,7 @@ protected FormatTest() { } this.Uuid = uuid; this.PatternWithDigits = patternWithDigits; this.PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; + this.PatternWithBackslash = patternWithBackslash; } /// @@ -204,6 +206,13 @@ protected FormatTest() { } [DataMember(Name = "pattern_with_digits_and_delimiter", EmitDefaultValue = false)] public string PatternWithDigitsAndDelimiter { get; set; } + /// + /// None + /// + /// None + [DataMember(Name = "pattern_with_backslash", EmitDefaultValue = false)] + public string PatternWithBackslash { get; set; } + /// /// Returns the string presentation of the object /// @@ -230,6 +239,7 @@ public override string ToString() sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); + sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -317,6 +327,10 @@ public override int GetHashCode() { hashCode = (hashCode * 59) + this.PatternWithDigitsAndDelimiter.GetHashCode(); } + if (this.PatternWithBackslash != null) + { + hashCode = (hashCode * 59) + this.PatternWithBackslash.GetHashCode(); + } return hashCode; } } @@ -401,7 +415,7 @@ public override int GetHashCode() } // String (string) pattern - Regex regexString = new Regex("[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexString.Match(this.String).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for String, must match a pattern of " + regexString, new [] { "String" }); @@ -420,19 +434,26 @@ public override int GetHashCode() } // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex("^\\d{10}$", RegexOptions.CultureInvariant); + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); if (false == regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex("^image_\\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } + // 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 (false == 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-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index b656f39cb32d..fe3fb74e4d6e 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -153,7 +153,7 @@ public override int GetHashCode() 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); + 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 (false == 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" }); diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Client/ClientUtils.cs index 8aa6221bd12f..4e45e6485db0 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -46,7 +46,7 @@ static ClientUtils() /// Filename public static string SanitizeFilename(string filename) { - Match match = Regex.Match(filename, ".*[/\\](.*)$"); + Match match = Regex.Match(filename, @".*[/\\](.*)$"); return match.Success ? match.Groups[1].Value : filename; } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp-netcore/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Model/Category.cs index 7d870f6d86d4..efd161e349ff 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Model/Category.cs @@ -124,7 +124,7 @@ public override int GetHashCode() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { // Name (string) pattern - Regex regexName = new Regex("^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$", RegexOptions.CultureInvariant); + Regex regexName = new Regex(@"^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$", RegexOptions.CultureInvariant); if (false == regexName.Match(this.Name).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Name, must match a pattern of " + regexName, new [] { "Name" }); 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 132ac07b6e4e..7407b8263652 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 @@ -495,7 +495,7 @@ public override int GetHashCode() // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex(@"^\\d{10}$", RegexOptions.CultureInvariant); + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); if (false == regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); @@ -504,7 +504,7 @@ public override int GetHashCode() // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); if (false == regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" });