Client generation: Is it possible to get a generic error in the response struct #1425
Unanswered
karthikinamanamelluri
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am in the process to evaluating this library to generate client code for my api. I tried generating the client code and its works fine.
Only question/concern I have is with handling response for failed requests. I see that a separate field is getting generated for each response code JSON202, JSON400, JSON404 etc., This way, the code that consumes the client functions, need to handle different error codes, and wrap it in a error to send back to upstream callers.
Is it possible to generate types in such a way that there is only one error field in the response, and different error codes can respond with different custom errors in the error field. This way clients can just handle required errors, and the rest can be returned as errors to upstream callers.
Please share your thoughts on this.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions