GraphiQL powered GraphQL playground renderer for Sphinx.
- GraphiQL is the reference implementation of this monorepo, GraphQL IDE, an official project under the GraphQL Foundation. The code uses the permissive MIT license.
- It provides a simple GraphiQL IDE to try (execute) GraphQL APIs on the go.
-
Install the python package in your virtual environment by running following command:
pip install git+https://github.com/TirthS24/graphiql_sphinx -
Include
graphiql_sphinxin extensions in docs/conf.py file. -
Create a .rst file with with name
<file_name>havinggraphiqldirective and with following parameters:endpoint: GraphQL API Endpoint (Will be hit everytime a query is executed)query: Initial Sample Query to be included in the IDE.response: Initial Sample Response to be included in the IDE.headers: Authorization headers to authenticate endpoint to execute queries.
Consider the following code example for creating .rst file:
GraphQL API DOCUMENTATION ========================= .. graphiql:: :endpoint: <your_graphql_api_endpoint> :headers: {"Content-Type": "application/json", "Authorization": "Bearer <your_JWT_token>" "api-key": <your_api_key>} -
Include
<file_name>in the index.rst file to navigate through REST API documentation. -
Run the following command in docs directory:
make html
Installs following libraries:
- fett
- graphql-core
- sphinx

