跳转到主要内容

Sphinx的GraphQL域。

项目描述

Documentation Github Build Status PyPI Version Supported Python Versions Formatted with Black

一个用于描述GraphQL模式的Sphinx域。

入门

以下步骤将说明如何将graphqldomain添加到现有的Sphinx项目中。有关如何设置Sphinx项目的说明,请参阅Sphinx的入门文档。

安装

graphqldomain可以通过pip安装

pip install graphqldomain

接下来,将graphqldomain添加到Sphinx项目中的extensions列表中的conf.py

extensions.append("graphqldomain")

用法

每个指令都接受原始模式的片段。有关更详细的用法,请参阅文档: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.

贡献

运行测试

测试通过tox执行。

tox

代码样式

代码使用black格式化。

您可以使用black的检查模式检查您的格式化

tox -e format

您也可以让black为您格式化更改

black graphqldomain.py tests/

版本控制

我们使用SemVer进行版本控制。有关可用的版本,请参阅此存储库的标签

许可证

此项目受MIT许可证的许可。有关详细信息,请参阅LICENSE.rst文件。

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解有关 安装包 的更多信息。

源代码分发

graphqldomain-0.2.0.tar.gz (10.4 kB 查看哈希值)

上传时间 源代码

构建分发

graphqldomain-0.2.0-py3-none-any.whl (9.2 kB 查看哈希值)

上传时间 Python 3

支持