Skip to content

Commit

Permalink
Improve validation
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer committed Apr 18, 2022
1 parent b5110dd commit f0bf2fa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,15 @@ import { ValidationResult, ValidatorMapFunc, ValidatorAction } from 'ember-chang

## Alternative Changeset

Enabled in 4.1.0
Enabled in 4.1.0. Experimental and subject to changes until 5.0.

We now ship a ValidatedChangeset that is a proposed new API we would like to introduce and see if it jives with users. The goal of this new feature is to remove confusing APIs and externalize validations.

- ✂️ `save`
- ✂️ `cast`
- ✂️ `merge`
- `errors` are required to be added to the Changeset manually after `validate`
- `validate` takes a callback with the sum of changes. In user land you will call `changeset.validate((changes) => yupSchema.validate(changes))`
- `validate` takes a callback with the sum of changes and original content to be applied to your externalized validation. In user land you will call `changeset.validate((changes) => yupSchema.validate(changes))`

```js
import Component from '@glimmer/component';
Expand Down

0 comments on commit f0bf2fa

Please sign in to comment.