Provides built-in JSON Schema resources bundled directly in the module.
This module embeds the canonical Draft 2020-12 meta-schema family as Elixir
maps, avoiding runtime file reads and JSON decoding. It also exposes a
compiled defs registry so built-in $ref and $dynamicRef targets can
participate in normal runtime resolution.
The public API is intentionally small:
fetch/1returns{:ok, schema_map}or:errorknown_uri?/1reports whether a URI is bundledcompiled_defs/1returns a compiled defs registry for the built-in family
Summary
Functions
Returns the compiled defs registry for the built-in schema family containing the given URI.
Fetches a bundled schema by canonical URI.
Returns true if the given URI is bundled with the library.
Functions
Returns the compiled defs registry for the built-in schema family containing the given URI.
The returned map includes:
- each built-in resource under its canonical absolute URI
- all compiled defs discovered within each resource
- all
$anchorand$dynamicAnchorabsolute entries discovered by scanning the raw built-in resources
This allows built-in schemas to behave like a normal compiled defs registry
during $ref and $dynamicRef resolution.
Fetches a bundled schema by canonical URI.
Returns {:ok, map} when the URI is known, otherwise returns :error.
Examples
iex> {:ok, schema} = JSONSchex.Draft202012.Schemas.fetch("https://json-schema.org/draft/2020-12/schema")
iex> is_map(schema)
true
iex> JSONSchex.Draft202012.Schemas.fetch("https://example.com/custom")
:error
Returns true if the given URI is bundled with the library.
Examples
iex> JSONSchex.Draft202012.Schemas.known_uri?("https://json-schema.org/draft/2020-12/schema")
true
iex> JSONSchex.Draft202012.Schemas.known_uri?("https://example.com/custom")
false