记录GraphQL API [英] Document a GraphQL API

查看:126
本文介绍了记录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模式动态生成的文档资源管理器.它旨在提供比GraphiQL更好的模式概述,但不查询功能.

Dynamically generated documentation explorer for GraphQL schemas. It aims to provide a better overview of a schema than GraphiQL, but without querying features.

您还可以基于架构文件或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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