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

Support @Encoded for query parameters in REST Client Reactive #23961

Closed
michalszynkiewicz opened this issue Feb 25, 2022 · 7 comments · Fixed by #33672
Closed

Support @Encoded for query parameters in REST Client Reactive #23961

michalszynkiewicz opened this issue Feb 25, 2022 · 7 comments · Fixed by #33672
Labels
Milestone

Comments

@michalszynkiewicz
Copy link
Member

michalszynkiewicz commented Feb 25, 2022

Description

From GitHub discussion:

Hello,

I am following this guide https://quarkus.io/guides/rest-client to communicate with a 3rd party API. Overall everything works but there is a small issue I am running with query param.

I am able to set up query param as described in the tutorial. However, I am not able to use the Encoded string as a query param.

For example

I have this endpoint

   @Path("/device")
   @GET
   fun deviceSelect(@QueryParam("\$select")  selectQuery: String): ListOf<DeviceMeta>

Also, the third-party follows the odata conventions.

Now when I pass in a single field into this method, everything works, I get a list with that field.

However, when I put in multiple fields, so something like deviceSelect("name,id"), I run into malformed URL. Basically, the other endpoint is expecting the actual , but our endpoint is passing it with % encoded.

i.e valid: /device?$select=name,id
whats generated: /device?%24select=name%2Cid

I know the third-party API is supposed to handle the encoded inputs but I need a solution while they fix that.

I tried annotating the param, method, and class with @encoded but had no luck...

Implementation ideas

No response

@michalszynkiewicz michalszynkiewicz added the kind/enhancement New feature or request label Feb 25, 2022
@michalszynkiewicz
Copy link
Member Author

CC @sraturi

@michalszynkiewicz
Copy link
Member Author

I checked that this is doable. OTOH, it may be unsafe in some circumstances, I think.

@geoand @radcortez what do you guys think of supporting @Encoded in the client?

@geoand
Copy link
Contributor

geoand commented Mar 4, 2022

The alternative being that the user needs to setup the proper string manually?

@michalszynkiewicz
Copy link
Member Author

michalszynkiewicz commented Mar 4, 2022

IIUC, curerntly @sraturi is not able to send query params he needs with the client. OTOH, as he points out himself, the server he contacts should support encoded params (it doesn't and that's the problem he's trying to work around).

@geoand
Copy link
Contributor

geoand commented Mar 4, 2022

Yeah, I'm not so sure doing this on the client is correct way to go...

@bboyz269
Copy link

bboyz269 commented Oct 6, 2022

We really don't have any saying in 3rd party service implementations ...
Is there any possible point we can intercept to work around?

@geoand
Copy link
Contributor

geoand commented Oct 6, 2022

Not really

Sgitario added a commit to Sgitario/quarkus that referenced this issue May 29, 2023
These changes add support for the `@Encoded` annotation for PATH and QUERY params. 

As stated in the Encoded annotation javadocs, we can use this annotation at class and method level too, so we can use it in REST Client reactive like this. 

Fix quarkusio#23961
Sgitario added a commit to Sgitario/quarkus that referenced this issue May 29, 2023
These changes add support for the `@Encoded` annotation for PATH and QUERY params. 

As stated in the Encoded annotation javadocs, we can use this annotation at class and method level too, so we can use it in REST Client reactive like this. 

Fix quarkusio#23961
@quarkus-bot quarkus-bot bot added this to the 3.2 - main milestone May 30, 2023
sberyozkin pushed a commit to sberyozkin/quarkus that referenced this issue Jun 21, 2023
These changes add support for the `@Encoded` annotation for PATH and QUERY params. 

As stated in the Encoded annotation javadocs, we can use this annotation at class and method level too, so we can use it in REST Client reactive like this. 

Fix quarkusio#23961
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants