A schema's handle, or a field's. Everything it does reads the current datafile when it is used, so one handle stays right for the life of an application. A handle is a plain term, safe to keep and share.
Summary
Functions
Its annotations, over those of a schema its field references.
The HTML validation attributes its rules imply, with required from the object it sits in.
The handle for a field at a path, such as address.city, items[].name or labels.*.
An object's fields' constraints by dot path, such as address.city.
An object's fields' choices by dot path, for the fields that list some.
An object's fields' handles, in its order, or none for any other value.
The schema's key, such as signUp.
The choice for a value: {:ok, option} from the schema's own choices or else
the field's option source, :error for none, or the source's {:error, reason}.
Its own key in the object it sits in, such as city, or empty for the schema itself.
The schema's own choice for a value, or nil.
The choices the field allows, in the order its rules list them, empty when it lists none.
The field's path in its schema, such as address.city or items[].name, or empty for the schema.
The fields, relative to this handle, that its mutations' and issues' conditions read.
What the rules say the field renders as, such as text, select or date-time, or nil for a oneOf of shapes.
Suggestions from the field's option source for a query: {:ok, options},
empty without a source that searches, or the source's {:error, reason}.
Whether an option source suggests choices for this field.
Calls back when the datafile changes this handle's schema, until the returned function is called.
Whether a value passes.
Validates a value: {:ok, value} when it passes, or {:error, issues}. Maps
with string or atom keys, lists, primitives and structs are read as JSON has
them. Checks in code run in order, after the rules. A :context given is
merged over the instance's.
The value when it passes, or raises FeaturevisorSchemas.ValidationError with the issues.
The same handle with an input, such as the values a form has so far: its
members describe the rules with every mutation whose conditions match that
input, and the :context, applied at every depth.
Types
Functions
Its annotations, over those of a schema its field references.
@spec constraints(t()) :: FeaturevisorSchemas.Constraints.t()
The HTML validation attributes its rules imply, with required from the object it sits in.
The handle for a field at a path, such as address.city, items[].name or labels.*.
@spec field_constraints(t()) :: %{ required(String.t()) => FeaturevisorSchemas.Constraints.t() }
An object's fields' constraints by dot path, such as address.city.
@spec field_options(t()) :: %{ required(String.t()) => [FeaturevisorSchemas.Option.t()] }
An object's fields' choices by dot path, for the fields that list some.
An object's fields' handles, in its order, or none for any other value.
The schema's key, such as signUp.
@spec lookup(t(), term(), keyword()) :: {:ok, FeaturevisorSchemas.Option.t()} | :error | {:error, term()}
The choice for a value: {:ok, option} from the schema's own choices or else
the field's option source, :error for none, or the source's {:error, reason}.
Its own key in the object it sits in, such as city, or empty for the schema itself.
@spec option(t(), term()) :: FeaturevisorSchemas.Option.t() | nil
The schema's own choice for a value, or nil.
@spec options(t()) :: [FeaturevisorSchemas.Option.t()]
The choices the field allows, in the order its rules list them, empty when it lists none.
The field's path in its schema, such as address.city or items[].name, or empty for the schema.
The fields, relative to this handle, that its mutations' and issues' conditions read.
What the rules say the field renders as, such as text, select or date-time, or nil for a oneOf of shapes.
@spec search(t(), String.t(), keyword()) :: {:ok, [FeaturevisorSchemas.Option.t()]} | {:error, term()}
Suggestions from the field's option source for a query: {:ok, options},
empty without a source that searches, or the source's {:error, reason}.
Whether an option source suggests choices for this field.
Calls back when the datafile changes this handle's schema, until the returned function is called.
Whether a value passes.
@spec validate(t(), term(), keyword()) :: {:ok, term()} | {:error, [FeaturevisorSchemas.Issue.t()]}
Validates a value: {:ok, value} when it passes, or {:error, issues}. Maps
with string or atom keys, lists, primitives and structs are read as JSON has
them. Checks in code run in order, after the rules. A :context given is
merged over the instance's.
The value when it passes, or raises FeaturevisorSchemas.ValidationError with the issues.
The same handle with an input, such as the values a form has so far: its
members describe the rules with every mutation whose conditions match that
input, and the :context, applied at every depth.