You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Whenever I generate a typescript-node API client, the generated code does not respect different return types for different status codes. For example, if 200 returns a user and 400 returns an error, the error gets parsed as a user and thus the error message is lost!
Describe the solution you'd like
There's a generated bit of code that looks like this:
Is your feature request related to a problem? Please describe.
Whenever I generate a typescript-node API client, the generated code does not respect different return types for different status codes. For example, if 200 returns a user and 400 returns an error, the error gets parsed as a user and thus the error message is lost!
Describe the solution you'd like
There's a generated bit of code that looks like this:
Ideally, it should follow the json specifications where different status codes return different types.
This can be a configurable mode called "strictStatusTypes" and resolve like so:
Describe alternatives you've considered
An easier solution to the issue would be to just leave the body alone when there's an error and use a raw JSON object without the parse.
Additional context
Whenever the success status has no body (e.g. 201, 202, ...) the error body is left untouched which makes this behavior really inconsistent!
The text was updated successfully, but these errors were encountered: