New attribute: required
richarddavenport opened this issue · comments
Not sure how this could be implemented, but I would love to be able to set a property to required and if it is missing throw an error.
var Profile = new SchemaObject({
id: {type: String, required: true}
});
var profile = new Profile();
console.log(profile.getErrors());
// Prints:
[ { errorMessage: 'String requirement not met.',
setValue: undefined,
originalValue: undefined,
fieldSchema: { name: 'id', type: 'string', required: true } } ]
// Clear all errors.
profile.clearErrors();
I have a few ideas on some enhancements and would love to help where I can. Are you willing to accept any pull requests?
I'll definitely accept pull requests.
Thanks @abpai for the pull request!