hasura / graphql-engine

Blazing fast, instant realtime GraphQL APIs on your DB with fine grained access control, also trigger webhooks on database events.
https://hasura.io
Apache License 2.0
31.13k stars 2.76k forks source link

graphiql-explorer, union types dont show type structure #3101

Open nurdism opened 5 years ago

nurdism commented 5 years ago

This is an issue with graphiql-explorer but I'm not familiar with the current implementation of it so I thought I'd leave a report here. (This is for remote schemas)

an example

union UserResult = User | GenericError | IsSuspended

type User {
  id ID!
}

type GenericError {
  type: String!
  message: String!
  field: String
}

type IsSuspended {
  message: String!
}

type Query {
  current_user: UserResult!
}

in the graphiql-explorer when you select the Query current_user it will give you the list in the union, User will select and you can see the User object structure, but if you try IsSuspended and GenericError it will not show you the object structure. I'm assuming its due to sharing message key.

rikinsk commented 5 years ago

Just tried this out. Doesn't seem to be due to the duplicate field. It seems like there is an issue with how explorer is dealing with nullable and non-nullable fields. This works if I set message as just String.

Have raised an issue about this at https://github.com/OneGraph/graphiql-explorer/issues/26 as we don't maintain the explorer