apiaryio / gavel.js

Validator of HTTP messages (JavaScript implementation)
MIT License
97 stars 22 forks source link

Validation result is missing "values.actual" when encountered validator error #430

Open artem-zakharchenko opened 4 years ago

artem-zakharchenko commented 4 years ago

Setup

Validate the following JSON Schema against a matching body:

{
        "type": "object",
        "properties": {
          "a": {
            "type": "string",
            "format": "alphanumeric"
          },
          "c": {
            "type": "integer"
          }
        }
      }

See the next validation result:

{
  "fields": {
    "headers": {
      "kind": null,
      "values": {},
      "errors": []
    },
    "body": {
      "kind": null,
      "values": {},
      "errors": [
        {
          "message": "Validator error: unknown format \"alphanumeric\" is used in schema at path \"#/properties/a\""
        }
      ]
    },
    "statusCode": {
      "kind": null,
      "values": {},
      "errors": []
    }
  },
  "valid": false
}

Current behavior

result.fields.body.values is an empty object. It misses values.actual.

Expected behavior