From e5a07fed84f02abdeb0211cd05eb89d40b42b9d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20B=C3=B6hler?= Date: Fri, 11 Sep 2026 10:17:08 +0200 Subject: [PATCH 1/2] try fix compiler error --- Sources/OpenAPIKit/Validator/Validator.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/OpenAPIKit/Validator/Validator.swift b/Sources/OpenAPIKit/Validator/Validator.swift index 5ecab2ee2..6fca0fd97 100644 --- a/Sources/OpenAPIKit/Validator/Validator.swift +++ b/Sources/OpenAPIKit/Validator/Validator.swift @@ -234,14 +234,14 @@ public final class Validator { /// Add a validation to be performed. @discardableResult - public func validating(_ validation: Validation) -> Self { + public func validating(_ validation: Validation) -> Self { customValidations.append(AnyValidation(validation)) return self } /// Add one or more builtin validations to be performed. @discardableResult - public func validating(_ validations: repeat KeyPath>) -> Self { + public func validating(_ validations: repeat KeyPath>) -> Self { for validationPath in repeat each validations { customValidations.append(AnyValidation(BuiltinValidation.self[keyPath: validationPath])) } @@ -250,7 +250,7 @@ public final class Validator { /// Remove a builtin validation. @discardableResult - public func withoutValidating(_ validations: repeat KeyPath>) -> Self { + public func withoutValidating(_ validations: repeat KeyPath>) -> Self { for validationPath in repeat each validations { nonReferenceDefaultValidations.removeAll { $0.description == BuiltinValidation.self[keyPath: validationPath].description } referenceDefaultValidations.removeAll { $0.description == BuiltinValidation.self[keyPath: validationPath].description } @@ -267,7 +267,7 @@ public final class Validator { /// `ValidationError` is a good general purpose error for this use-case. /// @discardableResult - public func validating( + public func validating( _ validate: @escaping (ValidationContext) -> [ValidationError] ) -> Self { return validating(Validation(check: validate, when: { _ in true })) @@ -282,7 +282,7 @@ public final class Validator { /// - predicate: A function returning `true` if this validator /// should run against the given value. /// - public func validating( + public func validating( _ validate: @escaping (ValidationContext) -> [ValidationError], when predicate: @escaping (ValidationContext) -> Bool ) -> Self { @@ -297,7 +297,7 @@ public final class Validator { /// - validate: The function called to assert a condition. The function should return `false` /// if the validity check has failed or `true` if everything is valid. @discardableResult - public func validating( + public func validating( _ description: String, check validate: @escaping (ValidationContext) -> Bool ) -> Self { @@ -317,7 +317,7 @@ public final class Validator { /// if the validity check has failed or `true` if everything is valid. /// - predicate: A condition that must be met for this validation to be applied. @discardableResult - public func validating( + public func validating( _ description: String, check validate: @escaping (ValidationContext) -> Bool, when predicate: @escaping (ValidationContext) -> Bool From ce2a3cf97efd76d86a19bc40419f0c7099142359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20B=C3=B6hler?= Date: Fri, 11 Sep 2026 11:30:36 +0200 Subject: [PATCH 2/2] try out workaround --- Sources/OpenAPIKit/Validator/Validator.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/OpenAPIKit/Validator/Validator.swift b/Sources/OpenAPIKit/Validator/Validator.swift index 6fca0fd97..49299c5e1 100644 --- a/Sources/OpenAPIKit/Validator/Validator.swift +++ b/Sources/OpenAPIKit/Validator/Validator.swift @@ -94,7 +94,7 @@ extension OpenAPI.Document { /// You can add validations to the validator using the /// `validating()` instance methods. /// -/// Builtin validations can be removed selectively using the +/// Builtin validations can be removed selectively using the /// `withoutValidating()` instance methods. /// /// There are a few default validations that ship with OpenAPIKit but @@ -240,6 +240,7 @@ public final class Validator { } /// Add one or more builtin validations to be performed. + @_semantics("optimize.no.crossmodule") @discardableResult public func validating(_ validations: repeat KeyPath>) -> Self { for validationPath in repeat each validations { @@ -249,6 +250,7 @@ public final class Validator { } /// Remove a builtin validation. + @_semantics("optimize.no.crossmodule") @discardableResult public func withoutValidating(_ validations: repeat KeyPath>) -> Self { for validationPath in repeat each validations {