New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undefined array values seem to bypass validation #131
Comments
Hmm, this is an interesting one 🤔
I think that right now we are handling This has some more implications though, what would we expect the following to give? const schema = {
type: 'object',
properties: {
a: { type: 'string' }
}
}
const data = {
a: undefined
} Since the Any input is welcome :) |
For me, this particular problem resulted in some interesting effects. On the client, I was capturing some property of an array of DOM elements. There was a typo in my code, resulting in me just capturing an array full of The array was then JSON serialized, sent across the wire, and received by my server. Some time later, my server would re-validate the data and unexpectedly fail. This is because I often use JSON schemas in this manner to ensure that my code is doing the right thing, but in this case it doesn't seem to be able to offer me protection. |
Hmm, if |
Hi there!
This may be related to #116.
I have a simple schema that just checks if all items in a given array are strings. However,
undefined
values seem to pass this validation check, which is undesired. Example code can be found here: https://runkit.com/57ec9a7a8b6a9f1400abb925/5854116ee921e7001333f496Is this a problem with my schema, or a problem with the generated validator function?
Thanks,
Alex
The text was updated successfully, but these errors were encountered: