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
It is burdensome to pass attributeDescription to every validator of a field:
constValidations=buildValidations({name: [validator('presence',{presence: true,attributeDescription: 'Course name (language)'}),validator('length',{min: 1,attributeDescription: 'Course name (language)'}),validator('no-whitespace-around',{attributeDescription: 'Course name (language)'})]});
It is obvious that conceptually attributeDescription is an entity that belongs to the whole field and should be shared among all validators.
I suggest the following API:
/** * Top level method that will ultimately return a mixin with all CP validations * @param {Object} validations Validation rules * @param {Object} commonOptions Options to be includd into every validator unless defined explicitly * @return {Ember.Mixin} */exportdefaultfunctionbuildValidations(validations){
which would drastically simplify the above example:
constValidations=buildValidations({name: [validator('presence',true),validator('length',{min: 1}),validator('no-whitespace-around')]},{attributeDescription: 'Course name (language)'});
The text was updated successfully, but these errors were encountered:
Thanks for the suggestion. I definitely had something like this in my head for future implementation. Ill take a look into this more when I have some time.
* Add buildOptions and processOptions hooks
* Default options for validators (#38)
* All options can be functions that are called right before validated
via processOptions
* Removed moment dependency (#30)
It is burdensome to pass
attributeDescription
to every validator of a field:It is obvious that conceptually
attributeDescription
is an entity that belongs to the whole field and should be shared among all validators.I suggest the following API:
which would drastically simplify the above example:
The text was updated successfully, but these errors were encountered: