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
Undefined attributes within a can.Map, that have a corresponding define.validate object, are not validated with validatejs.
The cause is that the validate method in shims/validatejs.js receives as first parameter can.Map.prototype.serialize(), which by default doesn't serialize undefined values. Then it filters the attributes with Object.keys(), thus fails to validate attributes with corresponding define.validate object, but no value e.g. can.Map.extend('Test',{ define: { a: { validate: { required: true } }} }
new Test().validate() returns true
A workaround is all attributes to have a default value of 'null'. But is it desirable?
The text was updated successfully, but these errors were encountered:
Undefined attributes within a can.Map, that have a corresponding define.validate object, are not validated with validatejs.
The cause is that the validate method in shims/validatejs.js receives as first parameter can.Map.prototype.serialize(), which by default doesn't serialize undefined values. Then it filters the attributes with Object.keys(), thus fails to validate attributes with corresponding define.validate object, but no value e.g.
can.Map.extend('Test',{ define: { a: { validate: { required: true } }} }
new Test().validate()
returns trueA workaround is all attributes to have a default value of 'null'. But is it desirable?
The text was updated successfully, but these errors were encountered: