How do I test for required and non-required fields in the request, in one test? I need to test for Headers and Body

Here is the body

{
“someidentification”: {
“acc”: “string”,
“ref”: “number”
},
“someCategory”: [
{
“catCode”: “string”,
“req”: “boolean”
}
],
“name”: “string”
}

acc, ref and catCode are required

error message will contain e.g. “message”: “body/someidentification must have required property ‘ref’”

Anyone? Is this the right place to post this?

Have a look at the following.

JSON Schema Validation in Postman (softwaretestingmaterial.com)