apiaryio/gavel-spec

Provide proper loose/strict values diff behavior

artem-zakharchenko opened this issue · 0 comments

There is a feature description that says Gavel should return a validation error upon validating an array that misses certain values opposed to expected array:

Scenario: Array member is missing in real JSON body
When real HTTP body is following:
"""
{
"object": {
"a": "bau bau",
"c": "boo boo",
"e": "mrau mrau"
},
"array": [
1
],
"string": "Foo bar"
}
"""
Then Gavel will set some error for "body"
And Request or Response is NOT valid

It appears this hasn't been working properly in the current version of Gavel, and thus this behavior is removed for now.

However, we must bring it back once it's properly supported in Gavel.

Background

The reason this feature never worked in gavel is:

  1. There has been an invalid JSON example #39, which produced false positive upon validating this feature suit.
  2. When the JSON is valid, there is no error thrown in Gavel, which fails the feature tests.
  3. The validation error is not thrown because the JsonSchema created from the expected JSON has valuesScript: false, which means it allows more or less values between given and expected JSON.