Compilation context for JSON Schema validation.
This module provides both the struct for tracking compilation state and the macros for generating validation code.
Struct Fields
:resource- Current resource URI (String.t()):pointer- Current JSON pointer (JsonPtr.t()):caller- Caller environment (Macro.Env.t()):only- Type constraints for combining schemas ([String.t()] | nil):tracked- Tracking mode for unevaluated properties/items (:object | :array | nil):seen- Seen property tracking (MapSet.t() | nil):entrypoint- Original entrypoint pointer (JsonPtr.t()):dump- Debug dump mode (boolean):decoders- Decoder configuration (list):content_type- Content type / MIME type (String.t()):draft- JSON Schema draft version (atom):format- Format validation mode (atom | keyword | boolean)
Naming Conventions
local_schema= the JSON schema content at current pointer (a map)ctx= Context struct (used internally)opts= keyword list (only at macro boundaries in quote blocks)
Summary
Functions
Collects all declarations by walking the schema structure.
Updates the type constraint (:only) by intersecting with new types.
Creates a new Context from keyword options.
Returns the type constraints as a list, or a default list if not set.
Merges keyword options into an existing Context.
Scrubs combining-specific options from the context.
Scrubs combining-specific options from keyword opts.
Converts a Context to keyword options.
Sets the tracked mode for the context.
Types
@type t() :: %Exonerate.Context{ caller: Macro.Env.t() | nil, content_type: String.t() | nil, decimal: :all | keyword() | nil, decoders: list() | nil, draft: atom() | nil, dump: boolean() | nil, entrypoint: JsonPtr.t() | nil, format: atom() | keyword() | boolean() | nil, only: [String.t()] | nil, pointer: JsonPtr.t() | nil, resource: String.t() | nil, seen: MapSet.t() | nil, tracked: :object | :array | nil }
Functions
Collects all declarations by walking the schema structure.
This is Phase 1 of the two-phase compilation. It must be called before any code generation macros are invoked.
Updates the type constraint (:only) by intersecting with new types.
This accumulates type restrictions through combining schemas.
Creates a new Context from keyword options.
Returns the type constraints as a list, or a default list if not set.
Merges keyword options into an existing Context.
Scrubs combining-specific options from the context.
The following fields are cleared:
- :only
- :tracked
- :seen
Scrubs combining-specific options from keyword opts.
Converts a Context to keyword options.
Sets the tracked mode for the context.