Search code examples
permissionsgraphqldocumentationgraphiql

Entering custom data into GraphiQL Docs


I would like to use GraphiQL docs to document my GraphQL API. The out-of-the-box version already looks pretty useful, however I would like to enrich it by the information about permissions.

My imagination is that in this

enter image description here

there will be another section, i.e. "Permissions", with some description of the permissions.

My question: is this the way to do it? If not, how can one express permissions in the GraphiQL Docs? And if this could be the way, is there any tool capable of doing this?


Solution

  • What's shown in GraphiQL (or similar tools like GraphQL Playground, Altair, etc.) is limited to what can be returned through introspection of the schema, which is limited by what the spec specifies. You can add descriptions to types, fields, arguments, enum values and directives. A description for the schema itself is in the works.

    At best, you could add a description to your field specifying the permissions. You can use markdown if you want to jazz it up.