Documentation at the top level of a GraphQL schema

℡╲_俬逩灬. 提交于 2021-01-28 19:20:57

问题


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.

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.

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?


回答1:


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.

It is, however, an upcoming feature.



来源:https://stackoverflow.com/questions/56744133/documentation-at-the-top-level-of-a-graphql-schema

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!