Open MichailShcherbakov opened 2 months ago
It appears to me that the response schema is not used for any type checking or run time parsing of the router return value. You can return anything from the router.
Am I missing anything?
If true, we’re missing an important check. One value of types on an API return value is to help prevent developers from accidentally returning extra, possibly sensitive data.
The answer:
You are correct, Hono's Validator does not validate the response.
Would be great to have unrecognized keys stripped.
By default Zod object schemas strip out unrecognized keys during parsing. It works fine in requests, but it doesn't work in responses.
Example:
The route returns the next reponse:
But the response should be:
Deps: