[csharp] Improved regex support (#16269)

* improved regex support

* better parsing of options

* better handling of options

* spacing change

* typo

* rename the x-modifier- extension

* trivial change

* added to the sample
This commit is contained in:
devhl-labs 2023-08-07 23:40:20 -04:00 committed by GitHub
parent 362b596fce
commit de8f846666
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
74 changed files with 529 additions and 112 deletions

View File

@ -37,6 +37,7 @@ import java.io.File;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.ArrayList;
import java.util.Comparator;
@ -115,7 +116,6 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
protected boolean validatable = Boolean.TRUE;
protected boolean equatable = Boolean.TRUE;
protected Map<Character, String> regexModifiers;
// By default, generated code is considered public
protected boolean nonPublicApi = Boolean.FALSE;
@ -323,12 +323,6 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
CodegenConstants.EQUATABLE_DESC,
this.equatable);
regexModifiers = new HashMap<>();
regexModifiers.put('i', "IgnoreCase");
regexModifiers.put('m', "Multiline");
regexModifiers.put('s', "Singleline");
regexModifiers.put('x', "IgnorePatternWhitespace");
supportedLibraries.put(GENERICHOST, "HttpClient with Generic Host dependency injection (https://docs.microsoft.com/en-us/dotnet/core/extensions/generic-host) "
+ "(Experimental. Subject to breaking changes without notice.)");
supportedLibraries.put(HTTPCLIENT, "HttpClient (https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient) "
@ -639,36 +633,45 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
}
/*
* The pattern spec follows the Perl convention and style of modifiers. .NET
* does not support this syntax directly so we need to convert the pattern to a .NET compatible
* format and apply modifiers in a compatible way.
* See https://msdn.microsoft.com/en-us/library/yd1hzczs(v=vs.110).aspx for .NET options.
*/
public void postProcessPattern(String pattern, Map<String, Object> vendorExtensions) {
if (pattern != null) {
int i = pattern.lastIndexOf('/');
// check if the pattern has any modifiers
// gmiyuvsd - ecma modifiers
// l - legacy modifier provided by this library, provides a way to opt out of culture invariant
// nx - c# modifiers https://learn.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-options
Pattern hasModifiers = Pattern.compile(".*/[gmiyuvsdlnx]+$");
//Must follow Perl /pattern/modifiers convention
if (pattern.charAt(0) != '/' || i < 2) {
throw new IllegalArgumentException("Pattern must follow the Perl "
+ "/pattern/modifiers convention. " + pattern + " is not valid.");
}
int end = hasModifiers.matcher(pattern).find()
? pattern.lastIndexOf('/')
: pattern.length() - 1;
int start = pattern.startsWith("/")
? 1
: 0;
Map<Character, String> optionsMap = new HashMap();
optionsMap.put('i', "IgnoreCase");
optionsMap.put('m', "Multiline");
optionsMap.put('s', "SingleLine");
optionsMap.put('n', "ExplicitCapture");
optionsMap.put('x', "IgnorePatternWhitespace");
String regex = pattern.substring(1, i).replace("'", "\'").replace("\"", "\"\"");
List<String> modifiers = new ArrayList<String>();
// perl requires an explicit modifier to be culture specific and .NET is the reverse.
modifiers.add("CultureInvariant");
for (char c : pattern.substring(i).toCharArray()) {
if (regexModifiers.containsKey(c)) {
String modifier = regexModifiers.get(c);
modifiers.add(modifier);
} else if (c == 'l') {
for (char c : pattern.substring(end).toCharArray()) {
if (optionsMap.containsKey(c)) {
modifiers.add(optionsMap.get(c));
} else if (c == 'l'){
modifiers.remove("CultureInvariant");
} else {
vendorExtensions.put("x-modifier-" + c, c);
}
}
String regex = pattern.substring(start, end).replace("'", "\'").replace("\"", "\"\"");
vendorExtensions.put("x-regex", regex);
vendorExtensions.put("x-modifiers", modifiers);
}

View File

@ -97,24 +97,32 @@
{{#vendorExtensions.x-is-value-type}}
{{#isNullable}}
if (this.{{{name}}} != null){
{{#lambda.trimTrailingWhiteSpace}}
{{#lambda.indent4}}
{{>ValidateRegex}}
{{/lambda.indent4}}
{{/lambda.trimTrailingWhiteSpace}}
}
{{/isNullable}}
{{^isNullable}}
{{#lambda.trimTrailingWhiteSpace}}
{{#lambda.indent3}}
{{>ValidateRegex}}
{{/lambda.indent3}}
{{/lambda.trimTrailingWhiteSpace}}
{{/isNullable}}
{{/vendorExtensions.x-is-value-type}}
{{^vendorExtensions.x-is-value-type}}
if (this.{{{name}}} != null) {
{{#lambda.trimTrailingWhiteSpace}}
{{#lambda.indent4}}
{{>ValidateRegex}}
{{/lambda.indent4}}
{{/lambda.trimTrailingWhiteSpace}}
}
{{/vendorExtensions.x-is-value-type}}

View File

@ -1979,6 +1979,9 @@ components:
origin:
type: string
pattern: /^[A-Z\s]*$/i
color_code:
type: string
pattern: ^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$
nullable: true
banana:
type: object

View File

@ -1941,6 +1941,9 @@ components:
origin:
pattern: "/^[A-Z\\s]*$/i"
type: string
color_code:
pattern: "^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$"
type: string
type: object
banana:
properties:

View File

@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [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)

View File

@ -7,6 +7,7 @@ Name | Type | Description | Notes
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [optional]
**LengthCm** | **decimal** | | [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)

View File

@ -7,6 +7,7 @@ Name | Type | Description | Notes
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [optional]
**LengthCm** | **decimal** | | [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)

View File

@ -37,7 +37,8 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="cultivar">cultivar.</param>
/// <param name="origin">origin.</param>
public Apple(string cultivar = default(string), string origin = default(string))
/// <param name="colorCode">colorCode.</param>
public Apple(string cultivar = default(string), string origin = default(string), string colorCode = default(string))
{
this._Cultivar = cultivar;
if (this.Cultivar != null)
@ -49,6 +50,11 @@ namespace Org.OpenAPITools.Model
{
this._flagOrigin = true;
}
this._ColorCode = colorCode;
if (this.ColorCode != null)
{
this._flagColorCode = true;
}
this.AdditionalProperties = new Dictionary<string, object>();
}
@ -101,6 +107,30 @@ namespace Org.OpenAPITools.Model
return _flagOrigin;
}
/// <summary>
/// Gets or Sets ColorCode
/// </summary>
[DataMember(Name = "color_code", EmitDefaultValue = false)]
public string ColorCode
{
get{ return _ColorCode;}
set
{
_ColorCode = value;
_flagColorCode = true;
}
}
private string _ColorCode;
private bool _flagColorCode;
/// <summary>
/// Returns false as ColorCode should not be serialized given that it's read-only.
/// </summary>
/// <returns>false (boolean)</returns>
public bool ShouldSerializeColorCode()
{
return _flagColorCode;
}
/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
@ -116,6 +146,7 @@ namespace Org.OpenAPITools.Model
sb.Append("class Apple {\n");
sb.Append(" Cultivar: ").Append(Cultivar).Append("\n");
sb.Append(" Origin: ").Append(Origin).Append("\n");
sb.Append(" ColorCode: ").Append(ColorCode).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
@ -167,6 +198,10 @@ namespace Org.OpenAPITools.Model
{
hashCode = (hashCode * 59) + this.Origin.GetHashCode();
}
if (this.ColorCode != null)
{
hashCode = (hashCode * 59) + this.ColorCode.GetHashCode();
}
if (this.AdditionalProperties != null)
{
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
@ -188,7 +223,8 @@ namespace Org.OpenAPITools.Model
if (!regexCultivar.Match(this.Cultivar).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" });
} }
}
}
if (this.Origin != null) {
// Origin (string) pattern
@ -196,7 +232,17 @@ namespace Org.OpenAPITools.Model
if (!regexOrigin.Match(this.Origin).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" });
} }
}
}
if (this.ColorCode != null) {
// ColorCode (string) pattern
Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant);
if (!regexColorCode.Match(this.ColorCode).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" });
}
}
yield break;
}

View File

@ -837,7 +837,8 @@ namespace Org.OpenAPITools.Model
if (!regexVarString.Match(this.VarString).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" });
} }
}
}
// Password (string) maxLength
if (this.Password != null && this.Password.Length > 64)
@ -857,7 +858,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" });
} }
}
}
if (this.PatternWithDigitsAndDelimiter != null) {
// PatternWithDigitsAndDelimiter (string) pattern
@ -865,7 +867,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" });
} }
}
}
if (this.PatternWithBackslash != null) {
// PatternWithBackslash (string) pattern
@ -873,7 +876,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" });
} }
}
}
yield break;
}

