-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add response code to all endpoint when there are ExceptionMapper(s) defined #404
Comments
This is actually being worked on right now in SmallRye OpenAPI. Do you think a change to the spec is needed for this to be supported? Right now it's not something specifically called out by the spec, which leaves it up to each implementation. Or we could update the SDK to cover this. Which implementation are you currently using? |
I must say that I'm not too familiar with the spec so I'll just shoot whatever comes to mind. So that'll be a new annotation (or reuse an existing one) and add another field in ApiResponse to state the ignored or relevant error codes. And I'm using SmallRye/Quarkus |
Thoughts @MikeEdgar and @lamtrhieu - how does this compare to what's being worked on in SmallRye already? |
The main difference here is the linkage between the resource method and the |
Do you think there are any existing MP annotations that could be supported on Exception Mappers to improve support? Note: I'm not against inventing new annotations in the spec to cover this use case if it's useful to do so. Which is why I marked this as a discussion topic for the next hangout. |
Nothing jumps out at me beyond the @APIResponses(
exceptionMappers = { My404Mapper.class, My500Mapper.class },
value = { @APIResponse(responseStatus = "200", ...) }) I'm not sure it would be necessary in this case if the It might also be interesting to allow an application to define their own annotation (similar to a CDI |
Yeah that's interesting. Well, I think we can discuss this in more depth at the next hangout. Additionally, I'm hoping that @FreifeldRoyi will give the new SmallRye impl functionality a try. There is currently a PR here: smallrye/smallrye-open-api#227 Once merged, there will be some support for processing exception mappers and it would be great to get some feedback on it. |
I'll take a look |
We discussed this in the most recent spec hangout, and it was decided that we'll likely do the following two things:
|
I'll be taking a swing at this work at some point. :) |
I'm glad my proposal will be added to the spec 😁 |
Hi
When adding annotations to all the endpoints I expose, it gets really cumbersome to copy response annotations that are defined in ExceptionMapper classes
I thought it would be better to annotate the ExceptionMapper definition and propagate it to all endpoints automatically
The text was updated successfully, but these errors were encountered: