The coverage manifest claimed Tagged.Mapping and Tagged.Node validate key uniqueness, but the tagged validator's only default check was the built-in tag check: the claim was false. Tagged.Mapping keeps every parsed pair, so a duplicate key survives into the tree and is as invalid as in the plain model. Add Tagged.BuiltinCheck.mappingKeysAreUnique, a Check<Mapping, Node> on the one validation framework, to the tagged validator's defaults; the traversal now offers each mapping to the checks. It reports each duplicate at its key path, with failing, near-miss, and nested fixtures, and the two default tagged checks are pinned by description. Correct the Model.Value coverage reason: merges and aliases resolve at parse time, so they are not a validation-phase invariant. Every validated manifest entry now names an invariant a check actually enforces. 403 tests pass.
13 lines
685 B
Swift
13 lines
685 B
Swift
public extension PureYAML.Validation {
|
|
/// Marker for a value a type-directed validation can be applied to. A `Check<Subject>` fires on
|
|
/// `Subject` values wherever they appear in the traversed tree; this protocol constrains the
|
|
/// subjects so the erased dispatch can filter by runtime type.
|
|
protocol Validatable: Sendable {}
|
|
}
|
|
|
|
extension PureYAML.Model.Value: PureYAML.Validation.Validatable {}
|
|
extension PureYAML.Model.Mapping: PureYAML.Validation.Validatable {}
|
|
extension PureYAML.Model.Key: PureYAML.Validation.Validatable {}
|
|
extension PureYAML.Tagged.Node: PureYAML.Validation.Validatable {}
|
|
extension PureYAML.Tagged.Mapping: PureYAML.Validation.Validatable {}
|