从graphql endpoint获取schema文件
Posted fuyaozhishang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从graphql endpoint获取schema文件相关的知识,希望对你有一定的参考价值。
graphql server端有更新,client端需要重新获取schema文件用于创建新的api request,下面简要记录如何从graphql endpoint获取schema文件
You can simply install the CLI using npm
or yarn
by running the following command. This will add the graphql
(and shorter gql
) binary to your path.
npm install -g graphql-cli
Then, you can type [command] just like bellow to create a file named .graphqlconfig
Now , you can get schema
Ops! Now specific headers is needed. We open .graphqlconfig file to edit it.
Pay attention to edit this file, since it‘s very important to the result.
OK, now we can get the damn schema.json by
graphql get-schema --output="schema.json"
Done. Now I can go to bed and have a good sleep.
Happy Mid-Autumn Festival !
以上是关于从graphql endpoint获取schema文件的主要内容,如果未能解决你的问题,请参考以下文章
有没有办法为两个或多个 GraphQL 服务生成聚合的 schema.json?
从 Schema 和 Schema 从 GUI 生成 GraphQL GUI
无法从模式拼接中的另一个 schema.graphql 文件中的其他 schema.graphql 文件访问共享模式
如何使用 SQLAlchemy 从 graphQL 获取已编译的原始 sql?