I have an interceptor which puts each returned value into this form:
{
"data": {value},
"success": true
}
but DTO types I use are just {value}, I would like to use ApiDog’s response checking feature, but i have no idea how can i make this work without manually changing each response type to include my template.
Hi Kupyn,
Thanks for reaching out. To resolve the validation errors caused by the automatic wrapping of your responses in ApiDog, consider these steps:
Define a Generic Data Model
Use a generic model as a reference and adjust the value property for each specific response.
Use Post-Request Scripts for Validation
For example, if the expected value template is: {"id":"123","name":"Example","amount":100.5}
You can use a script like this in ApiDog:
// Get the response body
const responseBody = pm.response.json();
// Extract and parse the value field
const extractedValue = JSON.parse(responseBody.value);
// Assertion checks
pm.test("Check field types", function () {
pm.expect(typeof extractedValue.id).to.eql("string");
pm.expect(typeof extractedValue.name).to.eql("string");
pm.expect(typeof extractedValue.amount).to.eql("number");
});```
I hope this helps. Let me know if you need further assistance.

You’re welcome! To make the script universal, you can add it at the folder level. Processors configured at the folder level will apply to all endpoints within that folder. This way, you don’t need to manually add the script to each request.
You can refer to our documentation for more details: Overview - Apidog Docs