Obtain an error if a Json contains key not defined in Constraints
Opened this issue · 0 comments
antimoroma commented
I don't know, if is correct to ask this as a feature, or if is already present and i miss it,but if i have an object with:
{
"a" : "aValue"
}
Define a constraints with:
val constraints = {
a : {
presence : true
}
Is possible to have an error if i try to call validate with an Object like:
{
"a" : "aValue",
"foo" : "sample"
}
because foo is not present in the constraints?
I know is easy , only to be sure that is not already present in the library (more simple than redefine all field) as in this example
https://stackoverflow.com/questions/54881865/check-if-multiple-keys-exists-in-json-object
May be i miss something in the doc , or is not a valid feature for the validation, anyway thank you :)