diff --git a/modules/openapi-generator/src/main/resources/swift6/Validation.mustache b/modules/openapi-generator/src/main/resources/swift6/Validation.mustache index 2a2dab67d0c..9d60c6098f1 100644 --- a/modules/openapi-generator/src/main/resources/swift6/Validation.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/Validation.mustache @@ -48,9 +48,8 @@ extension NumericRule: Sendable where T: Sendable {} /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. /// - Returns: A validated string. - /// - Throws: `ValidationError` if the string is invalid against the rule, - /// `NSError` if the rule.pattern is invalid. - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func validate(_ string: String, against rule: StringRule) throws -> String { + /// - Throws: `ValidationError` if the string is invalid against the rule or if the rule.pattern is invalid. + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func validate(_ string: String, against rule: StringRule) throws(ValidationError) -> String { var error = ValidationError(kinds: []) if let minLength = rule.minLength, !(minLength <= string.count) { error.kinds.insert(.minLength) @@ -59,9 +58,9 @@ extension NumericRule: Sendable where T: Sendable {} error.kinds.insert(.maxLength) } if let pattern = rule.pattern { - let matches = try NSRegularExpression(pattern: pattern, options: .caseInsensitive) + let matches = try? NSRegularExpression(pattern: pattern, options: .caseInsensitive) .matches(in: string, range: .init(location: 0, length: string.utf16.count)) - if matches.isEmpty { + if matches?.isEmpty != false { error.kinds.insert(.pattern) } } @@ -76,7 +75,7 @@ extension NumericRule: Sendable where T: Sendable {} /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated integer. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -108,7 +107,7 @@ extension NumericRule: Sendable where T: Sendable {} /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated fractional number. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -140,7 +139,7 @@ extension NumericRule: Sendable where T: Sendable {} /// - Parameter rule: The ArrayRule you wish to use for validation. /// - Returns: A validated array. /// - Throws: `ValidationError` if the string is invalid against the rule. - {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func validate(_ array: Array, against rule: ArrayRule) throws -> Array { + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func validate(_ array: Array, against rule: ArrayRule) throws(ValidationError) -> Array { var error = ValidationError(kinds: []) if let minItems = rule.minItems, !(minItems <= array.count) { error.kinds.insert(.minItems) diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift index d4c743d9607..b830e2d31a4 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -48,9 +48,8 @@ public struct Validator { /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. /// - Returns: A validated string. - /// - Throws: `ValidationError` if the string is invalid against the rule, - /// `NSError` if the rule.pattern is invalid. - public static func validate(_ string: String, against rule: StringRule) throws -> String { + /// - Throws: `ValidationError` if the string is invalid against the rule or if the rule.pattern is invalid. + public static func validate(_ string: String, against rule: StringRule) throws(ValidationError) -> String { var error = ValidationError(kinds: []) if let minLength = rule.minLength, !(minLength <= string.count) { error.kinds.insert(.minLength) @@ -59,9 +58,9 @@ public struct Validator { error.kinds.insert(.maxLength) } if let pattern = rule.pattern { - let matches = try NSRegularExpression(pattern: pattern, options: .caseInsensitive) + let matches = try? NSRegularExpression(pattern: pattern, options: .caseInsensitive) .matches(in: string, range: .init(location: 0, length: string.utf16.count)) - if matches.isEmpty { + if matches?.isEmpty != false { error.kinds.insert(.pattern) } } @@ -76,7 +75,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated integer. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -108,7 +107,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated fractional number. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -140,7 +139,7 @@ public struct Validator { /// - Parameter rule: The ArrayRule you wish to use for validation. /// - Returns: A validated array. /// - Throws: `ValidationError` if the string is invalid against the rule. - public static func validate(_ array: Array, against rule: ArrayRule) throws -> Array { + public static func validate(_ array: Array, against rule: ArrayRule) throws(ValidationError) -> Array { var error = ValidationError(kinds: []) if let minItems = rule.minItems, !(minItems <= array.count) { error.kinds.insert(.minItems) diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Validation.swift index d4c743d9607..b830e2d31a4 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -48,9 +48,8 @@ public struct Validator { /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. /// - Returns: A validated string. - /// - Throws: `ValidationError` if the string is invalid against the rule, - /// `NSError` if the rule.pattern is invalid. - public static func validate(_ string: String, against rule: StringRule) throws -> String { + /// - Throws: `ValidationError` if the string is invalid against the rule or if the rule.pattern is invalid. + public static func validate(_ string: String, against rule: StringRule) throws(ValidationError) -> String { var error = ValidationError(kinds: []) if let minLength = rule.minLength, !(minLength <= string.count) { error.kinds.insert(.minLength) @@ -59,9 +58,9 @@ public struct Validator { error.kinds.insert(.maxLength) } if let pattern = rule.pattern { - let matches = try NSRegularExpression(pattern: pattern, options: .caseInsensitive) + let matches = try? NSRegularExpression(pattern: pattern, options: .caseInsensitive) .matches(in: string, range: .init(location: 0, length: string.utf16.count)) - if matches.isEmpty { + if matches?.isEmpty != false { error.kinds.insert(.pattern) } } @@ -76,7 +75,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated integer. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -108,7 +107,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated fractional number. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -140,7 +139,7 @@ public struct Validator { /// - Parameter rule: The ArrayRule you wish to use for validation. /// - Returns: A validated array. /// - Throws: `ValidationError` if the string is invalid against the rule. - public static func validate(_ array: Array, against rule: ArrayRule) throws -> Array { + public static func validate(_ array: Array, against rule: ArrayRule) throws(ValidationError) -> Array { var error = ValidationError(kinds: []) if let minItems = rule.minItems, !(minItems <= array.count) { error.kinds.insert(.minItems) diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift index d4c743d9607..b830e2d31a4 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -48,9 +48,8 @@ public struct Validator { /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. /// - Returns: A validated string. - /// - Throws: `ValidationError` if the string is invalid against the rule, - /// `NSError` if the rule.pattern is invalid. - public static func validate(_ string: String, against rule: StringRule) throws -> String { + /// - Throws: `ValidationError` if the string is invalid against the rule or if the rule.pattern is invalid. + public static func validate(_ string: String, against rule: StringRule) throws(ValidationError) -> String { var error = ValidationError(kinds: []) if let minLength = rule.minLength, !(minLength <= string.count) { error.kinds.insert(.minLength) @@ -59,9 +58,9 @@ public struct Validator { error.kinds.insert(.maxLength) } if let pattern = rule.pattern { - let matches = try NSRegularExpression(pattern: pattern, options: .caseInsensitive) + let matches = try? NSRegularExpression(pattern: pattern, options: .caseInsensitive) .matches(in: string, range: .init(location: 0, length: string.utf16.count)) - if matches.isEmpty { + if matches?.isEmpty != false { error.kinds.insert(.pattern) } } @@ -76,7 +75,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated integer. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -108,7 +107,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated fractional number. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -140,7 +139,7 @@ public struct Validator { /// - Parameter rule: The ArrayRule you wish to use for validation. /// - Returns: A validated array. /// - Throws: `ValidationError` if the string is invalid against the rule. - public static func validate(_ array: Array, against rule: ArrayRule) throws -> Array { + public static func validate(_ array: Array, against rule: ArrayRule) throws(ValidationError) -> Array { var error = ValidationError(kinds: []) if let minItems = rule.minItems, !(minItems <= array.count) { error.kinds.insert(.minItems) diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index d4c743d9607..b830e2d31a4 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -48,9 +48,8 @@ public struct Validator { /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. /// - Returns: A validated string. - /// - Throws: `ValidationError` if the string is invalid against the rule, - /// `NSError` if the rule.pattern is invalid. - public static func validate(_ string: String, against rule: StringRule) throws -> String { + /// - Throws: `ValidationError` if the string is invalid against the rule or if the rule.pattern is invalid. + public static func validate(_ string: String, against rule: StringRule) throws(ValidationError) -> String { var error = ValidationError(kinds: []) if let minLength = rule.minLength, !(minLength <= string.count) { error.kinds.insert(.minLength) @@ -59,9 +58,9 @@ public struct Validator { error.kinds.insert(.maxLength) } if let pattern = rule.pattern { - let matches = try NSRegularExpression(pattern: pattern, options: .caseInsensitive) + let matches = try? NSRegularExpression(pattern: pattern, options: .caseInsensitive) .matches(in: string, range: .init(location: 0, length: string.utf16.count)) - if matches.isEmpty { + if matches?.isEmpty != false { error.kinds.insert(.pattern) } } @@ -76,7 +75,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated integer. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -108,7 +107,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated fractional number. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -140,7 +139,7 @@ public struct Validator { /// - Parameter rule: The ArrayRule you wish to use for validation. /// - Returns: A validated array. /// - Throws: `ValidationError` if the string is invalid against the rule. - public static func validate(_ array: Array, against rule: ArrayRule) throws -> Array { + public static func validate(_ array: Array, against rule: ArrayRule) throws(ValidationError) -> Array { var error = ValidationError(kinds: []) if let minItems = rule.minItems, !(minItems <= array.count) { error.kinds.insert(.minItems) diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Validation.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Validation.swift index d4c743d9607..b830e2d31a4 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Validation.swift @@ -48,9 +48,8 @@ public struct Validator { /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. /// - Returns: A validated string. - /// - Throws: `ValidationError` if the string is invalid against the rule, - /// `NSError` if the rule.pattern is invalid. - public static func validate(_ string: String, against rule: StringRule) throws -> String { + /// - Throws: `ValidationError` if the string is invalid against the rule or if the rule.pattern is invalid. + public static func validate(_ string: String, against rule: StringRule) throws(ValidationError) -> String { var error = ValidationError(kinds: []) if let minLength = rule.minLength, !(minLength <= string.count) { error.kinds.insert(.minLength) @@ -59,9 +58,9 @@ public struct Validator { error.kinds.insert(.maxLength) } if let pattern = rule.pattern { - let matches = try NSRegularExpression(pattern: pattern, options: .caseInsensitive) + let matches = try? NSRegularExpression(pattern: pattern, options: .caseInsensitive) .matches(in: string, range: .init(location: 0, length: string.utf16.count)) - if matches.isEmpty { + if matches?.isEmpty != false { error.kinds.insert(.pattern) } } @@ -76,7 +75,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated integer. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -108,7 +107,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated fractional number. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -140,7 +139,7 @@ public struct Validator { /// - Parameter rule: The ArrayRule you wish to use for validation. /// - Returns: A validated array. /// - Throws: `ValidationError` if the string is invalid against the rule. - public static func validate(_ array: Array, against rule: ArrayRule) throws -> Array { + public static func validate(_ array: Array, against rule: ArrayRule) throws(ValidationError) -> Array { var error = ValidationError(kinds: []) if let minItems = rule.minItems, !(minItems <= array.count) { error.kinds.insert(.minItems) diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Validation.swift index d4c743d9607..b830e2d31a4 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -48,9 +48,8 @@ public struct Validator { /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. /// - Returns: A validated string. - /// - Throws: `ValidationError` if the string is invalid against the rule, - /// `NSError` if the rule.pattern is invalid. - public static func validate(_ string: String, against rule: StringRule) throws -> String { + /// - Throws: `ValidationError` if the string is invalid against the rule or if the rule.pattern is invalid. + public static func validate(_ string: String, against rule: StringRule) throws(ValidationError) -> String { var error = ValidationError(kinds: []) if let minLength = rule.minLength, !(minLength <= string.count) { error.kinds.insert(.minLength) @@ -59,9 +58,9 @@ public struct Validator { error.kinds.insert(.maxLength) } if let pattern = rule.pattern { - let matches = try NSRegularExpression(pattern: pattern, options: .caseInsensitive) + let matches = try? NSRegularExpression(pattern: pattern, options: .caseInsensitive) .matches(in: string, range: .init(location: 0, length: string.utf16.count)) - if matches.isEmpty { + if matches?.isEmpty != false { error.kinds.insert(.pattern) } } @@ -76,7 +75,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated integer. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -108,7 +107,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated fractional number. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -140,7 +139,7 @@ public struct Validator { /// - Parameter rule: The ArrayRule you wish to use for validation. /// - Returns: A validated array. /// - Throws: `ValidationError` if the string is invalid against the rule. - public static func validate(_ array: Array, against rule: ArrayRule) throws -> Array { + public static func validate(_ array: Array, against rule: ArrayRule) throws(ValidationError) -> Array { var error = ValidationError(kinds: []) if let minItems = rule.minItems, !(minItems <= array.count) { error.kinds.insert(.minItems) diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Validation.swift index d4c743d9607..b830e2d31a4 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -48,9 +48,8 @@ public struct Validator { /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. /// - Returns: A validated string. - /// - Throws: `ValidationError` if the string is invalid against the rule, - /// `NSError` if the rule.pattern is invalid. - public static func validate(_ string: String, against rule: StringRule) throws -> String { + /// - Throws: `ValidationError` if the string is invalid against the rule or if the rule.pattern is invalid. + public static func validate(_ string: String, against rule: StringRule) throws(ValidationError) -> String { var error = ValidationError(kinds: []) if let minLength = rule.minLength, !(minLength <= string.count) { error.kinds.insert(.minLength) @@ -59,9 +58,9 @@ public struct Validator { error.kinds.insert(.maxLength) } if let pattern = rule.pattern { - let matches = try NSRegularExpression(pattern: pattern, options: .caseInsensitive) + let matches = try? NSRegularExpression(pattern: pattern, options: .caseInsensitive) .matches(in: string, range: .init(location: 0, length: string.utf16.count)) - if matches.isEmpty { + if matches?.isEmpty != false { error.kinds.insert(.pattern) } } @@ -76,7 +75,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated integer. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -108,7 +107,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated fractional number. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -140,7 +139,7 @@ public struct Validator { /// - Parameter rule: The ArrayRule you wish to use for validation. /// - Returns: A validated array. /// - Throws: `ValidationError` if the string is invalid against the rule. - public static func validate(_ array: Array, against rule: ArrayRule) throws -> Array { + public static func validate(_ array: Array, against rule: ArrayRule) throws(ValidationError) -> Array { var error = ValidationError(kinds: []) if let minItems = rule.minItems, !(minItems <= array.count) { error.kinds.insert(.minItems) diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index d4c743d9607..b830e2d31a4 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -48,9 +48,8 @@ public struct Validator { /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. /// - Returns: A validated string. - /// - Throws: `ValidationError` if the string is invalid against the rule, - /// `NSError` if the rule.pattern is invalid. - public static func validate(_ string: String, against rule: StringRule) throws -> String { + /// - Throws: `ValidationError` if the string is invalid against the rule or if the rule.pattern is invalid. + public static func validate(_ string: String, against rule: StringRule) throws(ValidationError) -> String { var error = ValidationError(kinds: []) if let minLength = rule.minLength, !(minLength <= string.count) { error.kinds.insert(.minLength) @@ -59,9 +58,9 @@ public struct Validator { error.kinds.insert(.maxLength) } if let pattern = rule.pattern { - let matches = try NSRegularExpression(pattern: pattern, options: .caseInsensitive) + let matches = try? NSRegularExpression(pattern: pattern, options: .caseInsensitive) .matches(in: string, range: .init(location: 0, length: string.utf16.count)) - if matches.isEmpty { + if matches?.isEmpty != false { error.kinds.insert(.pattern) } } @@ -76,7 +75,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated integer. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -108,7 +107,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated fractional number. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -140,7 +139,7 @@ public struct Validator { /// - Parameter rule: The ArrayRule you wish to use for validation. /// - Returns: A validated array. /// - Throws: `ValidationError` if the string is invalid against the rule. - public static func validate(_ array: Array, against rule: ArrayRule) throws -> Array { + public static func validate(_ array: Array, against rule: ArrayRule) throws(ValidationError) -> Array { var error = ValidationError(kinds: []) if let minItems = rule.minItems, !(minItems <= array.count) { error.kinds.insert(.minItems) diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index d4c743d9607..b830e2d31a4 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -48,9 +48,8 @@ public struct Validator { /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. /// - Returns: A validated string. - /// - Throws: `ValidationError` if the string is invalid against the rule, - /// `NSError` if the rule.pattern is invalid. - public static func validate(_ string: String, against rule: StringRule) throws -> String { + /// - Throws: `ValidationError` if the string is invalid against the rule or if the rule.pattern is invalid. + public static func validate(_ string: String, against rule: StringRule) throws(ValidationError) -> String { var error = ValidationError(kinds: []) if let minLength = rule.minLength, !(minLength <= string.count) { error.kinds.insert(.minLength) @@ -59,9 +58,9 @@ public struct Validator { error.kinds.insert(.maxLength) } if let pattern = rule.pattern { - let matches = try NSRegularExpression(pattern: pattern, options: .caseInsensitive) + let matches = try? NSRegularExpression(pattern: pattern, options: .caseInsensitive) .matches(in: string, range: .init(location: 0, length: string.utf16.count)) - if matches.isEmpty { + if matches?.isEmpty != false { error.kinds.insert(.pattern) } } @@ -76,7 +75,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated integer. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -108,7 +107,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated fractional number. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -140,7 +139,7 @@ public struct Validator { /// - Parameter rule: The ArrayRule you wish to use for validation. /// - Returns: A validated array. /// - Throws: `ValidationError` if the string is invalid against the rule. - public static func validate(_ array: Array, against rule: ArrayRule) throws -> Array { + public static func validate(_ array: Array, against rule: ArrayRule) throws(ValidationError) -> Array { var error = ValidationError(kinds: []) if let minItems = rule.minItems, !(minItems <= array.count) { error.kinds.insert(.minItems) diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index 104b7490365..38e3460f565 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -48,9 +48,8 @@ internal struct Validator { /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. /// - Returns: A validated string. - /// - Throws: `ValidationError` if the string is invalid against the rule, - /// `NSError` if the rule.pattern is invalid. - internal static func validate(_ string: String, against rule: StringRule) throws -> String { + /// - Throws: `ValidationError` if the string is invalid against the rule or if the rule.pattern is invalid. + internal static func validate(_ string: String, against rule: StringRule) throws(ValidationError) -> String { var error = ValidationError(kinds: []) if let minLength = rule.minLength, !(minLength <= string.count) { error.kinds.insert(.minLength) @@ -59,9 +58,9 @@ internal struct Validator { error.kinds.insert(.maxLength) } if let pattern = rule.pattern { - let matches = try NSRegularExpression(pattern: pattern, options: .caseInsensitive) + let matches = try? NSRegularExpression(pattern: pattern, options: .caseInsensitive) .matches(in: string, range: .init(location: 0, length: string.utf16.count)) - if matches.isEmpty { + if matches?.isEmpty != false { error.kinds.insert(.pattern) } } @@ -76,7 +75,7 @@ internal struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated integer. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - internal static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + internal static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -108,7 +107,7 @@ internal struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated fractional number. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - internal static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + internal static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -140,7 +139,7 @@ internal struct Validator { /// - Parameter rule: The ArrayRule you wish to use for validation. /// - Returns: A validated array. /// - Throws: `ValidationError` if the string is invalid against the rule. - internal static func validate(_ array: Array, against rule: ArrayRule) throws -> Array { + internal static func validate(_ array: Array, against rule: ArrayRule) throws(ValidationError) -> Array { var error = ValidationError(kinds: []) if let minItems = rule.minItems, !(minItems <= array.count) { error.kinds.insert(.minItems) diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index d4c743d9607..b830e2d31a4 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -48,9 +48,8 @@ public struct Validator { /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. /// - Returns: A validated string. - /// - Throws: `ValidationError` if the string is invalid against the rule, - /// `NSError` if the rule.pattern is invalid. - public static func validate(_ string: String, against rule: StringRule) throws -> String { + /// - Throws: `ValidationError` if the string is invalid against the rule or if the rule.pattern is invalid. + public static func validate(_ string: String, against rule: StringRule) throws(ValidationError) -> String { var error = ValidationError(kinds: []) if let minLength = rule.minLength, !(minLength <= string.count) { error.kinds.insert(.minLength) @@ -59,9 +58,9 @@ public struct Validator { error.kinds.insert(.maxLength) } if let pattern = rule.pattern { - let matches = try NSRegularExpression(pattern: pattern, options: .caseInsensitive) + let matches = try? NSRegularExpression(pattern: pattern, options: .caseInsensitive) .matches(in: string, range: .init(location: 0, length: string.utf16.count)) - if matches.isEmpty { + if matches?.isEmpty != false { error.kinds.insert(.pattern) } } @@ -76,7 +75,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated integer. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -108,7 +107,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated fractional number. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -140,7 +139,7 @@ public struct Validator { /// - Parameter rule: The ArrayRule you wish to use for validation. /// - Returns: A validated array. /// - Throws: `ValidationError` if the string is invalid against the rule. - public static func validate(_ array: Array, against rule: ArrayRule) throws -> Array { + public static func validate(_ array: Array, against rule: ArrayRule) throws(ValidationError) -> Array { var error = ValidationError(kinds: []) if let minItems = rule.minItems, !(minItems <= array.count) { error.kinds.insert(.minItems) diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift index d4c743d9607..b830e2d31a4 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -48,9 +48,8 @@ public struct Validator { /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. /// - Returns: A validated string. - /// - Throws: `ValidationError` if the string is invalid against the rule, - /// `NSError` if the rule.pattern is invalid. - public static func validate(_ string: String, against rule: StringRule) throws -> String { + /// - Throws: `ValidationError` if the string is invalid against the rule or if the rule.pattern is invalid. + public static func validate(_ string: String, against rule: StringRule) throws(ValidationError) -> String { var error = ValidationError(kinds: []) if let minLength = rule.minLength, !(minLength <= string.count) { error.kinds.insert(.minLength) @@ -59,9 +58,9 @@ public struct Validator { error.kinds.insert(.maxLength) } if let pattern = rule.pattern { - let matches = try NSRegularExpression(pattern: pattern, options: .caseInsensitive) + let matches = try? NSRegularExpression(pattern: pattern, options: .caseInsensitive) .matches(in: string, range: .init(location: 0, length: string.utf16.count)) - if matches.isEmpty { + if matches?.isEmpty != false { error.kinds.insert(.pattern) } } @@ -76,7 +75,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated integer. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -108,7 +107,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated fractional number. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -140,7 +139,7 @@ public struct Validator { /// - Parameter rule: The ArrayRule you wish to use for validation. /// - Returns: A validated array. /// - Throws: `ValidationError` if the string is invalid against the rule. - public static func validate(_ array: Array, against rule: ArrayRule) throws -> Array { + public static func validate(_ array: Array, against rule: ArrayRule) throws(ValidationError) -> Array { var error = ValidationError(kinds: []) if let minItems = rule.minItems, !(minItems <= array.count) { error.kinds.insert(.minItems) diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index d4c743d9607..b830e2d31a4 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -48,9 +48,8 @@ public struct Validator { /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. /// - Returns: A validated string. - /// - Throws: `ValidationError` if the string is invalid against the rule, - /// `NSError` if the rule.pattern is invalid. - public static func validate(_ string: String, against rule: StringRule) throws -> String { + /// - Throws: `ValidationError` if the string is invalid against the rule or if the rule.pattern is invalid. + public static func validate(_ string: String, against rule: StringRule) throws(ValidationError) -> String { var error = ValidationError(kinds: []) if let minLength = rule.minLength, !(minLength <= string.count) { error.kinds.insert(.minLength) @@ -59,9 +58,9 @@ public struct Validator { error.kinds.insert(.maxLength) } if let pattern = rule.pattern { - let matches = try NSRegularExpression(pattern: pattern, options: .caseInsensitive) + let matches = try? NSRegularExpression(pattern: pattern, options: .caseInsensitive) .matches(in: string, range: .init(location: 0, length: string.utf16.count)) - if matches.isEmpty { + if matches?.isEmpty != false { error.kinds.insert(.pattern) } } @@ -76,7 +75,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated integer. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -108,7 +107,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated fractional number. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -140,7 +139,7 @@ public struct Validator { /// - Parameter rule: The ArrayRule you wish to use for validation. /// - Returns: A validated array. /// - Throws: `ValidationError` if the string is invalid against the rule. - public static func validate(_ array: Array, against rule: ArrayRule) throws -> Array { + public static func validate(_ array: Array, against rule: ArrayRule) throws(ValidationError) -> Array { var error = ValidationError(kinds: []) if let minItems = rule.minItems, !(minItems <= array.count) { error.kinds.insert(.minItems) diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift index d4c743d9607..b830e2d31a4 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -48,9 +48,8 @@ public struct Validator { /// - Parameter string: The String you wish to validate. /// - Parameter rule: The StringRule you wish to use for validation. /// - Returns: A validated string. - /// - Throws: `ValidationError` if the string is invalid against the rule, - /// `NSError` if the rule.pattern is invalid. - public static func validate(_ string: String, against rule: StringRule) throws -> String { + /// - Throws: `ValidationError` if the string is invalid against the rule or if the rule.pattern is invalid. + public static func validate(_ string: String, against rule: StringRule) throws(ValidationError) -> String { var error = ValidationError(kinds: []) if let minLength = rule.minLength, !(minLength <= string.count) { error.kinds.insert(.minLength) @@ -59,9 +58,9 @@ public struct Validator { error.kinds.insert(.maxLength) } if let pattern = rule.pattern { - let matches = try NSRegularExpression(pattern: pattern, options: .caseInsensitive) + let matches = try? NSRegularExpression(pattern: pattern, options: .caseInsensitive) .matches(in: string, range: .init(location: 0, length: string.utf16.count)) - if matches.isEmpty { + if matches?.isEmpty != false { error.kinds.insert(.pattern) } } @@ -76,7 +75,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated integer. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -108,7 +107,7 @@ public struct Validator { /// - Parameter rule: The NumericRule you wish to use for validation. /// - Returns: A validated fractional number. /// - Throws: `ValidationError` if the numeric is invalid against the rule. - public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { + public static func validate(_ numeric: T, against rule: NumericRule) throws(ValidationError) -> T { var error = ValidationError(kinds: []) if let minimum = rule.minimum { if !rule.exclusiveMinimum, minimum > numeric { @@ -140,7 +139,7 @@ public struct Validator { /// - Parameter rule: The ArrayRule you wish to use for validation. /// - Returns: A validated array. /// - Throws: `ValidationError` if the string is invalid against the rule. - public static func validate(_ array: Array, against rule: ArrayRule) throws -> Array { + public static func validate(_ array: Array, against rule: ArrayRule) throws(ValidationError) -> Array { var error = ValidationError(kinds: []) if let minItems = rule.minItems, !(minItems <= array.count) { error.kinds.insert(.minItems)