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
Update error "has additional properties" to have array with additional properties names #102
Comments
I think that this would be awesome! |
this is already possible. You only need to define schema properly. Something like this: var schema = {
type: 'object',
properties: {
name: {type: 'string' },
surname: {type: 'string' },
login: {type: 'string' }
},
required: [ "name", "surname" ],
optional: [ "login" ],
additionalProperties: false
}; |
I believe this can be closed given @dmeznaric solution |
I don't think that this is resolved, the original issue was about giving the property that was extra in the error output. I don't think that this is solved yet... |
Suppose we have a schema with such a properties
userSchema = {name, surname}
But in he input we receive object that looks like
input = {name, surname, login}
When validate accross userSchema, error must contain 'forbiddenProperties' array besides message and property fields.
Example:
{ message: 'has additional properties', property: 'data', additonalProperties: [ 'login' ] }
Kind Regards
The text was updated successfully, but these errors were encountered: