mhallin / graphql_ppx

GraphQL PPX rewriter for Bucklescript/ReasonML
BSD 3-Clause "New" or "Revised" License
320 stars 42 forks source link

bsRecord on inline fragment #60

Closed tmattio closed 6 years ago

tmattio commented 6 years ago

Hi,

I am trying to write a query containing union types. I first wrote a separated fragment and got a clear message: only inline fragments are supported with union types. So I wrote my query like this:

module Search = [%graphql
  {|
    query Search($query: String!, $searchType: SearchType!) {
      search(first: 10, query: $query, searchType: $searchType) @bsRecord {
        edges @bsRecord {
          node {
            ... on Dataset @bsRecord {
              id
              dataType
            }
          }
        }
      }
    }
  |}
];

But the bsRecord on the ... on Dataset @bsRecord does not work: the fragment is parsed as an object instead of a record. Is this a bug or am I doing something wrong?

Thanks :)

anmonteiro commented 6 years ago

Don't you also need @bsRecord on node?

tmattio commented 6 years ago

Adding or removing @bsRecord from node does not change the parsing either.

mhallin commented 6 years ago

This is a bug in the current limitation, thanks for reporting this.

mhallin commented 6 years ago

Fixed in 0.2.8.

tmattio commented 6 years ago

Hi @mhallin! The bug seems to be fixed in 0.2.8 for union types, but I still have the bug for interfaces :/