leadpony / justify

Justify is a JSON validator based on JSON Schema Specification and Jakarta JSON Processing API (JSON-P).
Apache License 2.0
96 stars 18 forks source link

Required Properties in the schema are not honored #57

Closed borgogelli closed 4 years ago

borgogelli commented 4 years ago

Required Properties in the schema, are not honored when I specify a key which is missing in the data file

....
  "required": [
    "myFakeKey"
  ] 

So the validator doesn't return any error even if the "myFakeKey" is not present in the json data file;

leadpony commented 4 years ago

@borgogelli

issue57.schema.json

{
    "required": ["myFakeKey"]
}

issue57.json

{
}

I tested them by using Justify-CLI 3.0.0-RC2 as follows:

justify -s issue57.schema.json -i issue57.json

This command outputs the following result.

Validating the schema "issue57.schema.json"...
Justified the correctness of the schema "issue57.schema.json".
Validating the instance "issue57.json"...
[2,1][] The object must have a property whose name is "myFakeKey".
At least 1 problem(s) were found in the instance "issue57.json".

More information is needed to help you.

borgogelli commented 4 years ago

Thank you, It's my fault sorry but I would have expected an exception as result.