routing-controllers-openapi
routing-controllers-openapi copied to clipboard
How to handle HTTP errors
I implemented this library and immediately noticed that there is no example or documentation on how to include routing-controller's HttpErrors in the generated spec.
Is there a defined best-practice how to add the spec for a method that is able to throw e.g. a NotFoundError?
No, there isn't. You could use the OpenAPI decorator to add a responses.404 property, or perhaps write another decorator that calls OpenAPI internally to save a bit of typing.
Please share here if you come up with a better solution!
Is there any plan on supporting that? This seems like a core component to me. Imagine @ErrorResponseSchema(NotFoundError).
No plans, nope. PRs are welcome :+1:
+1 for this feature