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

问题描述

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

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.

我不确定这是规范还是工具-例如,阿波罗允许我编写 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 规范不包含说明. __ 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:26