View File

@ -258,7 +258,8 @@ namespace Org.OpenAPITools.Model
if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" });
} }
}
}
yield break;
}

View File

@ -47,7 +47,7 @@ namespace OpenAPIClient_generichost_manual_tests
[TestMethod]
public void Apple()
{
Apple apple = new("cultivar", "origin");
Apple apple = new("#000000", "cultivar", "origin");
string appleJson = JsonSerializer.Serialize(apple, _jsonSerializerOptions);
Apple? apple2 = JsonSerializer.Deserialize<Apple>(appleJson, _jsonSerializerOptions);
Assert.IsTrue(apple2 != null && apple.Cultivar.Equals(apple2.Cultivar) && apple.Origin.Equals(apple2.Origin));
@ -81,7 +81,7 @@ namespace OpenAPIClient_generichost_manual_tests
[TestMethod]
public void GmFruit()
{
Apple apple = new("cultivar", "origin");
Apple apple = new("#000000", "cultivar", "origin");
Banana banana = new(10);
GmFruit gmFruit = new(apple, banana, "yellow");
string gmFruitJson = JsonSerializer.Serialize(gmFruit, _jsonSerializerOptions);

View File

@ -1941,6 +1941,9 @@ components:
origin:
pattern: "/^[A-Z\\s]*$/i"
type: string
color_code:
pattern: "^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$"
type: string
type: object
banana:
properties:

View File

@ -4,6 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ColorCode** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]

View File

@ -33,11 +33,13 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// Initializes a new instance of the <see cref="Apple" /> class.
/// </summary>
/// <param name="colorCode">colorCode</param>
/// <param name="cultivar">cultivar</param>
/// <param name="origin">origin</param>
[JsonConstructor]
public Apple(string cultivar, string origin)
public Apple(string colorCode, string cultivar, string origin)
{
ColorCode = colorCode;
Cultivar = cultivar;
Origin = origin;
OnCreated();
@ -45,6 +47,12 @@ namespace Org.OpenAPITools.Model
partial void OnCreated();
/// <summary>
/// Gets or Sets ColorCode
/// </summary>
[JsonPropertyName("color_code")]
public string ColorCode { get; set; }
/// <summary>
/// Gets or Sets Cultivar
/// </summary>
@ -71,6 +79,7 @@ namespace Org.OpenAPITools.Model
{
StringBuilder sb = new StringBuilder();
sb.Append("class Apple {\n");
sb.Append(" ColorCode: ").Append(ColorCode).Append("\n");
sb.Append(" Cultivar: ").Append(Cultivar).Append("\n");
sb.Append(" Origin: ").Append(Origin).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
@ -85,13 +94,23 @@ namespace Org.OpenAPITools.Model
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
if (this.ColorCode != null) {
// ColorCode (string) pattern
Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant);
if (!regexColorCode.Match(this.ColorCode).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" });
}
}
if (this.Cultivar != null) {
// Cultivar (string) pattern
Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant);
if (!regexCultivar.Match(this.Cultivar).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" });
} }
}
}
if (this.Origin != null) {
// Origin (string) pattern
@ -99,7 +118,8 @@ namespace Org.OpenAPITools.Model
if (!regexOrigin.Match(this.Origin).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" });
} }
}
}
yield break;
}
@ -127,6 +147,7 @@ namespace Org.OpenAPITools.Model
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
string? colorCode = default;
string? cultivar = default;
string? origin = default;
@ -145,6 +166,9 @@ namespace Org.OpenAPITools.Model
switch (propertyName)
{
case "color_code":
colorCode = utf8JsonReader.GetString();
break;
case "cultivar":
cultivar = utf8JsonReader.GetString();
break;
@ -157,13 +181,16 @@ namespace Org.OpenAPITools.Model
}
}
if (colorCode == null)
throw new ArgumentNullException(nameof(colorCode), "Property is required for class Apple.");
if (cultivar == null)
throw new ArgumentNullException(nameof(cultivar), "Property is required for class Apple.");
if (origin == null)
throw new ArgumentNullException(nameof(origin), "Property is required for class Apple.");
return new Apple(cultivar, origin);
return new Apple(colorCode, cultivar, origin);
}
/// <summary>
@ -190,6 +217,7 @@ namespace Org.OpenAPITools.Model
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteString("color_code", apple.ColorCode);
writer.WriteString("cultivar", apple.Cultivar);
writer.WriteString("origin", apple.Origin);
}

