-
Notifications
You must be signed in to change notification settings - Fork 93
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
Using header as an API method parameter produces "Missing name information for parameter" error #1847
Comments
It's exactly what the exception says - you have to compile your application with the
This annotation can only be applied on a method (then only that operation will use the header) or class (then all operations in that API will use it).
I think that |
@jmartisk hi, thanks for your answers. the 2nd answer on @AuthorizationHeader is fully addressed and clear. Regarding the @name annotation, can you elaborate a bit more and give additional insight, such as:
for information: I used @name from "org.eclipse.microprofile.graphql" package and the only place I was allowed to put it was my wrapper-function of GraphQLClient.java class as shown below: @Inject
IGraphQLClientAPI graphQlClient;
public List<EcoComponent> listComponents(@Name("versionName") String versionName) {
String accessToken = sessionManager.getProperty("accessToken");
List<EcoComponent> result = graphQlClient.listComponents(versionName, accessToken).ecoComponentList().stream()
.filter(comp -> comp.versions() != null && comp.versions().size()>0 )
.filter(comp -> comp.versions().stream()
.anyMatch(ver -> ver.name() == versionName)
)
.collect(Collectors.toList());
return result;
} this way it works, and I've moved further, but I still want to understand the reason why function parameters naming and ordering doesn't simply work in the declared method: @GraphQLClientApi(configKey = "appsync")
public interface IGraphQLClientAPI {
EcoComponentsList listComponents(String version, @Header(name = "Authorization") String accessToken);
} |
You'll need to put
The annotation on the In any case, the safest and recommended way forward would be to use |
@jmartisk hi, the example with @name annotation for all parameters as shown in your example above works ok. The code without annotation for @Header parameter as shown below still produces error: EcoComponentsList listComponents(@Name("version") String version, @Header(name = "Authorization") String accessToken); so I suppose, it has to be fixed. for your information I am using: Thank you very much for your answers. I am unblocked now. It would be also great to add this information on both headers usage (with examples) into the project's documentation page mentioned in my post. |
I'll try to add a little fix that will let you use a |
Hmm, hold on, what version of SmallRye GraphQL are you using? |
I see, you're using Quarkus 2.16.6, then I'm really surprised that you're not using the
|
Hi, by steps:
So actually the initial problem can be considered as fixed.
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-graphql-client</artifactId>
</dependency>
+- io.smallrye:smallrye-graphql-client:jar:1.9.5:compile
What is recommended way to update if I replace my pom.xml <dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-graphql-client</artifactId>
<version>2.2.0</version>
</dependency> it breaks my project build if I replace the pom.xml dependency for <dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-graphql-client</artifactId>
<version>3.1.1.Final</version>
</dependency> it also breaks my build with following error:
may be its for quarkus v3+ only... |
I don't think you can separately upgrade the client library version (without nasty hacks that probably wouldn't work anyway), you always get the one that comes with the particular Quarkus version. |
Yes, I agree. Thanks again. I am closing the issue, as my problem is solved and the related understanding is obtained. |
Hi, I am am using GraphQLClientAPI in my Quarkus app to access AWS Appsync service. Particularly, I am setting a request Header as API method parameter as stated here in documentation @ https://smallrye.io/smallrye-graphql/2.2.0/typesafe-client-headers/ as this interface:
and then using this interface in my GraphQLClient.java class like this:
when I run my app I get the following Unknown name / Unknown Source error:
it looks like the second (header) parameter in function graphQlClient.listComponents(versionName, accessToken) is not recognized... What am I doing wrong?
I am receiving "'@AuthorizationHeader' not applicable to parameter" error. How can I apply this type of header in case of dynamic header valuer parametrization?
The text was updated successfully, but these errors were encountered: