1

Typically if I wanted to validate a JSON response I would create DTOs and use a library to parse the response into a DTO class. If the parse fails then I can confirm the format of the response body is invalid.

The problem is I want to dynamically configure API endpoints to hit and dynamically configure a way to validate the format of the JSON response. Is there a good way to accomplish this?

config.json

{
  {
    "url": "http://www.example.com/api/v1/test1",
    "response": (expected Dto1)
  },
  {
    "url": "http://www.example.com/api/v1/test2",
    "response": (expected Dto2)
  }
}
1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.