Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Obtain an error if a Json contains key not defined in Constraints #335

Open
antimoroma opened this issue Jun 1, 2020 · 0 comments
Open

Comments

@antimoroma
Copy link

antimoroma commented Jun 1, 2020

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 :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant