You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One broad goal we have is to potentially deprecate the use of ember-changeset-validations. Having both ember-changeset and ember-changeset-validations presents some confusion. If we went forward, ember-changeset would be the single library we would use to validate our data.
Currently, at a high level, the changeset API for validations is rather unintuitive and verbose.
e.g. ember-changeset-validations README
This addon updates the changeset helper by taking in a validation map as a 2nd argument (instead of a validator function).
Do we need this? Here is an example of the migration.
let schema = yup.object().shape({
email: yup.string().email().required(),
password: yup.string().required().min(8),
passwordConfirmation: yup.string()
.oneOf([yup.ref('password'), null], 'Passwords must match')
});
const changeset = new Changeset(this.model, schema);
As long as schema adhered to the interface we defined (something like isValid and/or validate methods), then we can detect errors in the current in progress changeset and error appropriately.
That path forward seems to be providing a second changeset with this behavior. Bolting on or changing the API without knowing the consequences (would yup be flexible enough? arbitrary nested changes?) would be detrimental.
RFC
One broad goal we have is to potentially deprecate the use of ember-changeset-validations. Having both
ember-changeset
andember-changeset-validations
presents some confusion. If we went forward,ember-changeset
would be the single library we would use to validate our data.Currently, at a high level, the changeset API for validations is rather unintuitive and verbose.
e.g. ember-changeset-validations README
Do we need this? Here is an example of the migration.
Nominally, this could look like the following...
As long as schema adhered to the interface we defined (something like
isValid
and/orvalidate
methods), then we can detect errors in the current in progress changeset and error appropriately.https://github.com/jquense/yup
Upsides
Downsides
ref #166
The text was updated successfully, but these errors were encountered: