validex v0.1.0 Validex.Validators.Exact

The Exact validator is used for validating exact values using simple equality comparison. It works on strings and numbers.

In addition to validating exact values it also expands literal string or number values into a exact validator rule. This adds a shorthand for specifying exact expetations in the schema.

Examples

iex> Validex.Validators.Exact.validate(:name, "Simon", "Peter")
[{:error, :name, :exact, "expected Simon but got Peter"}]

iex> Validex.Validators.Exact.validate(:my_integer, 5, 5)
[{:ok, :my_integer, :exact}]

Summary

Functions

expand(, exact_value)

Callback implementation for Validex.RuleExpander.expand/2.

rule_kind()

Callback implementation for Validex.Validator.rule_kind/0.

validate(attribute, expected_value, actual_value)

Callback implementation for Validex.Validator.validate/3.

validate(, attribute, rule_spec, value)

Callback implementation for Validex.Validator.validate/4.