URI reference resolution and JSON Pointer tokens - the addressing half of JSON Schema.
Identifiers in a schema are URI REFERENCES: $id moves the base, $ref
resolves against whatever base encloses it, and a fragment is either an
anchor name or a JSON Pointer. Everything here is string work; nothing
fetches anything, because a validator that resolves a reference over the
network is a validator that fails differently on every machine.
URI reference resolution and JSON Pointer tokens - the addressing half of JSON Schema. Identifiers in a schema are URI REFERENCES: `$id` moves the base, `$ref` resolves against whatever base encloses it, and a fragment is either an anchor name or a JSON Pointer. Everything here is string work; nothing fetches anything, because a validator that resolves a reference over the network is a validator that fails differently on every machine.
(absolute? u)True when the reference carries a scheme, so it resolves to itself.
True when the reference carries a scheme, so it resolves to itself.
(escape-token t)One member name as a JSON Pointer token.
One member name as a JSON Pointer token.
(fragment u)The fragment of u WITHOUT its #, or nil when it carries none. An empty
fragment (uri#) answers the empty string, which is a different fact.
The fragment of `u` WITHOUT its `#`, or nil when it carries none. An empty fragment (`uri#`) answers the empty string, which is a different fact.
(percent-decode s)Decode %XX escapes as UTF-8. A pointer fragment is part of a URI, so
/foo%20bar and /foo bar name the same member.
Decode `%XX` escapes as UTF-8. A pointer fragment is part of a URI, so `/foo%20bar` and `/foo bar` name the same member.
(pointer-tokens pointer)Split a JSON Pointer into decoded tokens. The empty pointer addresses the document itself and answers no tokens.
Split a JSON Pointer into decoded tokens. The empty pointer addresses the document itself and answers no tokens.
(resolve-ref base ref)Resolve reference ref against base, RFC 3986 style.
The two cases a URI library gets wrong for schemas are handled first: an
empty reference is the base itself, and a fragment-only reference replaces
the base's fragment - including against an opaque base like urn:uuid:...,
where java.net.URI/resolve would hand the fragment straight back.
Resolve reference `ref` against `base`, RFC 3986 style. The two cases a URI library gets wrong for schemas are handled first: an empty reference is the base itself, and a fragment-only reference replaces the base's fragment - including against an opaque base like `urn:uuid:...`, where `java.net.URI/resolve` would hand the fragment straight back.
(strip-fragment u)The URI without its fragment. nil in, empty string out, because the base of
a schema that never declared one is the empty URI.
The URI without its fragment. `nil` in, empty string out, because the base of a schema that never declared one is the empty URI.
(unescape-token t)One JSON Pointer token as the member name it addresses: ~1 is / and ~0
is ~, in that order, so ~01 decodes to ~1 and not to /.
One JSON Pointer token as the member name it addresses: `~1` is `/` and `~0` is `~`, in that order, so `~01` decodes to `~1` and not to `/`.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |