-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
256 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,29 @@ | ||
# Changelog | ||
|
||
### 3.0.0 | ||
|
||
### Changed | ||
|
||
- function `validate` renamed to `check` | ||
|
||
### Added | ||
|
||
- Most checks have an `and_` version. E.g. `and_string_is_int` | ||
- check `ok` | ||
- check `optional_in_dict` | ||
- check `optional_in` | ||
- check `required_in_dict` | ||
- check `required_in` | ||
|
||
## 2.0.0 | ||
|
||
### Changed | ||
|
||
- All functions moved to main `valid` module. | ||
- Remove all other sub modules | ||
|
||
## 0.2.0 | ||
|
||
### Changed | ||
|
||
- Refactor list.every so it works with nested validators | ||
- Refactor list.every so it works with nested validators |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Design | ||
|
||
## Why not use `use`? | ||
|
||
```gleam | ||
use name <- valid.try(name_validator) | ||
use email <- valid.try(email_validator) | ||
``` | ||
|
||
Looks nice, but the fact that this would short circuit at the first failed validator, means that we cannot collect all errors. | ||
|
||
## What if steps in the pipeline imply `and`? | ||
|
||
```gleam | ||
let name_validator = | ||
|> valid.ok | ||
|> valid.string_is_not_empty("Empty") | ||
|> valid.string_min_length("More", 6) | ||
|> valid.string_max_length("Less", 2) | ||
``` | ||
|
||
This would be nice, as we could get rid of `and`. | ||
|
||
Each step in the pipeline would return a function that expected the previous validator. | ||
|
||
However `list_all` is an issue. |
Oops, something went wrong.