-
Notifications
You must be signed in to change notification settings - Fork 90
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
Keep a reference to the Java method parameter for later use in OASFilter #1076
Keep a reference to the Java method parameter for later use in OASFilter #1076
Conversation
Thanks for the PR. I know this is still a work-in-progress, but just to mention it so you're aware - parameter handling can be a bit more complex than operation handling. There are some cases where parameters are derived without annotations whatsoever, and also cases where multiple annotations are set in different locations. For example an |
@MikeEdgar would all other information not be available already on the Parameter (Impl) created. This is just a way to link back to a certain parameter in Quarkus... I think this should work (at least for now) @renegrob did you use this version in Quarkus to see if this works ? |
I think it will only work when there is a |
Ok I thought we still create a parameter in the model in those cases ? |
Thanks for the comments. Yes, indeed I need to test those cases. So far I couldn't find any cases where |
@renegrob , the test |
That's right, but that model is populated with information from (potentially) multiple sources depending on where the annotations are placed. |
73b0834
to
8ef59ca
Compare
@renegrob @MikeEdgar - is this ready for merge ? |
…ching in OASFilters.
8ef59ca
to
06ebe75
Compare
@phillip-kruger just rebased. I'll give this another look in my morning to double check all the necessary places are covered. |
Thanks @MikeEdgar ! |
Sorry, I was busy with another issue. I was able to filter parameters in my extension. I didn't test all cases but I think some of them are not even valid for Quarkus - or at least not for resteasy-reactive or for resteasy-classic with Singleton beans. |
@MikeEdgar please merge when you are happy :) |
@renegrob , do you have any requirement that the annotation used for the methodRef is the OpenAPI annotation versus the "framework" annotation? For example, in resource method below, do you expect the methodRef to be the @Path("/")
class HelloResource {
@GET
@Parameter(name = "name", description = "The user's name")
@Produces("text/plain")
public String sayHello(@QueryParam("name") String name)) {
return "Hello " + name;
}
} |
@MikeEdgar My goal is to write a OASFilter that can associate the @Path("/")
class HelloResource {
@GET
@Parameter(name = "name", description = "The user's name")
@Produces("text/plain")
public String sayHello(@MyAnnotation("whatever") @QueryParam("name") String name)) {
return "Hello " + name;
}
} |
Yes, that helps, thank you. So I think the answer is that you want methodRef to be generated from the |
Yes, it was used in a private project. I don't know if it is still in use, since I left that project. But I'm sure it can be changed the same way as Quarkus' |
Correct, for now until Quarkus updates to use the callback added in #2020 . I suppose we could add a |
While
OperationImpl
has amethodRef
property that can be used to match the method (as done in QuarkusAutoRolesAllowedFilter
,AutoTagFilter
etc.),ParameterImpl
does not contain any information about the parameter's name or position. This PR introduces aparamRef
forParameter
similar tomethodRef
.