Hi,
I have the following JSON response:
{
"access": [
{
"id": 1,
"client": "127.0.0.1",
"apikey": "apikey1",
"description": "Local call"
},
{
"id": 2,
"client": "::1",
"apikey": "apikey2",
"description": "Local call"
},
{
"id": 3,
"client": "192.168.0.100",
"apikey": "apikey3",
"description": "Remote call"
}
]
}
And this JSON Schema:
var accessSchema = {
"items": {
"type": "object",
"properties": {
"access: {
"type": "array",
"items": {
"properties": {
"id": { "type": "string" },
"client": { "type": "string" },
"apikey": { "type": "string" },
"description": { "type": "**integer**" }
}
}
}
}
}
}
As you can see, I’ve declared description (a string property) as an INTEGER just to get an error. But for my surprise, the following test is returning always TRUE:
pm.test('Valid JSON schema', function() {
pm.expect(tv4.validate(JSON.parse(responseBody), accessSchema)).to.be.true;
});
What is wrong with my code?