记录 GraphQL API [英] Document a GraphQL API
问题描述
借助 REST,我们可以使用 Swagger、RAML 或其他技术来记录我们的 API,并生成我们的消费者无需与服务器交互即可阅读的 HTML 文档.
GraphQL 是否存在类似的东西?有没有办法生成资源和属性的文档?
看起来现在有
您还可以基于架构文件或 GraphQL 端点生成静态文档文件:
npm install -g graphql-docsgraphql-docs-gen http://GRAPHQL_ENDPOINT documentation.html
With REST we can use Swagger, RAML or other technologies to document our API and generate an HTML documentation that our consumers can read without any need of interaction with the servers.
Does something similar exist for GraphQL? Is there any way to generate a documentation of resources and properties?
It looks like there is now https://www.npmjs.com/package/graphql-docs
Dynamically generated documentation explorer for GraphQL schemas. It aims to provide a better overview of a schema than GraphiQL, but without querying features.
You can also generate a static documentation file based on a schema file or GraphQL endpoint:
npm install -g graphql-docs
graphql-docs-gen http://GRAPHQL_ENDPOINT documentation.html
这篇关于记录 GraphQL API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!