Skip to content

It's Not Settled Then

Pre-release
Pre-release

Choose a tag to compare

@mattpolzin mattpolzin released this 19 Jul 18:00
e32198e

What's Changed

  • parse and preserve $dynamicRef by @aqeelat in #501
  • resolve $dynamicRef (locally) against the dynamic scope by @aqeelat in #504

The minimum Swift version has increased to Swift 6.2.

JSONSchema gains a .dynamicReference case

Support for the JSON Schema 2020-12 $dynamicRef / $dynamicAnchor keywords
(§7.7)
has been added. The JSONSchema.Schema enum gains a new dynamicReference(_:...)
case, and JSONReference.InternalReference gains a .anchor(String) case.

JSONDynamicReference is a new type that wraps JSONReference<JSONSchema> and
encodes/decodes the $dynamicRef keyword. Schemas whose only attribute is
$dynamicRef now decode as .dynamicReference instead of decoding as an empty
.fragment with an "unsupported attributes" warning.

Local dereferencing resolves $dynamicRef

locallyDereferenced() and JSONSchema.dereferenced(in:) now resolve
$dynamicRef against the dynamic scope.

$ref with a plain fragment now round-trips verbatim

As part of anchor support, JSONReference.InternalReference now parses a $ref
whose fragment has no leading / (e.g. {"$ref": "#foo"}) as .anchor("foo")
rather than .path(...). The practical effect is that such references round-trip
verbatim ("#foo") instead of being rewritten with a slash ("#/foo").
References into the Components Object (#/components/...) and JSON-pointer paths
(#/foo/bar) are unaffected.

New Contributors

Full Changelog: 6.2.0...7.0.0-alpha.1