error-or
error-or copied to clipboard
Use Errors for SwaggerResponse attributes?
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!
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 😊