ashton v0.3.7 Ashton View Source

Documentation for Ashton.

Link to this section Summary

Link to this section Types

Link to this type

validation_result() View Source
validation_result() :: {:ok, Keyword.t()} | {:error, [error()]}

Link to this section Functions

See Ashton.Doc.document/1.

See Ashton.Doc.document/2

See Ashton.Schema.merge/2

Link to this function

merge(left, right, opts) View Source

See Ashton.Schema.merge/3.

See Ashton.Schema.new/0.

See Ashton.Schema.new/1

Link to this function

validate(opts, schema) View Source
validate(opts :: Keyword.t(), schema :: Ashton.Schema.t()) ::
  {:ok, Keyword.t()} | {:error, [error()]}

Link to this function

validate!(opts, schema) View Source
validate!(opts :: Keyword.t(), schema :: schema()) :: Keyword.t() | no_return()

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