Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
solnic committed Oct 20, 2023
1 parent eaef511 commit c1e5352
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,18 @@ UserContract.conform(%{name: "Jane", email: "[email protected]"})
UserContract.conform(%{email: 312})
# {:error, [error: {[], :has_key?, [:name]}]}

UserContract.conform(%{name: "Jane", email: 312})
# {:error, [error: {[:email], :type?, [:string, 321]}]}
{:error, errors} = UserContract.conform(%{name: "Jane", email: 312})
# {:error,
# [
# %Drops.Contract.Messages.Error.Type{
# path: [:email],
# text: "must be a string",
# meta: %{args: [:string, 312], predicate: :type?}
# }
# ]}

Enum.map(errors, &to_string/1)
# ["email must be a string"]
```

## Schemas
Expand Down

0 comments on commit c1e5352

Please sign in to comment.