A GraphQL domain for Sphinx.
Project description
A Sphinx domain for describing GraphQL schemas.
Getting Started
The following steps will walk through how to add graphqldomain to an existing Sphinx project. For instructions on how to set up a Sphinx project, see Sphinx’s documentation on Getting Started.
Installation
graphqldomain can be installed through pip:
pip install graphqldomain
Next, add graphqldomain to the extensions list in your Sphinx project’s conf.py.
extensions.append("graphqldomain")
Usage
Each directive accepts a small snippet of the original schema. For more detailed usage, see the documentation: https://graphqldomain.readthedocs.io/en/latest/
.. gql:schema::
An example schema.
:optype Query query:
.. gql:directive:: @slow(super: Boolean = false) on FIELD_DEFINITION | ARGUMENT_DEFINITION
Indicates that the usage of this field or argument is slow,
and therefore queries with this field or argument should be made sparingly.
:argument super: Whether usage will be super slow, or just a bit slow.
.. gql:enum:: CharacterCase
The casing of a character.
.. gql:enum:value:: UPPER
Upper case.
.. gql:enum:value:: LOWER
Lower case.
.. gql:input:: Point2D
A point in a 2D coordinate system.
.. gql:input:field:: x: Float
The ``x`` coordinate of the point.
.. gql:input:field:: y: Float
The ``y`` coordinate of the point.
.. gql:interface:: NamedEntity
An entity with a name.
.. gql:interface:field:: name(lower: Boolean = false): String
The name of the entity.
:argument lower: Whether to lowercase the name or not.
.. gql:type:: Person implements NamedEntity
A human person.
.. gql:type:field:: age: Int
How old the person is in years.
.. gql:type:field:: picture: Url
.. gql:union:: Centre = Person | Point2D
A possible centre of the universe.
Contributing
Running the tests
Tests are executed through tox.
tox
Code Style
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:
black graphqldomain.py tests/
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
License
This project is licensed under the MIT License. See the LICENSE.rst file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file graphqldomain-0.2.0.tar.gz
.
File metadata
- Download URL: graphqldomain-0.2.0.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59d5f9269e513d2c55be47ed86088ecd9cfbdd0a44df8c77c71821550d52385c |
|
MD5 | 4a3f2ca2640c2beb0e2f3bcf6db08b5c |
|
BLAKE2b-256 | 71f1f09d438ba09d8e4bf561f02d42549751cc5db616468f74e669b3c89bd286 |
Provenance
File details
Details for the file graphqldomain-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: graphqldomain-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9c813a670cb6db9492b8b63e8fff54a0e0a522f49ea35d2bc9bf52acbaa641e |
|
MD5 | 6c663d255fa8ebe7341ae55bf4d10431 |
|
BLAKE2b-256 | 0655d0165a60072c7886f9a296a10f31103fff795ce3d340b51e7b25712fcaca |