-
Notifications
You must be signed in to change notification settings - Fork 89
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
Fix for #376 #377
Fix for #376 #377
Conversation
@tkalmar Thanks for this. I think something went wrong with you PR, it shows 300+ file changes ? |
6980c39
to
e8c3f7f
Compare
@phillip-kruger reformat the PR so only the new files are actualy new ... now it even builds |
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 think this code should ultimately be in the ParameterProcessor
where more context is known about the parameter. I noted that this approach may not work well outside of the basic situation where the only arguments to the resource method are non-form @*Param
types.
We already have #267 dealing with @Extension
, so perhaps this could be updated as well when that issue is fixed.
final MethodParameterInfo methodParameterInfo = annotation.target().asMethodParameter(); | ||
final short paramPosition = methodParameterInfo.position(); | ||
operation.getParameters().get(paramPosition).addExtension(name, value); |
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 don't think this approach is going to work outside of the basic scenario. I.e., the position in the operation's parameters may not always be the same as the position in the method parameters. Think of the case where @BeanParam
is used or where parameters are injected into the resource class itself rather than as method arguments.
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.
@MikeEdgar - Any suggestion on how @tkalmar can change the PR so that this will work better ?
@tkalmar , @phillip-kruger - I think a good approach would look something like this. I haven't tested this out :-)
List<AnnotationInstance> extensionAnnotations = ExtensionReader.getExtensionsAnnotations(context.target);
if (param.getExtensions() == null && !extensionAnnotations.isEmpty()) {
param.setExtensions(ExtensionReader.readExtensions(this.scannerContext, extensionAnnotations));
} |
Dismissing earlier approval in favor of the changes detailed above.
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.
See earlier comments regarding changes in the ParameterProcessor
@phillip-kruger @MikeEdgar Thanks for the help, i extended the test to include one @BeanParam and it broke as expected. With the suggested changes it was a piece of cake to do the required changes. Test works now and is better than my first draft. Thanks a lot. |
b0fac5c
to
d656d17
Compare
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.
Looks good, thanks @tkalmar. Any concerns @phillip-kruger ?
Should this be backported at the 1.x branch to get it faster into quarkus or are there plans to switch quarkus to the 2.x branch in the near future? |
Quarkus is on 2.x starting 1.6. we can try and get it in a.s.a.p. no need to backport. |
this is a first try at fixing #376