Liking cljdoc? Tell your friends :D

com.blockether.skjema.uri

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.
raw docstring

absolute?clj

(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.
sourceraw docstring

escape-tokenclj

(escape-token t)

One member name as a JSON Pointer token.

One member name as a JSON Pointer token.
sourceraw docstring

fragmentclj

(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.
sourceraw docstring

percent-decodeclj

(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.
sourceraw docstring

pointer-tokensclj

(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.
sourceraw docstring

resolve-refclj

(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.
sourceraw docstring

strip-fragmentclj

(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.
sourceraw docstring

unescape-tokenclj

(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 `/`.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close