My question:
We are using an assert like this.
pm.test(‘Schema is valid’, () => {
pm.expect(jsonData).to.have.jsonSchema(schema);
});
It is throwing error message like this:
Schema is valid | AssertionError: expected data to satisfy schema but found following errors: data.parents.legalResidence.residentBefore should be boolean
Here is how the response for this property look like
“legalResidence”: {
“state”: “CA”,
“residentBefore”: true,
“date”: “199002”
},
Here is the schema for this property:
“legalResidence”: {
“type”: “object”,
“properties”: {
“state”: {
“title”: “State”,
“type”: “string”,
“description”: “Student/Parent state of legal residence.”
},
“residentBefore”: {
“title”: “ResidentBefore”,
“type”: “boolean”,
“description”: “Student/Parent is a resident before a set date that increments every year.”
},
“date”: {
“title”: “Date”,
“type”: “string”,
“description”: “Student/Parent date of legal residence.”
}
}
},
Details (like screenshots):
As you can see, the property is a boolean in the response so we are not sure why postman schema validator is complaining. It is just complaining for all the boolean properties in the schema. When we use online schema validator like JSON Schema Validator - Newtonsoft it does not throw any error.