1

I'm starting to use Simple Schema for validation on some forms and am perplexed as to why a non-optional empty string is not invalid? I would it expect it to be allowed on an optional field, but not required... perhaps I'm not understanding how it's supposed to work.

schema = new SimpleSchema({
  name: {
    type: String,
  }
});
ctx = schema.namedContext('test');
ctx.validateOne({'name':''}, 'name');
ctx.keyIsInvalid('name'); // -> false

I found this github comment that seems to say it doesn't, but perhaps that's changed? https://github.com/aldeed/meteor-simple-schema/issues/64

Scott
  • 3,204
  • 3
  • 31
  • 41

0 Answers0