graphql-java-generator / graphql-maven-plugin-project

graphql-maven-plugin is a Maven Plugin for GraphQL, based on graphql-java. It accelerates the development for both the client and the server, by generating the Java code. It allows a quicker development when in contract-first approach, by avoiding to code the boilerplate code.
https://graphql-maven-plugin-project.graphql-java-generator.com
MIT License
118 stars 47 forks source link

v1.18.9 does not properly handle introspection query from graphql-java 19.2 #173

Closed gjvoosten closed 1 year ago

gjvoosten commented 1 year ago

When using the standard introspection query from graphql-java: https://github.com/graphql-java/graphql-java/blob/v19.2/src/main/java/graphql/introspection/IntrospectionQuery.java#L8 I get a stacktrace:

 com.graphql_java_generator.exception.GraphQLRequestPreparationException: [Internal error] The field 'args' is lacking the GraphQLInputParameters annotation
     at app//com.graphql_java_generator.client.request.InputParameter.parseInputParameterValue(InputParameter.java:582)
     at app//com.graphql_java_generator.client.request.InputParameter.readTokenizerForInputParameters(InputParameter.java:548)
     at app//com.graphql_java_generator.client.request.QueryField.readTokenizerForResponseDefinition(QueryField.java:183)
     at app//com.graphql_java_generator.client.request.QueryField.readTokenizerForResponseDefinition(QueryField.java:209)
     at app//com.graphql_java_generator.client.request.QueryField.readTokenizerForResponseDefinition(QueryField.java:209)
     at app//com.graphql_java_generator.client.request.AbstractGraphQLRequest.<init>(AbstractGraphQLRequest.java:265)
     at app//com.graphql_java_generator.client.request.ObjectResponse.<init>(ObjectResponse.java:29)
     […]
etienne-sf commented 1 year ago

Hello,

I have integration that test that. Can you show here the request you use ?

From the error stacktrace, your query contains an 'args' parameter, for witch you don't provide a value at execution time.

Etienne

gjvoosten commented 1 year ago

Not sure I understand your question. The only aspect in which the standard introspection query from graphql-java has changed between v18.3 and v.19.2 is:

diff --git a/src/main/java/graphql/introspection/IntrospectionQuery.java b/src/main/java/graphql/introspection/IntrospectionQuery.java
index a2a9b179..f9361795 100644
--- a/src/main/java/graphql/introspection/IntrospectionQuery.java
+++ b/src/main/java/graphql/introspection/IntrospectionQuery.java
@@ -18,7 +18,7 @@ public interface IntrospectionQuery {
             "        name\n" +
             "        description\n" +
             "        locations\n" +
-            "        args {\n" +
+            "        args(includeDeprecated: true) {\n" +
             "          ...InputValue\n" +
             "        }\n" +
             "        isRepeatable\n" +
@@ -33,7 +33,7 @@ public interface IntrospectionQuery {
             "    fields(includeDeprecated: true) {\n" +
             "      name\n" +
             "      description\n" +
-            "      args {\n" +
+            "      args(includeDeprecated: true) {\n" +
             "        ...InputValue\n" +
             "      }\n" +
             "      type {\n" +

which appears to be exactly what the error is about. What should I be doing differently, other than trying to send this introspection query through graphql-java-generator to my server?

[Please note: I can actually send this query to my server and receive a full response, e.g. with GraphiQL; it's just graphql-java-generator that complains about it.]

etienne-sf commented 1 year ago

Ok, understood. I answered to quickly, just based on the error message.

I added an IT test to check that.

etienne-sf commented 1 year ago

Released in the 1.18.10 version

gjvoosten commented 1 year ago

I can confirm that this issue is indeed solved with release 1.18.10; thanks @etienne-sf !