File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 2424
2525## Usage
2626
27- With Vx, you can define schemata to validate complex data against.
27+ With Vx, you have the capability to define schemata for validating complex data
28+ effortlessly.
2829
2930You first need to define your schema.
3031
3132``` elixir
3233schema = Vx .String .t ()
3334```
3435
35- Then , you can call ` Vx.validate/2 ` or ` Vx.validate!/2 ` to check if a given
36+ After that , you can call ` Vx.validate/2 ` or ` Vx.validate!/2 ` to check if a given
3637values matches:
3738
3839``` elixir
3940Vx .validate (schema, " foo" )
4041# :ok
4142```
4243
43- When the value does not match, an error is returned (or raised respectively)
44- pointing out what is wrong:
44+ When the value does not match, an error is returned (or raised, respectively),
45+ indicating the specific issue.
46+
47+ ``` elixir
48+ Vx .validate (schema, 123 )
49+ # {:error, %Vx.Error{...}}
50+ ```
4551
4652``` elixir
4753Vx .validate! (schema, 123 )
4854# ** (Vx.Error) must be a string
4955```
5056
51- Some types can be augmented with additional constraints by piping everything
57+ Additional constraints can be added to certain types by piping everything
5258together:
5359
5460``` elixir
You can’t perform that action at this time.
0 commit comments