In Postman tests I can validate if response has a given schema:
var jsonObject = pm.response.json();
var schemaResponse = {
"type": "object",
"properties": {
"ok": {
"type": "boolean"
},
"operation_id": {
"type": "string"
},
"push_ids": {
"type": "array",
"items": [
{
"type": "string"
}
]
},
"message_ids": {
"type": "array",
"items": [
{
"type": "string"
},
{
"type": "string"
}
]
},
"content_urls": {
"type": "array",
"items": [
{
"type": "string"
},
{
"type": "string"
}
]
},
"localized_ids": {
"type": "array",
"items": [
{
"type": "string"
},
{
"type": "string"
}
]
}
}
}
pm.test("Response Schema Validation", function() {
var result = tv4.validateResult(jsonObject, schemaResponse);
pm.expect(result.valid).to.be.true;
});
Can I do the same in Mule 4 Munit tests?