Hi,
First off, love this library. Absolutely fantastic work!
Quick question: is there an easier way to allow a value to be a string, empty string or null then the following?
schema = Joi.string().allow('').allow(null)
Appreciate the help!
Best,
James
A single allow, but other than that no. Why ?
What exactly do you mean by a "single allow?"
As for why, I'm using Ember on the frontend and Ember Data sends all fields regardless if they're filled in or not. That said, for text fields, I may receive a null value or an empty string if the user happens to delete text that was already in the field. I was just looking for simpler, less verbose way of defining the validation.
Joi.string().allow('', null). I don't think you can make it shorter than that.
Ah, didn't realize it could take multiple params. Thanks!
Most helpful comment
Joi.string().allow('', null). I don't think you can make it shorter than that.