americanexpress / nodes

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

Facing issues while querying an API with certain fields but getting an array in response. #91

Closed debdiptahalder-4tigo closed 5 years ago

debdiptahalder-4tigo commented 5 years ago

Hi I am trying to query an API which is of the following format. query{ requestallstudentdata{ id name hobby } } In response we get something like following: `{ "data": { "requestallstudentdata": [ { "id": 1, "name":"xyz", "hobby":"fxdu"

  },
  {
  "id": 2,
    "name":"xYz",
    "hobby":"fdu"
  }
]

} }`

How to handle such requests.Please assist. Currently I have the following classes.

I am getting the following response whenever I am trying to send a list.

GraphQLException{message='OK', status='200', description='Can not deserialize instance of com.graphql.model.foo.StudentDetails out of START_ARRAY token
 at [Source: N/A; line: -1, column: -1] (through reference chain: io.aexp.nodes.graphql.Wrapper["data"])', errors=null}
chemdrew commented 5 years ago

ah yeah, querying lists isn't super clear. The same solution in #26 should work here as well.

debdiptahalder-4tigo commented 5 years ago

Hi, Thanks for your reply. I am a bit confused on what to send in the arguments. I want fetch the list of all the students instead of giving any specific arguments. It will be really helpful if you can guide me a bit with this. I do have any arguments to send for querying.

Thanks and Regards, Debdipta Halder

On Tue, 3 Sep, 2019, 9:59 PM Andrew Pratt, notifications@github.com wrote:

Closed #91 https://github.com/americanexpress/nodes/issues/91.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/americanexpress/nodes/issues/91?email_source=notifications&email_token=AMNJWPXGITYXTNL6KEHJLYDQH2GH3A5CNFSM4ITHS7W2YY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOTM4SW2Y#event-2604215147, or mute the thread https://github.com/notifications/unsubscribe-auth/AMNJWPUBHGRFDT7TPRQ3U5TQH2GH3ANCNFSM4ITHS7WQ .

tkosik12 commented 2 years ago

@debdiptahalder-4tigo could you tell me what was the solution? If you found it of course.