error-or icon indicating copy to clipboard operation
error-or copied to clipboard

Use Errors for SwaggerResponse attributes?

Open krassdanke opened this issue 1 year ago • 3 comments

Hi, I like this library since it allows me to pull more and more logic into service classes rather than bloat my controllers. I also want my clients to be able to see possible outcomes of API endpoint calls by utilizing OpenAPI spec "Response" information. Currently I am using the SwaggerResponse attribute, but I watched your video about flow control and now I am trying to incorporate the idea of centralized errors into my app.

I was wondering if one can use the defined errors to annotate controller functions, e.g. like this: [SwaggerResponseByError(Errors.Authentication.WrongCredentials)]

Do you think something like this can be achieved? Would you consider it sensible doing so? Thanks!

krassdanke avatar Jul 11 '22 12:07 krassdanke

Hi @krassdanke, awesome question. Sorry for the late response, I've been super busy lately. I hope to have time in a week or two to take a deeper look 😊

amantinband avatar Jul 31 '22 17:07 amantinband