playlyfe / go-graphql

A powerful GraphQL server implementation for Golang
248 stars 20 forks source link

Hide __typename field #20

Closed maksimkurb closed 7 years ago

maksimkurb commented 7 years ago

I have noticed that every object has __typename field in GraphiQL documentation 2017-01-05 15-48-01

I think this field is not supposed to be visible, confirm me if I wrong

kumarharsh commented 7 years ago

There are situations when __typename is very useful, such as when working with union types, where it's hard to tell which type of data we'll be getting back.

Some more information about the usefulness of this field are mentioned in the official documentation here: http://graphql.org/learn/queries/#meta-fields

maksimkurb commented 7 years ago

Anyway, my PR only hides this field from introspection query, so it not displayed in graphiql IDE but it can be queried

05.01.2017 22:58 пользователь "Kumar Harsh" notifications@github.com написал:

There are situations when __typename is very useful, such as when working with union types, where it's hard to tell which type of data we'll be getting back.

Some more information about the usefulness of this field are mentioned in the official documentation here: http://graphql.org/learn/ queries/#meta-fields

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/playlyfe/go-graphql/issues/20#issuecomment-270726806, or mute the thread https://github.com/notifications/unsubscribe-auth/ABSg9CBpqafb9NUPYlTILX_po232-fJ2ks5rPT0-gaJpZM4LbnPT .