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).
PureYAMLJSON is a separate library product layered on the core engine. JSON is
a subset of YAML 1.2, so the existing parser already reads both into one value
tree; this product adds the missing half and the value-level policy:
- JSON.Writer: a pure-Swift RFC-8259 serializer (no Foundation; WASI-clean),
pretty or compact, rejecting non-string keys and non-finite numbers.
- JSON representability rules expressed in PureYAML's own Validation framework:
mappingKeysAreStrings and numbersAreFinite join the core mappingKeysAreUnique.
- JSON.Validator: the representability rule set plus issues(for:)/isRepresentable.
- JSON.Convert: standalone convert(_:to:) with the round-trip law (parse ->
validate representability -> emit -> re-parse must equal the source). To JSON
rejects complex keys and non-finite numbers; to YAML rejects duplicate keys,
which are legal in JSON but not in YAML.
19 tests cover the writer, the rules, and both conversion directions including
the dual-rejection edges. Carved out of the catch-all Sources/Tests paths via
exclude so the core PureYAML target is unchanged.