View File

@ -322,7 +322,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" });
} }
}
}
if (this.PatternWithDigits != null) {
// PatternWithDigits (string) pattern
@ -330,7 +331,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" });
} }
}
}
if (this.PatternWithDigitsAndDelimiter != null) {
// PatternWithDigitsAndDelimiter (string) pattern
@ -338,7 +340,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" });
} }
}
}
if (this.VarString != null) {
// VarString (string) pattern
@ -346,7 +349,8 @@ namespace Org.OpenAPITools.Model
if (!regexVarString.Match(this.VarString).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" });
} }
}
}
// UnsignedInteger (uint) maximum
if (this.UnsignedInteger > (uint)200)

View File

@ -108,7 +108,8 @@ namespace Org.OpenAPITools.Model
if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" });
} yield break;
}
yield break;
}
}

View File

@ -1941,6 +1941,9 @@ components:
origin:
pattern: "/^[A-Z\\s]*$/i"
type: string
color_code:
pattern: "^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$"
type: string
type: object
banana:
properties:

View File

@ -4,6 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ColorCode** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]

View File

@ -31,11 +31,13 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// Initializes a new instance of the <see cref="Apple" /> class.
/// </summary>
/// <param name="colorCode">colorCode</param>
/// <param name="cultivar">cultivar</param>
/// <param name="origin">origin</param>
[JsonConstructor]
public Apple(string cultivar, string origin)
public Apple(string colorCode, string cultivar, string origin)
{
ColorCode = colorCode;
Cultivar = cultivar;
Origin = origin;
OnCreated();
@ -43,6 +45,12 @@ namespace Org.OpenAPITools.Model
partial void OnCreated();
/// <summary>
/// Gets or Sets ColorCode
/// </summary>
[JsonPropertyName("color_code")]
public string ColorCode { get; set; }
/// <summary>
/// Gets or Sets Cultivar
/// </summary>
@ -69,6 +77,7 @@ namespace Org.OpenAPITools.Model
{
StringBuilder sb = new StringBuilder();
sb.Append("class Apple {\n");
sb.Append(" ColorCode: ").Append(ColorCode).Append("\n");
sb.Append(" Cultivar: ").Append(Cultivar).Append("\n");
sb.Append(" Origin: ").Append(Origin).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
@ -83,13 +92,23 @@ namespace Org.OpenAPITools.Model
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
if (this.ColorCode != null) {
// ColorCode (string) pattern
Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant);
if (!regexColorCode.Match(this.ColorCode).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" });
}
}
if (this.Cultivar != null) {
// Cultivar (string) pattern
Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant);
if (!regexCultivar.Match(this.Cultivar).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" });
} }
}
}
if (this.Origin != null) {
// Origin (string) pattern
@ -97,7 +116,8 @@ namespace Org.OpenAPITools.Model
if (!regexOrigin.Match(this.Origin).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" });
} }
}
}
yield break;
}
@ -125,6 +145,7 @@ namespace Org.OpenAPITools.Model
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
string colorCode = default;
string cultivar = default;
string origin = default;
@ -143,6 +164,9 @@ namespace Org.OpenAPITools.Model
switch (propertyName)
{
case "color_code":
colorCode = utf8JsonReader.GetString();
break;
case "cultivar":
cultivar = utf8JsonReader.GetString();
break;
@ -155,13 +179,16 @@ namespace Org.OpenAPITools.Model
}
}
if (colorCode == null)
throw new ArgumentNullException(nameof(colorCode), "Property is required for class Apple.");
if (cultivar == null)
throw new ArgumentNullException(nameof(cultivar), "Property is required for class Apple.");
if (origin == null)
throw new ArgumentNullException(nameof(origin), "Property is required for class Apple.");
return new Apple(cultivar, origin);
return new Apple(colorCode, cultivar, origin);
}
/// <summary>
@ -188,6 +215,7 @@ namespace Org.OpenAPITools.Model
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteString("color_code", apple.ColorCode);
writer.WriteString("cultivar", apple.Cultivar);
writer.WriteString("origin", apple.Origin);
}

