Sphinx JSON Domain¶
I was surprised that this didn’t already exist somewhere when I wanted to describe a JSON document outside of using sphinxcontrib-httpdomain to document one of my APIs. This extension simplifies describing structured JSON documents using a new Sphinx domain.
.. json:object:: Github User
What Github's API thinks a user looks like.
:property string login: the user's login
:property integer id: Github assigned unique user identifier
:property string avatar_url: url to user's selected avatar image
or the empty string
:property string gravatar_url: url to the user's gravatar image
or the empty string
This will format to something pretty and make references to :json:object:`Github User` work as expected.
Contributing¶
Setting up your environment¶
First of all, build yourself a nice clean virtual environment using the
venv
module (or virtualenv if you must). Then pull in the
requirements:
sphinx-jsondomain$ python3 -mvenv env
sphinx-jsondomain$ env/bin/pip install -qr requires/development.txt
Giving it Back¶
Once you have something substantial that you would like to contribute back to the extension, push your branch up to github.com and issue a Pull Request against the main repository.