An API I have provides responses in the following format:
[
{"id": 12345,
"value": "some_string",
"practice_id": "12344"},
{"id": 12346,
"value": "some_other_string",
"practice_id": "12345"},
]
I'm currently testing whether the response complies with a specific JSON-Schema, and my schema test looks like this:
response.body.should.have.schema({
type: 'array',
required: ['id', 'value', 'practice_id'],
properties: {
id: {
type: 'number',
},
value: {
type: 'string',
},
practice_id: {
type: 'string',
minLength: 5,
}
}
});
The problem I'm facing is that the test passes even if I modify the data type of id to string
or change the value of practice_id to number
, which is incorrect.
What am I missing here? I am utilizing Postman-BDD for validating the responses.