A stand-in is only useful if it behaves like the real thing. So Understudy checks every request on the way in, and every response on the way out.
Requests are validated
Each incoming call is checked against the contract for its route:
- Path, query and header parameters: whether they are required, and their types, with sensible coercion for values that arrive as strings.
- The body, against the declared schema.
An invalid request is rejected with a proper error, a 400 with a clear list of what was wrong, exactly as a strict real API would reject it. Your client's error handling gets a real workout.
Responses are validated too
This is the drop-in guarantee. Before a response leaves, Understudy checks it against the contract. A response that would break the contract is never returned. Instead it becomes a loud, logged error, so the bug is caught here and never reaches your app as a bad shape.
The upshot: what your application sees, the shapes, the statuses, the rejections, matches the real API.