JSV.Builder (jsv v0.10.1)
View SourceInternal logic to build raw schemas into JSV.Root
structs.
Summary
Functions
Adds a schema under the given key to the build, so that key or references to this schema or its subschemas become buildable.
Builds the given root schema or reference into the given validators.
Builds a subschema. Called from vocabulary modules to build nested schemas such as in properties, if/else, items, etc.
Ensures that the remote resource that the given reference or key points to is fetched in the builder internal cache
Returns the raw schema identified by the given key. Use ensure_resolved/2
before if the resource may not have been fetched.
Returns a new builder. Builders are not reusable ; a fresh builder must be made for each different root schema.
Adds a new key to be built later. A key is generatlly derived from a reference.
Types
@type buildable() :: {:resolved, resolvable()} | resolvable()
@type path_segment() :: binary() | non_neg_integer() | atom() | {atom(), term()}
@type resolvable() :: JSV.Resolver.resolvable()
Functions
@spec add_schema!(t(), JSV.Key.t(), JSV.normal_schema()) :: t()
Adds a schema under the given key to the build, so that key or references to this schema or its subschemas become buildable.
@spec build!(t(), JSV.Ref.ns() | JSV.Ref.t(), JSV.Validator.validators()) :: {JSV.Validator.validators(), t()}
Builds the given root schema or reference into the given validators.
@spec build_sub!(JSV.normal_schema(), [path_segment()], t()) :: {JSV.Validator.validator(), t()} | {:error, term()}
Builds a subschema. Called from vocabulary modules to build nested schemas such as in properties, if/else, items, etc.
@spec ensure_resolved!(t(), resolvable()) :: t()
Ensures that the remote resource that the given reference or key points to is fetched in the builder internal cache
@spec fetch_resolved!(t(), JSV.Key.t()) :: JSV.Resolver.Resolved.t() | {:alias_of, JSV.Key.t()}
Returns the raw schema identified by the given key. Use ensure_resolved/2
before if the resource may not have been fetched.
Returns a new builder. Builders are not reusable ; a fresh builder must be made for each different root schema.
Adds a new key to be built later. A key is generatlly derived from a reference.