epiphone / routing-controllers-openapi

Runtime OpenAPI v3 schema generation for routing-controllers.
MIT License
306 stars 58 forks source link

How to handle HTTP errors #66

Open PhilippMolitor opened 3 years ago

PhilippMolitor commented 3 years ago

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?

epiphone commented 3 years ago

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!

PhilippMolitor commented 3 years ago

Is there any plan on supporting that? This seems like a core component to me. Imagine @ErrorResponseSchema(NotFoundError).

epiphone commented 3 years ago

No plans, nope. PRs are welcome :+1:

bratanon commented 3 years ago

+1 for this feature