americanexpress / nodes

A GraphQL JVM Client - Java, Kotlin, Scala, etc.
Apache License 2.0
307 stars 70 forks source link

How to deserialize a list? #100

Closed jefrajames closed 4 years ago

jefrajames commented 4 years ago

I've tried to run simple GraphQL query returning a list: query { allTeams { name } } Here is the DTO class that I use to build a GraphQLRequestEntity:

@GraphQLProperty(name = "allTeams")
public class AllTeamsQuery {
    String name;
    @GraphQLIgnore
    @GraphQLProperty(name="allTeams")
    List<TeamQuery> allTeams;
    ... getters and setters

The GraphQL query is good and run successfully against the server. However the result is not deserialized properly: _Cannot deserialize instance of io.superherosample.model.AllTeamsQuery out of STARTARRAY token which seems to be a Jackson problem.

I guess ST is wrong in my DTO class. I've tried many options and I'm totally blocked. It would be nice that the documentation provides some examples on how to fetch lists.

chemdrew commented 4 years ago

duplicate of #26

jefrajames commented 4 years ago

Thanks it works! It would help a lot to have an example on how to get a list in the documentation.