The validation module already implemented the composable-rule idiom under its own names (Check/Issue/SubjectContext) and a value-type Validator with duplicated traversal machinery per layer. Renamed the core types to the canonical names (Validation/ValidationError/ValidationErrorCollection/ ValidationContext/BuiltinValidation/AnyValidation), converted Validator to a reference-type class with the two-tier default-rule split, and genericized it over both Subject and Document via a new Traversable protocol so the model and tagged layers share one walk engine instead of two copies. Wired the JSON-representability rule set into the same shape and closed the two missing pieces (unwrap combinator, JSON coverage/config-pin tests).
14 lines
512 B
Swift
14 lines
512 B
Swift
import PureYAML
|
|
|
|
public extension PureYAML.JSON.Convert {
|
|
/// A reason a YAML <-> JSON conversion did not complete.
|
|
enum Failure: Error, Equatable, Sendable {
|
|
/// The source text did not parse.
|
|
case sourceInvalid(String)
|
|
/// The value cannot be represented in the target format.
|
|
case notRepresentable([PureYAML.Validation.ValidationError])
|
|
/// The emitted output did not parse back to the source value.
|
|
case roundTripMismatch(PureYAML.JSON.Format)
|
|
}
|
|
}
|