-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Handle default values of @Consumes and @Produces #15654
Conversation
String[] originalStrings; | ||
AnnotationValue value = annotation.value(); | ||
if (value == null) { | ||
originalStrings = new String[] { MediaType.WILDCARD }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we want JSON by default if around? Won't this change defeat that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I'm not sure what the semantics should be if the user specifies a @Produces
with no value. Spec says wildcard. I say it's useless.
Perhaps we should just treat this as if the annotation was not there?
Or perhaps it's useful to override a class-level @Produces(text)
annotation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I say that if it's thereς with no default value we keep the spec behavior.
It's pretty stupid, but it the user set it explicitly, the maybe they know what they are doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's one way to look at it. Another would be that if it's original purpose was to override the class annotation back to its "default" behaviour, we should make this match our own "default" and consider this as having no value and not looking at the class annotation.
But frankly this is so edge-case that I doubt it's worth it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, works for me if it's only when you have empty annotations.
Will we have the same issue for |
The change I made applies for both |
Fixes: #15638
P.S. I wasn't able to reproduce the first problem mentioned in the issue.