ashton v0.4.1 Ashton View Source
Documentation for Ashton.
Link to this section Summary
Functions
Validates opts according to a schema or the constructor for a schema. Raises on invalid opts.
Link to this section Types
Link to this type
error() View Source
Link to this type
schema()
View Source
schema()
View Source
schema() :: Ashton.Schema.t()
schema() :: Ashton.Schema.t()
Link to this type
validation_result() View Source
Link to this section Functions
Link to this function
document(schema) View Source
Link to this function
document(schema, opts) View Source
Link to this function
merge(left, right) View Source
Link to this function
merge(left, right, opts) View Source
Link to this function
schema() View Source
See Ashton.Schema.new/0
.
Link to this function
schema(opts) View Source
Link to this function
validate(opts, schema)
View Source
validate(opts, schema)
View Source
validate(opts :: Keyword.t(), schema :: Ashton.Schema.t()) ::
{:ok, Keyword.t()} | {:error, [error()]}
validate(opts :: Keyword.t(), schema :: Ashton.Schema.t()) :: {:ok, Keyword.t()} | {:error, [error()]}
Link to this function
validate!(opts, schema) View Source
Validates opts according to a schema or the constructor for a schema. Raises on invalid opts.
iex> Ashton.validate!([reticulate_splines?: true], opts: [:reticulate_splines?])
[reticulate_splines?: true]
iex> Ashton.validate!([reticulate_splines?: true], opts: [:load_textures?], extra_keys?: true)
[reticulate_splines?: true]
iex> schema = Ashton.schema(opts: [:reticulate_splines?], required: [:reticulate_splines?], extra_keys?: true)
...> Ashton.validate!([reticulate_splines?: true, hack_interwebs?: true], schema)
[reticulate_splines?: true, hack_interwebs?: true]
iex> Ashton.validate!([], opts: [:reticulate_splines?], required: [:reticulate_splines?])
** (ArgumentError) Opt Validation Error: reticulate_splines? - is required