js-data-schema icon indicating copy to clipboard operation
js-data-schema copied to clipboard

Question about nullable

Open leandroz opened this issue 9 years ago • 1 comments

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.

leandroz avatar May 25 '15 06:05 leandroz

+1 to getting this to work. Also expected it to validate when the attribute is not null.

veikovx avatar Nov 03 '15 13:11 veikovx