js-data-schema
js-data-schema copied to clipboard
Question about nullable
I have:
var WoofSchema = schemator.defineSchema('woof', {
text: {
type: 'string',
nullable: true,
minLength: 10,
maxLength: 300
}
});
I expect that if the text is null to pass the test, and if is type string to check minLength and maxLength and show errors. But setting nullable to true overwrites the other constraints.
For example:
{
text: "hello"
}
gives no erros.
+1 to getting this to work. Also expected it to validate when the attribute is not null.