Bounded JSON Schema 2020-12 validation without remote reference fetching.
Summary
Functions
Applies bounded, direct JSON Schema property defaults and validates the result.
Returns the secure default JSON value budget.
Checks that a term can be represented losslessly as JSON.
Returns the maximum configurable JSON value budget.
Returns the secure default byte budget used for bounded JSON values.
Returns the minimum configurable JSON value budget.
Validates the original JSON-compatible instance against a bounded subset.
Validates the bounded modern result variants emitted by this package.
Checks a schema without validating an instance. No network references are fetched.
Functions
@spec apply_property_defaults(map(), map() | boolean(), keyword()) :: {:ok, map()} | {:error, term()}
Applies bounded, direct JSON Schema property defaults and validates the result.
Only defaults reached through literal properties entries are applied. The
helper recurses into existing object properties and objects supplied by an
explicit property default. It does not infer defaults through references,
combinators, conditionals, array items, or pattern properties, and it never
creates an absent parent object unless that property declares its own
default.
Presence is determined with Map.has_key?/2, so nil, false, zero, and an
empty string are never replaced. At most 500 defaults are applied, and the
completed value must satisfy the normal depth, node, byte, and schema bounds.
Server dispatch never calls this helper automatically.
@spec default_instance_bytes() :: pos_integer()
Returns the secure default JSON value budget.
Checks that a term can be represented losslessly as JSON.
@spec max_allowed_instance_bytes() :: pos_integer()
Returns the maximum configurable JSON value budget.
@spec max_instance_bytes() :: pos_integer()
Returns the secure default byte budget used for bounded JSON values.
@spec min_allowed_instance_bytes() :: pos_integer()
Returns the minimum configurable JSON value budget.
Validates the original JSON-compatible instance against a bounded subset.
JSON Schema default values are annotations and are never inserted by this
function. Hosts that explicitly want direct property defaults can call
apply_property_defaults/2 before invoking a handler.
Validates the bounded modern result variants emitted by this package.
Checks a schema without validating an instance. No network references are fetched.