View File

@ -320,7 +320,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" });
} }
}
}
if (this.PatternWithDigits != null) {
// PatternWithDigits (string) pattern
@ -328,7 +329,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" });
} }
}
}
if (this.PatternWithDigitsAndDelimiter != null) {
// PatternWithDigitsAndDelimiter (string) pattern
@ -336,7 +338,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" });
} }
}
}
if (this.VarString != null) {
// VarString (string) pattern
@ -344,7 +347,8 @@ namespace Org.OpenAPITools.Model
if (!regexVarString.Match(this.VarString).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" });
} }
}
}
// UnsignedInteger (uint) maximum
if (this.UnsignedInteger > (uint)200)

View File

@ -106,7 +106,8 @@ namespace Org.OpenAPITools.Model
if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" });
} yield break;
}
yield break;
}
}

View File

@ -1941,6 +1941,9 @@ components:
origin:
pattern: "/^[A-Z\\s]*$/i"
type: string
color_code:
pattern: "^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$"
type: string
type: object
banana:
properties:

View File

@ -4,6 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ColorCode** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]

View File

@ -31,11 +31,13 @@ namespace Org.OpenAPITools.Model
/// <summary>
/// Initializes a new instance of the <see cref="Apple" /> class.
/// </summary>
/// <param name="colorCode">colorCode</param>
/// <param name="cultivar">cultivar</param>
/// <param name="origin">origin</param>
[JsonConstructor]
public Apple(string cultivar, string origin)
public Apple(string colorCode, string cultivar, string origin)
{
ColorCode = colorCode;
Cultivar = cultivar;
Origin = origin;
OnCreated();
@ -43,6 +45,12 @@ namespace Org.OpenAPITools.Model
partial void OnCreated();
/// <summary>
/// Gets or Sets ColorCode
/// </summary>
[JsonPropertyName("color_code")]
public string ColorCode { get; set; }
/// <summary>
/// Gets or Sets Cultivar
/// </summary>
@ -69,6 +77,7 @@ namespace Org.OpenAPITools.Model
{
StringBuilder sb = new StringBuilder();
sb.Append("class Apple {\n");
sb.Append(" ColorCode: ").Append(ColorCode).Append("\n");
sb.Append(" Cultivar: ").Append(Cultivar).Append("\n");
sb.Append(" Origin: ").Append(Origin).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
@ -83,13 +92,23 @@ namespace Org.OpenAPITools.Model
/// <returns>Validation Result</returns>
IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
if (this.ColorCode != null) {
// ColorCode (string) pattern
Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant);
if (!regexColorCode.Match(this.ColorCode).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" });
}
}
if (this.Cultivar != null) {
// Cultivar (string) pattern
Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant);
if (!regexCultivar.Match(this.Cultivar).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" });
} }
}
}
if (this.Origin != null) {
// Origin (string) pattern
@ -97,7 +116,8 @@ namespace Org.OpenAPITools.Model
if (!regexOrigin.Match(this.Origin).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" });
} }
}
}
yield break;
}
@ -125,6 +145,7 @@ namespace Org.OpenAPITools.Model
JsonTokenType startingTokenType = utf8JsonReader.TokenType;
string colorCode = default;
string cultivar = default;
string origin = default;
@ -143,6 +164,9 @@ namespace Org.OpenAPITools.Model
switch (propertyName)
{
case "color_code":
colorCode = utf8JsonReader.GetString();
break;
case "cultivar":
cultivar = utf8JsonReader.GetString();
break;
@ -155,13 +179,16 @@ namespace Org.OpenAPITools.Model
}
}
if (colorCode == null)
throw new ArgumentNullException(nameof(colorCode), "Property is required for class Apple.");
if (cultivar == null)
throw new ArgumentNullException(nameof(cultivar), "Property is required for class Apple.");
if (origin == null)
throw new ArgumentNullException(nameof(origin), "Property is required for class Apple.");
return new Apple(cultivar, origin);
return new Apple(colorCode, cultivar, origin);
}
/// <summary>
@ -188,6 +215,7 @@ namespace Org.OpenAPITools.Model
/// <exception cref="NotImplementedException"></exception>
public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions)
{
writer.WriteString("color_code", apple.ColorCode);
writer.WriteString("cultivar", apple.Cultivar);
writer.WriteString("origin", apple.Origin);
}

View File

@ -320,7 +320,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" });
} }
}
}
if (this.PatternWithDigits != null) {
// PatternWithDigits (string) pattern
@ -328,7 +329,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" });
} }
}
}
if (this.PatternWithDigitsAndDelimiter != null) {
// PatternWithDigitsAndDelimiter (string) pattern
@ -336,7 +338,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" });
} }
}
}
if (this.VarString != null) {
// VarString (string) pattern
@ -344,7 +347,8 @@ namespace Org.OpenAPITools.Model
if (!regexVarString.Match(this.VarString).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" });
} }
}
}
// UnsignedInteger (uint) maximum
if (this.UnsignedInteger > (uint)200)

View File

@ -106,7 +106,8 @@ namespace Org.OpenAPITools.Model
if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" });
} yield break;
}
yield break;
}
}

View File

