tv4
tv4 copied to clipboard
no name of the `additionalProperty` in the error message
For the following data / schema / code:
var data = {
expected: 5,
unexpected: 'foo'
};
var schema = {
type: 'object',
properties: {
expected: {}
},
additionalProperties: false
};
var res = tv4.validateMultiple(data, schema);
console.log(JSON.stringify(res, null, 4));
The error message I am getting shows the dataPath but don't show the additional property name.
{
"errors": [
{
"message": "Additional properties not allowed",
"params": {},
"code": 303,
"dataPath": "",
"schemaPath": "/additionalProperties",
"subErrors": null,
"stack": "Error\n at new ValidationError ..."
}
],
"missing": [],
"valid": false
}
I would expect to see my property name unexpected
somewhere inside the error message or as a part of res.errors[0].dataPath
.
I'd like to plus one this issue. The change occurred between 1.2.0 and 1.2.1
Sorry about this - should be fixed in 1.2.5
.