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

问题描述

我正在我的架构 (SDL) 中记录我的所有类型、字段和参数,包括顶部的 QueryMutation - 但我无法解决如何为整个架构的顶层添加单个文档.

I'm documenting all my types, fields and parameters in my schema (SDL), including Query and Mutation at the top - but I can't work out how to add a single piece of documentation for the top-level of the whole schema.

我不确定是规范还是工具 - 例如 Apollo 允许我编写 schema { },但不能在其中放置任何内容或在其之前放置文档.

I'm not sure if it's the spec or the tooling - Apollo for example allows me to write schema { }, but not to put anything inside it, or documentation before it.

而且文档中没有它的例子,特别是在 https://graphql.github.io/graphql-spec/June2018/#sec-Descriptions,它显示了一个没有顶级文档字符串的描述良好"的模式.

And there are no examples of it in the docs, particularly at https://graphql.github.io/graphql-spec/June2018/#sec-Descriptions, which shows a "well-described" schema without a top-top-level doc string.

这是规范没有涵盖的内容,还是只是工具?

Is this something the spec doesn't cover, or just the tooling?

推荐答案

与类型不同,SchemaDefinition spec 不包含 Description.__Schema 内省类型也没有 description 字段.因此无法设置或获取整个架构的描述.

Unlike types, the SchemaDefinition spec does not contain a Description. The __Schema introspection type also does not have a description field. So there is no way to set or get a description for the entire schema.

不过,这是一项即将推出的功能.

这篇关于GraphQL 架构顶层的文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 18:25