@ -1941,6 +1941,9 @@ components:
origin:
pattern: "/^[A-Z\\s]*$/i"
type: string
color_code:
pattern: "^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$"
type: string
type: object
banana:
properties:

View File

@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [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)

View File

@ -7,6 +7,7 @@ Name | Type | Description | Notes
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [optional]
**LengthCm** | **decimal** | | [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)

View File

@ -7,6 +7,7 @@ Name | Type | Description | Notes
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [optional]
**LengthCm** | **decimal** | | [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)

View File

@ -38,10 +38,12 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="cultivar">cultivar.</param>
/// <param name="origin">origin.</param>
public Apple(string cultivar = default(string), string origin = default(string))
/// <param name="colorCode">colorCode.</param>
public Apple(string cultivar = default(string), string origin = default(string), string colorCode = default(string))
{
this.Cultivar = cultivar;
this.Origin = origin;
this.ColorCode = colorCode;
this.AdditionalProperties = new Dictionary<string, object>();
}
@ -57,6 +59,12 @@ namespace Org.OpenAPITools.Model
[DataMember(Name = "origin", EmitDefaultValue = false)]
public string Origin { get; set; }
/// <summary>
/// Gets or Sets ColorCode
/// </summary>
[DataMember(Name = "color_code", EmitDefaultValue = false)]
public string ColorCode { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
@ -73,6 +81,7 @@ namespace Org.OpenAPITools.Model
sb.Append("class Apple {\n");
sb.Append(" Cultivar: ").Append(Cultivar).Append("\n");
sb.Append(" Origin: ").Append(Origin).Append("\n");
sb.Append(" ColorCode: ").Append(ColorCode).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
@ -124,6 +133,10 @@ namespace Org.OpenAPITools.Model
{
hashCode = (hashCode * 59) + this.Origin.GetHashCode();
}
if (this.ColorCode != null)
{
hashCode = (hashCode * 59) + this.ColorCode.GetHashCode();
}
if (this.AdditionalProperties != null)
{
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
@ -145,7 +158,8 @@ namespace Org.OpenAPITools.Model
if (!regexCultivar.Match(this.Cultivar).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" });
} }
}
}
if (this.Origin != null) {
// Origin (string) pattern
@ -153,7 +167,17 @@ namespace Org.OpenAPITools.Model
if (!regexOrigin.Match(this.Origin).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" });
} }
}
}
if (this.ColorCode != null) {
// ColorCode (string) pattern
Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant);
if (!regexColorCode.Match(this.ColorCode).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" });
}
}
yield break;
}

View File

@ -436,7 +436,8 @@ namespace Org.OpenAPITools.Model
if (!regexVarString.Match(this.VarString).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" });
} }
}
}
// Password (string) maxLength
if (this.Password != null && this.Password.Length > 64)
@ -456,7 +457,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" });
} }
}
}
if (this.PatternWithDigitsAndDelimiter != null) {
// PatternWithDigitsAndDelimiter (string) pattern
@ -464,7 +466,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" });
} }
}
}
if (this.PatternWithBackslash != null) {
// PatternWithBackslash (string) pattern
@ -472,7 +475,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" });
} }
}
}
yield break;
}

View File

@ -171,7 +171,8 @@ namespace Org.OpenAPITools.Model
if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" });
} }
}
}
yield break;
}

View File

@ -1941,6 +1941,9 @@ components:
origin:
pattern: "/^[A-Z\\s]*$/i"
type: string
color_code:
pattern: "^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$"
type: string
type: object
banana:
properties:

View File

@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [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)

View File

@ -7,6 +7,7 @@ Name | Type | Description | Notes
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [optional]
**LengthCm** | **decimal** | | [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)

View File

@ -7,6 +7,7 @@ Name | Type | Description | Notes
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [optional]
**LengthCm** | **decimal** | | [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)

View File

@ -37,10 +37,12 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="cultivar">cultivar.</param>
/// <param name="origin">origin.</param>
public Apple(string cultivar = default(string), string origin = default(string))
/// <param name="colorCode">colorCode.</param>
public Apple(string cultivar = default(string), string origin = default(string), string colorCode = default(string))
{
this.Cultivar = cultivar;
this.Origin = origin;
this.ColorCode = colorCode;
this.AdditionalProperties = new Dictionary<string, object>();
}
@ -56,6 +58,12 @@ namespace Org.OpenAPITools.Model
[DataMember(Name = "origin", EmitDefaultValue = false)]
public string Origin { get; set; }
/// <summary>
/// Gets or Sets ColorCode
/// </summary>
[DataMember(Name = "color_code", EmitDefaultValue = false)]
public string ColorCode { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
@ -72,6 +80,7 @@ namespace Org.OpenAPITools.Model
sb.Append("class Apple {\n");
sb.Append(" Cultivar: ").Append(Cultivar).Append("\n");
sb.Append(" Origin: ").Append(Origin).Append("\n");
sb.Append(" ColorCode: ").Append(ColorCode).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
@ -123,6 +132,10 @@ namespace Org.OpenAPITools.Model
{
hashCode = (hashCode * 59) + this.Origin.GetHashCode();
}
if (this.ColorCode != null)
{
hashCode = (hashCode * 59) + this.ColorCode.GetHashCode();
}
if (this.AdditionalProperties != null)
{
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
@ -144,7 +157,8 @@ namespace Org.OpenAPITools.Model
if (!regexCultivar.Match(this.Cultivar).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" });
} }
}
}
if (this.Origin != null) {
// Origin (string) pattern
@ -152,7 +166,17 @@ namespace Org.OpenAPITools.Model
if (!regexOrigin.Match(this.Origin).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" });
} }
}
}
if (this.ColorCode != null) {
// ColorCode (string) pattern
Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant);
if (!regexColorCode.Match(this.ColorCode).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" });
}
}
yield break;
}

