最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How can I get list of all types from graphql schema? - Stack Overflow

programmeradmin2浏览0评论

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?

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?

Share Improve this question asked Aug 30, 2018 at 14:48 Alexander KnyazevAlexander Knyazev 2,8924 gold badges18 silver badges27 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 9

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/learn/introspection/

发布评论

评论列表(0)

  1. 暂无评论