-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Quarkus REST client fails to process all path variables #20069
Comments
@michalszynkiewicz was this fixed by #20056? |
@geoand nope, this is the old rest client. @radcortez do you by any chance have some time to fix this? |
Yes, I'll have a look. |
1 - @dhoffer You can't ignore the annotation, because we don't know the parameter type. It can be a path, query, header, etc., so you still need to annotate the parameter to state the type. Using @michalszynkiewicz We may be able to support the parameter names via a build step, but it is going to require some major rewriting on the builder side. We also need to consider what we want to do with the current builder. Right now, it is a copy of the RESTEasy one, which uses reflection and JDK proxies. Should we rewrite it with a more Quarkus like implementation? 2 - @dhoffer I was not able to replicate it. Can you please provide me a reproducer? |
What I have is working now but something here is very fragile. |
We have RESTEasy Reactive, I don't think such a rewrite is of high priority.
If everything works now, let's close the issue. @dhoffer if you find what was causing the error, please reopen (or create a new issue) with a reproducer. |
@radcortez thanks a lot for investigating this! |
@dhoffer I believe the issue is that you were trying to use the MP REST Client API (and not the reactive one, like your link in the documentation), which is a little bit different and the documentation is here: https://quarkus.io/guides/rest-client. Ideally, both clients should behave in the same way, but it requires some rewrite in the non-reactive version. I guess we will need to align them at some point. |
Yes I was using the MP REST Client API. I thought that is the docs I was using. In any case, the 2 path params could not be parsed with the original code I posted. I see then I was using @BeanParam() MultipartBody for the body and now am just using InputStream w/o any annotations and now it works. No idea why. |
If you can provide me a reproducer for that second case, I can look at it. Thanks! |
Describe the bug
I am creating a REST client programmatically using Quarkus. E.g.
service= RestClientBuilder.newBuilder()
.baseUrl(new URL(URL))
.build(SomeService.class);
It seems there is a problem with it reading path params. Actually two separate problems.
Problem 1:
public interface SomeService {
@path("{currentUserId}/{fileName}")
Response sendFile( String currentUserId,
String fileName,
@BeanParam() MultipartBody body);
}
Here it thinks I have no path variables but from the docs my understanding is that if my variable name matches the Path annotation name then I don't need to annotate with @PathParam.
Problem 2:
public interface SomeService {
@path("{currentUserId}/{fileName}")
Response sendFile( @PathParam(value = "currentUserId") String currentUserId,
@PathParam(value = "fileName") String fileName,
@BeanParam() MultipartBody body);
}
Here I go ahead and add @PathParam to solve the prior problem but it still fails because the QuarkusRestClientBuilder#verifyInterface method only files one path variable in @path. It only files the last one (fileName)
As a workaround I had to define the two path variables as one variable and then just concatenate them with a / between.
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
No response
Output of
uname -a
orver
No response
Output of
java -version
openjdk 11.0.11 2021-04-20
GraalVM version (if different from Java)
No response
Quarkus version or git rev
I am using 2.1.4.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: