json_xema v0.6.0 JsonXema View Source
A JSON Schema validator.
Link to this section Summary
Types
The return type of a validation run.
This struct contains the schema and references of the schema.
Functions
This function creates a new JsonXema from the given schema.
Converts %JsonXema{} to %Xema{}.
Returns true if the value is a valid value against the given schema;
otherwise returns false.
Returns :ok if the value is a valid value against the given schema;
otherwise returns an error tuple.
Returns :ok if the value is a valid value against the given schema;
otherwise raises a Elixir.JsonXema.ValidationError. See validate3 for
available options.
Link to this section Types
Specs
result() :: Xema.Validator.result()
The return type of a validation run.
Specs
schema() :: Xema.Schema.t()
Specs
t() :: %JsonXema{refs: map(), schema: Xema.Schema.t()}
This struct contains the schema and references of the schema.
Link to this section Functions
Specs
This function creates a new JsonXema from the given schema.
Possible options:
:loader- a loader for remote schemas. This option will overwrite theloader from the config. See [Configure a loader](loader.html) to how to define a loader.
Examples
iex> ~s({"type": "string"})
...> |> Jason.decode!()
...> |> JsonXema.new()
%JsonXema{refs: %{}, schema: %Xema.Schema{type: :string}} Specs
Converts %JsonXema{} to %Xema{}.
Specs
Returns true if the value is a valid value against the given schema;
otherwise returns false.
Specs
Returns :ok if the value is a valid value against the given schema;
otherwise returns an error tuple.
With the option :fail, you can define when the validation is aborted. This
also influences how many error reasons are returned.
:immediatelyaborts the validation when the first validation fails.:early(default) aborts on failed validations, but runs validations for all properties and items.:finallyaborts after all possible validations.
Specs
Returns :ok if the value is a valid value against the given schema;
otherwise raises a Elixir.JsonXema.ValidationError. See validate3 for
available options.