Open zirkelc opened 4 years ago
Have you tried using the empty rule?
phone: {
type: 'string',
required: false,
validation: { empty: true },
}
Personally I would clean the object so you're not storing empty strings
I don't see the validation property in VSCode intellisense, but could be due to the reason I'm using TypeScript. Thats what I see:
With cleaning the object you mean remove the property from the object or set it to undefined?
I was able to suppress the TypeScript error message for validation
with a //@ts-ignore comment
However, now I get the following error:
Error: Not sure how to validate validation on phone
at .../node_modules/neode/build/Services/Validator.js:273:15
at Array.forEach (<anonymous>)
at .../node_modules/neode/build/Services/Validator.js:247:25
at Array.forEach (<anonymous>)
at BuildValidationSchema (.../node_modules/neode/build/Services/Validator.js:165:23)
at Validator (.../node_modules/neode/build/Services/Validator.js:293:16)
at .../node_modules/neode/build/Services/MergeOn.js:38:38
at processTicksAndRejections (internal/process/next_tick.js:81:5)
Hi,
the validator throws an error if a string property is empty, e.g.
phone = ''
. I defined the propertyphone
on the model as follows:I get the following error stack trace:
I understand that this validation error comes from another library, however, I was wondering if there's a parameter which can be passed to enable empty strings. Otherwise, what is the desired outcome for
required: false
?Thank you for sour support!