Skip to content
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

Merged
merged 1 commit into from
Mar 12, 2021
Merged

Conversation

geoand
Copy link
Contributor

@geoand geoand commented Mar 12, 2021

Fixes: #15638

P.S. I wasn't able to reproduce the first problem mentioned in the issue.

@geoand geoand requested a review from FroMage March 12, 2021 06:35
String[] originalStrings;
AnnotationValue value = annotation.value();
if (value == null) {
originalStrings = new String[] { MediaType.WILDCARD };
Copy link
Member

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?

Copy link
Member

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?

Copy link
Contributor Author

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?

Copy link
Member

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.

Copy link
Member

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.

@FroMage
Copy link
Member

FroMage commented Mar 12, 2021

Will we have the same issue for @Consumes and its default?

@geoand
Copy link
Contributor Author

geoand commented Mar 12, 2021

Will we have the same issue for @Consumes and its default?

The change I made applies for both

@gsmet gsmet merged commit b4cea41 into quarkusio:master Mar 12, 2021
@quarkus-bot quarkus-bot bot added this to the 1.13 - master milestone Mar 12, 2021
@geoand geoand deleted the #15638 branch March 12, 2021 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resteasy reactive: No proper handling of missing or empty @Produces for Multi results
3 participants