-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Support more than one custom annotation which registers MP REST Client provider #14141
Comments
/cc @phillip-kruger |
Hello, I am willing to give it a shot, but I will need some guidance in order to complete the task quickly and efficiently. |
@VasilisAndritsoudis Great, thanks. Please take your time, it does not need to be completed asap.
So I suppose the |
@sberyozkin Great! I will start working first on implementing it with a list (or set), and when I am ready with that I will need some more info on how to proceed with testing. |
@sberyozkin Last question. Do I need to be assigned to this issue or can I continue without? |
@VasilisAndritsoudis I assigned it to you :) |
Cool, thanks @geoand |
YW! |
Hum, I had a quick look into the current code and I couldn't find anything that validates if a custom annotation is applied to a valid provider. In the case of If the validation is in some obscure place, disregard this comment :) |
@radcortez Hey Roberto, what do you mean ? It is just a shortcut to |
Yes, but I guess that RESTEasy will handle that validation then. I'm now wondering if this is done at build time / runtime. |
@radcortez Yes - so I'd just let RestEasy do it too in this case - it will just ignore an object if it is not one of the recognized providers - but we can also easily do a pre-check for a few interfaces like |
I have a few questions:
From the looks of it I will need some guidance in order to complete this task. If you need someone more qualified you can tell me and I can release this assignment. |
@VasilisAndritsoudis No problems - take your time - have a look around for more docs, examples, etc. re your 2nd point you just need to create an Eclipse or IntelliJ workspace and start applying the proposed changes. Take a week or so to find your way around and ping us later on. Please review the linked to docs and this task description - what is proposed here (and already partially implemented) is not documented yet Thanks, Sergey |
@sberyozkin I am glad to hear that. In the following days I will try my best to get a grip on the project and then I can more freely proceed with the requested task. Have a great day, |
I guess it takes times for the doc to be updated on quarkus.io but you have now exemples to register a provider in the doc. I guess the idea now is to create a fake extension with a new custom annotation to register a provider, and then test that rest client with more than one custom annotation, say your dummy annotation and the oidc client's one is correctly configured. |
Yeah something like that though I guess it might simpler not to involve the OIDC code into it at this stage; thanks. Perhaps a single test extension which would support 2 annotations. |
@sberyozkin Anyway I am gonna show you my proposed changes before I make a PR: First of all I have changed the RestCliendBase constructor to accent an array list of annotation classes like so:
I then changed the method configureProviders so it works with an array of providers like so:
I then worked on RestClientProcessor where the processInterfaces accept an array list of RestClientAnnotationProviderBuildItem like so:
Finally I tweaked the code inside the register function to work with an array list of providers like so:
I believe this is what you suggested I did and I have done my best to deliver. Since I am very new to the project I do not have the background knowledge to know if my proposed changes are at all correct, so I worked based on my general understanding of how it should work. Thanks, |
Hi @VasilisAndritsoudis sorry for a delay, I'm Yes, that sounds good, only replace We now have another issue #14466 which depends on this fix. Thanks |
@VasilisAndritsoudis I think you should also update
to be a multi build item
to fix #14466. Give it a try please to the PR in the next few days so that we can try/test it early next week - don't worry about the tests for now :-), we'll push the tests to your branch once the fix is verified |
@sberyozkin Alright, to whom should I make the PR and on what branch? |
@VasilisAndritsoudis one needs to fork the Quarkus repository, create a branch, and open a PR from that branch. Please also check https://github.com/quarkusio/quarkus/blob/master/CONTRIBUTING.md |
Description
Now that the OIDC client PR has been merged, it is possible to register the providers with MP RestClient or even JAX-RS clients like this:
where
@A
is an extension specific annotation which indirectly registers some provider with the client.But the following is not possible yet:
where more than one provider is registered indirectly via the custom annotations.
Implementation ideas
It should be simple enough:
RestClientBase
inquarkus-rest-client
accepts, via the build step, a single provider found through a custom annotation like@A
. It just needs to be updated to accept a List/Set.Perhaps a test extension may also need to be introduced which would register
@A
and@B
associated providersThe text was updated successfully, but these errors were encountered: