optimal v0.3.6 Optimal View Source
Documentation for Optimal.
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 section Functions
Validates opts according to a schema or the constructor for a schema. Raises on invalid opts.
iex> Optimal.validate!([reticulate_splines?: true], opts: [:reticulate_splines?])
[reticulate_splines?: true]
iex> Optimal.validate!([reticulate_splines?: true], opts: [:load_textures?], extra_keys?: true)
[reticulate_splines?: true]
iex> schema = Optimal.schema(opts: [:reticulate_splines?], required: [:reticulate_splines?], extra_keys?: true)
...> Optimal.validate!([reticulate_splines?: true, hack_interwebs?: true], schema)
[reticulate_splines?: true, hack_interwebs?: true]
iex> Optimal.validate!([], opts: [:reticulate_splines?], required: [:reticulate_splines?])
** (ArgumentError) Opt Validation Error: reticulate_splines? - is required
Link to this function
validate(opts, schema)
View Source
validate(opts :: Keyword.t(), schema :: Optimal.Schema.t()) :: {:ok, Keyword.t()} | {:error, [error()]}