-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
filter() constructor doesn't seem to show errors. #44
Comments
I've run into the same issue... It's a problem with the generated code giving options As a temporary work around I'm doing: var validator = require('is-my-json-valid')
var filter = validator.filter(schema);
var validate = validator(schema, {
verbose: true,
greedy: true
});
var filterAndValidate = function(data) {
filter(data);
validate(data);
console.log(validate.errors);
}; It's obviously slower, so not a fix... Just including it as context. |
I have something similar going on as a workaround. I also started poking around at the imjv source to see if I could trace it back, but it's a bit confusing to me. |
* Make errors available when using this feature * Ignore errors from `additionalProperties: false` * Formalize semantics in `README.md` * Warn about input mutation. * Warn that this is a non-standard feature. * Added test cases covering the `filter` feature
I wish this was getting a little attention here. |
I have a small validator written as such:
Long story short, if I take off the .filter, it will throw errors if I take off required fields and the like, but also throw errors on fields that need to be stripped. if I put filter on, it seems the validator won't pass, but the errors array is always undefined.
simple route logic right now just to test this is:
my actual code is commented out
The text was updated successfully, but these errors were encountered: