问题
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