本文介绍了记录GraphQL API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

借助REST,我们可以使用Swagger,RAML或其他技术来记录我们的API,并生成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.

GraphQL是否存在类似的东西?有什么方法可以生成资源和属性的文档?

Does something similar exist for GraphQL? Is there any way to generate a documentation of resources and properties?

推荐答案

似乎现在有 https://www.npmjs.com/package/graphql-docs

您还可以基于架构文件或GraphQL端点生成静态文档文件:

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-28 03:29