A Sphinx extension for automatically documenting GraphQL schemas.
The following steps will walk through how to add autogqlschema
to an existing Sphinx project.
For instructions on how to set up a Sphinx project,
see Sphinx's documentation on
Getting Started.
autogqlschema
can be installed through pip:
pip install autogqlschema
Next, add autogqlschema
to the extensions
list in your Sphinx project's conf.py.
extensions.append("autogqlschema")
Schema documentation is generated from GraphQL schema files using the autogqlschema
directive.
In the following example, documentation is generated from ths file structure.
myrepo
├── doc
│ ├── conf.py
│ └── index.rst
└── src
└── mypackage
├── schema
│ ├── __init__.py
│ ├── 01_schema.graphql
│ └── 02_books.graphql
└── __init__.py
This schema can be generated with the following reStructuredText:
.. autogqlschema::
:root-dir: ../src/mypackage/schema
:source-files: *.graphql
Or:
.. autogqlschema::
:root-dir: ../src/mypackage/schema
:source-files: 01_schema.graphql, 02_books.graphql
For more detailed usage, see the documentation: https://autogqlschema.readthedocs.io/en/latest/
Tests are executed through tox.
tox
Code is formatted using black.
You can check your formatting using black's check mode:
tox -e format
You can also get black to format your changes for you:
tox -e format -- src/ tests/
Release notes are managed through towncrier. When making a pull request you will need to create a news fragment to document your change:
tox -e release_notes -- create --help
We use SemVer for versioning. For the versions available, see the tags on this repository.
This project is licensed under the MIT License. See the LICENSE.rst file for details.