View File

@ -435,7 +435,8 @@ namespace Org.OpenAPITools.Model
if (!regexVarString.Match(this.VarString).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" });
} }
}
}
// Password (string) maxLength
if (this.Password != null && this.Password.Length > 64)
@ -455,7 +456,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" });
} }
}
}
if (this.PatternWithDigitsAndDelimiter != null) {
// PatternWithDigitsAndDelimiter (string) pattern
@ -463,7 +465,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" });
} }
}
}
if (this.PatternWithBackslash != null) {
// PatternWithBackslash (string) pattern
@ -471,7 +474,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" });
} }
}
}
yield break;
}

View File

@ -170,7 +170,8 @@ namespace Org.OpenAPITools.Model
if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" });
} }
}
}
yield break;
}

View File

@ -1941,6 +1941,9 @@ components:
origin:
pattern: "/^[A-Z\\s]*$/i"
type: string
color_code:
pattern: "^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$"
type: string
type: object
banana:
properties:

View File

@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [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)

View File

@ -7,6 +7,7 @@ Name | Type | Description | Notes
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [optional]
**LengthCm** | **decimal** | | [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)

View File

@ -7,6 +7,7 @@ Name | Type | Description | Notes
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [optional]
**LengthCm** | **decimal** | | [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)

View File

@ -37,10 +37,12 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="cultivar">cultivar.</param>
/// <param name="origin">origin.</param>
public Apple(string cultivar = default(string), string origin = default(string))
/// <param name="colorCode">colorCode.</param>
public Apple(string cultivar = default(string), string origin = default(string), string colorCode = default(string))
{
this.Cultivar = cultivar;
this.Origin = origin;
this.ColorCode = colorCode;
this.AdditionalProperties = new Dictionary<string, object>();
}
@ -56,6 +58,12 @@ namespace Org.OpenAPITools.Model
[DataMember(Name = "origin", EmitDefaultValue = false)]
public string Origin { get; set; }
/// <summary>
/// Gets or Sets ColorCode
/// </summary>
[DataMember(Name = "color_code", EmitDefaultValue = false)]
public string ColorCode { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
@ -72,6 +80,7 @@ namespace Org.OpenAPITools.Model
sb.Append("class Apple {\n");
sb.Append(" Cultivar: ").Append(Cultivar).Append("\n");
sb.Append(" Origin: ").Append(Origin).Append("\n");
sb.Append(" ColorCode: ").Append(ColorCode).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
@ -123,6 +132,10 @@ namespace Org.OpenAPITools.Model
{
hashCode = (hashCode * 59) + this.Origin.GetHashCode();
}
if (this.ColorCode != null)
{
hashCode = (hashCode * 59) + this.ColorCode.GetHashCode();
}
if (this.AdditionalProperties != null)
{
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
@ -144,7 +157,8 @@ namespace Org.OpenAPITools.Model
if (!regexCultivar.Match(this.Cultivar).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" });
} }
}
}
if (this.Origin != null) {
// Origin (string) pattern
@ -152,7 +166,17 @@ namespace Org.OpenAPITools.Model
if (!regexOrigin.Match(this.Origin).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" });
} }
}
}
if (this.ColorCode != null) {
// ColorCode (string) pattern
Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant);
if (!regexColorCode.Match(this.ColorCode).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" });
}
}
yield break;
}

View File

@ -435,7 +435,8 @@ namespace Org.OpenAPITools.Model
if (!regexVarString.Match(this.VarString).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" });
} }
}
}
// Password (string) maxLength
if (this.Password != null && this.Password.Length > 64)
@ -455,7 +456,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" });
} }
}
}
if (this.PatternWithDigitsAndDelimiter != null) {
// PatternWithDigitsAndDelimiter (string) pattern
@ -463,7 +465,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" });
} }
}
}
if (this.PatternWithBackslash != null) {
// PatternWithBackslash (string) pattern
@ -471,7 +474,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" });
} }
}
}
yield break;
}

View File

@ -170,7 +170,8 @@ namespace Org.OpenAPITools.Model
if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" });
} }
}
}
yield break;
}

View File

@ -1941,6 +1941,9 @@ components:
origin:
pattern: "/^[A-Z\\s]*$/i"
type: string
color_code:
pattern: "^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$"
type: string
type: object
banana:
properties:

View File

@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [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)

View File

@ -7,6 +7,7 @@ Name | Type | Description | Notes
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [optional]
**LengthCm** | **decimal** | | [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)

View File

@ -7,6 +7,7 @@ Name | Type | Description | Notes
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [optional]
**LengthCm** | **decimal** | | [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)

View File

