autogqlschema

This extension provides a Sphinx directive for generating documentation for GraphQL schemas.

In order to use this extension, add autogqlschema to the extensions list in your conf.py file.

extensions = ["autogqlschema"]

Note

autogqlschema makes use of the MyST-Parser extension to parse the CommonMark formatted docstring of your GraphQL schema. Furthermore, autogqlschema makes use of the fieldlist extension to MyST to render the argument field lists used by graphqldomain. autogqlschema will enable all of this for you if your conf.py file has not enabled it already.

Directives

.. autogqlschema:: name

Generates API documentation for a GraphQL schema that’s declared in the given set of files.

The name argument is an arbitrary identifier given to the schema for use by Sphinx in cross-references and URLs to this schema. This can be useful for documenting multiple schemas in the same documentation, but isn’t necessary when documenting a single schema. Defaults to __gqlschema__.

Options

:debug:

When given, the generated API documentation will be written to a reStructuredText file in Sphinx’s output directory. The file will have the same name as the schema, with an .rst extension.

:root-dir:

Default: The directory that contains Sphinx’s conf.py file.

Defines the location that the source-files are relative to. This can be an absolute or relative path. A relative path will be taken relative to the directory that contains Sphinx’s conf.py file.

:source-files:

This required option should contain a comma separated list of file names and/or glob patterns for the files that contain the GraphQL schema to be documented. Relative paths are taken relative to root-dir.

For example:

.. autogqlschema::
   :root-dir: ../src/mypackage/schema
   :source-files: *.graphql