Decoding Json/Reading Errors


#1

I have got an graphql query coming back from aws’s appsync service.
This is the json that comes back from the query.

This is what it looks like logged to the console.

This is the query response in apollo-dev-tools:

Issue #1

Trying to log the items values to console by running

produces this error:

/Users/prisc_000/code/REASON/APOLLO/reason-apollo-question/src/Persons.re 69:32-51

  67 ┆ Js.log(response##listPeople);
  68 ┆ let listPeople = response##listPeople;
  69 ┆ let items = response##listPeople##items;
  70 ┆ Js.log(items);
  71 ┆

  This has type:
    option({. "items": option(Js.Array.t(option({. "age": int, "id":
                                                  string, "name": string})))})
  But somewhere wanted:
    Js.t('a)

How do I resolve this type error?

@drejohnson? @Gregoirevda? Anyone?

Thank you!


#2

Solution:

Basically, i had not grocked Some/None variables yet.

Issue closed. Leaving this here for future reference.