@ -37,10 +37,12 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="cultivar">cultivar.</param>
/// <param name="origin">origin.</param>
public Apple(string cultivar = default(string), string origin = default(string))
/// <param name="colorCode">colorCode.</param>
public Apple(string cultivar = default(string), string origin = default(string), string colorCode = default(string))
{
this.Cultivar = cultivar;
this.Origin = origin;
this.ColorCode = colorCode;
this.AdditionalProperties = new Dictionary<string, object>();
}
@ -56,6 +58,12 @@ namespace Org.OpenAPITools.Model
[DataMember(Name = "origin", EmitDefaultValue = false)]
public string Origin { get; set; }
/// <summary>
/// Gets or Sets ColorCode
/// </summary>
[DataMember(Name = "color_code", EmitDefaultValue = false)]
public string ColorCode { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
@ -72,6 +80,7 @@ namespace Org.OpenAPITools.Model
sb.Append("class Apple {\n");
sb.Append(" Cultivar: ").Append(Cultivar).Append("\n");
sb.Append(" Origin: ").Append(Origin).Append("\n");
sb.Append(" ColorCode: ").Append(ColorCode).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
@ -123,6 +132,10 @@ namespace Org.OpenAPITools.Model
{
hashCode = (hashCode * 59) + this.Origin.GetHashCode();
}
if (this.ColorCode != null)
{
hashCode = (hashCode * 59) + this.ColorCode.GetHashCode();
}
if (this.AdditionalProperties != null)
{
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
@ -144,7 +157,8 @@ namespace Org.OpenAPITools.Model
if (!regexCultivar.Match(this.Cultivar).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" });
} }
}
}
if (this.Origin != null) {
// Origin (string) pattern
@ -152,7 +166,17 @@ namespace Org.OpenAPITools.Model
if (!regexOrigin.Match(this.Origin).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" });
} }
}
}
if (this.ColorCode != null) {
// ColorCode (string) pattern
Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant);
if (!regexColorCode.Match(this.ColorCode).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" });
}
}
yield break;
}

View File

@ -435,7 +435,8 @@ namespace Org.OpenAPITools.Model
if (!regexVarString.Match(this.VarString).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" });
} }
}
}
// Password (string) maxLength
if (this.Password != null && this.Password.Length > 64)
@ -455,7 +456,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" });
} }
}
}
if (this.PatternWithDigitsAndDelimiter != null) {
// PatternWithDigitsAndDelimiter (string) pattern
@ -463,7 +465,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" });
} }
}
}
if (this.PatternWithBackslash != null) {
// PatternWithBackslash (string) pattern
@ -471,7 +474,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" });
} }
}
}
yield break;
}

View File

@ -170,7 +170,8 @@ namespace Org.OpenAPITools.Model
if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" });
} }
}
}
yield break;
}

View File

@ -1941,6 +1941,9 @@ components:
origin:
pattern: "/^[A-Z\\s]*$/i"
type: string
color_code:
pattern: "^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$"
type: string
type: object
banana:
properties:

View File

@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [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)

View File

@ -7,6 +7,7 @@ Name | Type | Description | Notes
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [optional]
**LengthCm** | **decimal** | | [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)

View File

@ -7,6 +7,7 @@ Name | Type | Description | Notes
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [optional]
**LengthCm** | **decimal** | | [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)

View File

@ -35,10 +35,12 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="cultivar">cultivar.</param>
/// <param name="origin">origin.</param>
public Apple(string cultivar = default(string), string origin = default(string))
/// <param name="colorCode">colorCode.</param>
public Apple(string cultivar = default(string), string origin = default(string), string colorCode = default(string))
{
this.Cultivar = cultivar;
this.Origin = origin;
this.ColorCode = colorCode;
}
/// <summary>
@ -53,6 +55,12 @@ namespace Org.OpenAPITools.Model
[DataMember(Name = "origin", EmitDefaultValue = false)]
public string Origin { get; set; }
/// <summary>
/// Gets or Sets ColorCode
/// </summary>
[DataMember(Name = "color_code", EmitDefaultValue = false)]
public string ColorCode { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
@ -63,6 +71,7 @@ namespace Org.OpenAPITools.Model
sb.Append("class Apple {\n");
sb.Append(" Cultivar: ").Append(Cultivar).Append("\n");
sb.Append(" Origin: ").Append(Origin).Append("\n");
sb.Append(" ColorCode: ").Append(ColorCode).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
@ -107,6 +116,11 @@ namespace Org.OpenAPITools.Model
this.Origin == input.Origin ||
(this.Origin != null &&
this.Origin.Equals(input.Origin))
) &&
(
this.ColorCode == input.ColorCode ||
(this.ColorCode != null &&
this.ColorCode.Equals(input.ColorCode))
);
}
@ -127,6 +141,10 @@ namespace Org.OpenAPITools.Model
{
hashCode = (hashCode * 59) + this.Origin.GetHashCode();
}
if (this.ColorCode != null)
{
hashCode = (hashCode * 59) + this.ColorCode.GetHashCode();
}
return hashCode;
}
}

View File

@ -1941,6 +1941,9 @@ components:
origin:
pattern: "/^[A-Z\\s]*$/i"
type: string
color_code:
pattern: "^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$"
type: string
type: object
banana:
properties:

View File

@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [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)

View File

@ -7,6 +7,7 @@ Name | Type | Description | Notes
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [optional]
**LengthCm** | **decimal** | | [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)

View File

@ -7,6 +7,7 @@ Name | Type | Description | Notes
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [optional]
**LengthCm** | **decimal** | | [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)

View File

