Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get list of all types from graphql schema?

On client I get schema by introspectSchema.

In my app I want to get list of all types which we have in schema, but parse existing object is very hard task.

Is there some good way to do it?

like image 716
Alexander Knyazev Avatar asked Oct 14 '25 08:10

Alexander Knyazev


1 Answers

GraphQL has powerful introspection capabilities built in. To get the names of the types in your schema you can run this GraphQL query:

{
  __schema {
    types {
      name
    }
  }
}

You can read more about introspection in GraphQL here:

https://graphql.org/learn/introspection/

like image 86
Benjie Avatar answered Oct 17 '25 01:10

Benjie



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!