teamwalnut / graphql-ppx

GraphQL language primitives for ReScript/ReasonML written in ReasonML
https://graphql-ppx.com
MIT License
257 stars 53 forks source link

__typename on unions not working #269

Open amiralies opened 3 years ago

amiralies commented 3 years ago

testing master with a sdl schema, looks like i can get __typename on unions.

schema {
  query: Queries
}

type Queries {
  getUsers: [User!]!
}

type User {
  id: String!
  role: Role!
}

union Role = Admin | Member

type Admin {
  y: Int!
}

type Member {
  x: Int!
}

query:

query { 
  getUsers {
    role {
      ... on Member {
        __typename
        x
      }

      ... on Admin {
        y
      }
    }
  }
}
jfrolich commented 3 years ago

Ah hmm that is probably some implicit type that I forgot to include, thanks for catching it!