Body - JSON schema draft v3
Background:
- Given you define expected HTTP body using the following "
JSON schema":json{ "type":"object", "$schema": "http://json-schema.org/draft-03/schema", "required":true, "properties":{ "object": { "type":"object", "required":false, "properties":{ "a": { "type":"string", "required":true }, "c": { "type":"string", "required":true }, "e": { "type":"string", "required":true } } }, "string": { "type":"string", "required":true } } }
Scenario: Payload body is valid against given schema
- When real HTTP body is following:
{ "object": { "a": "b", "c": "d", "e": "f" }, "string": "Hello World" } - Then Gavel will NOT set any errors for "
body" - And Request or Response is valid
Scenario: Payload body not valid against schema
- When real HTTP body is following:
{ "object": { "a": "b", "c": "d" }, "string": "Hello World" } - Then Gavel will set some error for "
body" - And Request or Response is NOT valid
Source: features/expectations/body_json_schemav3.feature at v1.2.0, Gavel (MIT license).