graphql-java-kickstart/graphql-spring-webclient

support interface retrieve

conanchen opened this issue · 1 comments

Is your feature request related to a problem? Please describe.
How to retrieve "Node" with graphqlWebClient?
I am trying to access Node with an ID :

  1. graphqlWebClient.post(query, Node.class)
  2. Node.java
public interface Node {
    String getGraphQlTypeName();

    ID getId();
}

but got error message:
Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of xxx.graphql.generated.Node(no Creators, like default construct, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information

This library relies on Jackson for deserialization as the error message you've pasted here indicates. Node needs to be a class compatible with Jackson and not an interface like it is now. Try Googling how to use Jackson and the error message itself to find more information how Jackson works.