@ -37,10 +37,12 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="cultivar">cultivar.</param>
/// <param name="origin">origin.</param>
public Apple(string cultivar = default(string), string origin = default(string))
/// <param name="colorCode">colorCode.</param>
public Apple(string cultivar = default(string), string origin = default(string), string colorCode = default(string))
{
this.Cultivar = cultivar;
this.Origin = origin;
this.ColorCode = colorCode;
this.AdditionalProperties = new Dictionary<string, object>();
}
@ -56,6 +58,12 @@ namespace Org.OpenAPITools.Model
[DataMember(Name = "origin", EmitDefaultValue = false)]
public string Origin { get; set; }
/// <summary>
/// Gets or Sets ColorCode
/// </summary>
[DataMember(Name = "color_code", EmitDefaultValue = false)]
public string ColorCode { get; set; }
/// <summary>
/// Gets or Sets additional properties
/// </summary>
@ -72,6 +80,7 @@ namespace Org.OpenAPITools.Model
sb.Append("class Apple {\n");
sb.Append(" Cultivar: ").Append(Cultivar).Append("\n");
sb.Append(" Origin: ").Append(Origin).Append("\n");
sb.Append(" ColorCode: ").Append(ColorCode).Append("\n");
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
sb.Append("}\n");
return sb.ToString();
@ -123,6 +132,10 @@ namespace Org.OpenAPITools.Model
{
hashCode = (hashCode * 59) + this.Origin.GetHashCode();
}
if (this.ColorCode != null)
{
hashCode = (hashCode * 59) + this.ColorCode.GetHashCode();
}
if (this.AdditionalProperties != null)
{
hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode();
@ -144,7 +157,8 @@ namespace Org.OpenAPITools.Model
if (!regexCultivar.Match(this.Cultivar).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" });
} }
}
}
if (this.Origin != null) {
// Origin (string) pattern
@ -152,7 +166,17 @@ namespace Org.OpenAPITools.Model
if (!regexOrigin.Match(this.Origin).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" });
} }
}
}
if (this.ColorCode != null) {
// ColorCode (string) pattern
Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant);
if (!regexColorCode.Match(this.ColorCode).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" });
}
}
yield break;
}

View File

@ -435,7 +435,8 @@ namespace Org.OpenAPITools.Model
if (!regexVarString.Match(this.VarString).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" });
} }
}
}
// Password (string) maxLength
if (this.Password != null && this.Password.Length > 64)
@ -455,7 +456,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" });
} }
}
}
if (this.PatternWithDigitsAndDelimiter != null) {
// PatternWithDigitsAndDelimiter (string) pattern
@ -463,7 +465,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" });
} }
}
}
if (this.PatternWithBackslash != null) {
// PatternWithBackslash (string) pattern
@ -471,7 +474,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" });
} }
}
}
yield break;
}

View File

@ -170,7 +170,8 @@ namespace Org.OpenAPITools.Model
if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" });
} }
}
}
yield break;
}

View File

@ -1941,6 +1941,9 @@ components:
origin:
pattern: "/^[A-Z\\s]*$/i"
type: string
color_code:
pattern: "^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$"
type: string
type: object
banana:
properties:

View File

@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [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)

View File

@ -7,6 +7,7 @@ Name | Type | Description | Notes
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [optional]
**LengthCm** | **decimal** | | [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)

View File

@ -7,6 +7,7 @@ Name | Type | Description | Notes
**Color** | **string** | | [optional]
**Cultivar** | **string** | | [optional]
**Origin** | **string** | | [optional]
**ColorCode** | **string** | | [optional]
**LengthCm** | **decimal** | | [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)

View File

@ -37,10 +37,12 @@ namespace Org.OpenAPITools.Model
/// </summary>
/// <param name="cultivar">cultivar.</param>
/// <param name="origin">origin.</param>
public Apple(string cultivar = default(string), string origin = default(string))
/// <param name="colorCode">colorCode.</param>
public Apple(string cultivar = default(string), string origin = default(string), string colorCode = default(string))
{
this.Cultivar = cultivar;
this.Origin = origin;
this.ColorCode = colorCode;
}
/// <summary>
@ -55,6 +57,12 @@ namespace Org.OpenAPITools.Model
[DataMember(Name = "origin", EmitDefaultValue = false)]
public string Origin { get; set; }
/// <summary>
/// Gets or Sets ColorCode
/// </summary>
[DataMember(Name = "color_code", EmitDefaultValue = false)]
public string ColorCode { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
@ -65,6 +73,7 @@ namespace Org.OpenAPITools.Model
sb.Append("class Apple {\n");
sb.Append(" Cultivar: ").Append(Cultivar).Append("\n");
sb.Append(" Origin: ").Append(Origin).Append("\n");
sb.Append(" ColorCode: ").Append(ColorCode).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
@ -115,6 +124,10 @@ namespace Org.OpenAPITools.Model
{
hashCode = (hashCode * 59) + this.Origin.GetHashCode();
}
if (this.ColorCode != null)
{
hashCode = (hashCode * 59) + this.ColorCode.GetHashCode();
}
return hashCode;
}
}
@ -132,7 +145,8 @@ namespace Org.OpenAPITools.Model
if (!regexCultivar.Match(this.Cultivar).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" });
} }
}
}
if (this.Origin != null) {
// Origin (string) pattern
@ -140,7 +154,17 @@ namespace Org.OpenAPITools.Model
if (!regexOrigin.Match(this.Origin).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" });
} }
}
}
if (this.ColorCode != null) {
// ColorCode (string) pattern
Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant);
if (!regexColorCode.Match(this.ColorCode).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" });
}
}
yield break;
}

View File

@ -420,7 +420,8 @@ namespace Org.OpenAPITools.Model
if (!regexVarString.Match(this.VarString).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" });
} }
}
}
// Password (string) maxLength
if (this.Password != null && this.Password.Length > 64)
@ -440,7 +441,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" });
} }
}
}
if (this.PatternWithDigitsAndDelimiter != null) {
// PatternWithDigitsAndDelimiter (string) pattern
@ -448,7 +450,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" });
} }
}
}
if (this.PatternWithBackslash != null) {
// PatternWithBackslash (string) pattern
@ -456,7 +459,8 @@ namespace Org.OpenAPITools.Model
if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" });
} }
}
}
yield break;
}

View File

@ -158,7 +158,8 @@ namespace Org.OpenAPITools.Model
if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" });
} }
}
}
yield break;
}

View File

@ -129,7 +129,8 @@ namespace Org.OpenAPITools.Model
if (!regexName.Match(this.Name).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Name, must match a pattern of " + regexName, new [] { "Name" });
} }
}
}
yield break;
}