graphql-ppx icon indicating copy to clipboard operation
graphql-ppx copied to clipboard

__typename on unions not working

Open amiralies opened this issue 2 years ago • 1 comments

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
      }
    }
  }
}

amiralies avatar Sep 07 '21 00:09 amiralies

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

jfrolich avatar Sep 07 '21 01:09 jfrolich