aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Finucane <stephen@that.guru>2018-10-27 01:31:43 +0100
committerStephen Finucane <stephen@that.guru>2019-01-29 09:35:08 +0000
commit806f1086bf649383e53095220599fd9f564b117b (patch)
tree32f7ba097cdaac31a567071fcd42f13f5f55b012
parentf825f207e91c2bf88e802e81cdfb1ee72114b2db (diff)
downloadpatchwork-806f1086bf649383e53095220599fd9f564b117b.tar
patchwork-806f1086bf649383e53095220599fd9f564b117b.tar.gz
docs: Integrate API schema into docs
This takes advantage of the sphinxcontrib-openapi Sphinx extension, which allows us to embed the REST API documentation into our docs quite nicely. Signed-off-by: Stephen Finucane <stephen@that.guru>
-rw-r--r--docs/api/rest/index.rst14
-rw-r--r--docs/api/rest/schemas/index.rst13
-rw-r--r--docs/api/rest/schemas/v1.0.rst5
-rw-r--r--docs/api/rest/schemas/v1.1.rst5
-rw-r--r--docs/conf.py6
-rw-r--r--docs/requirements.txt1
6 files changed, 43 insertions, 1 deletions
diff --git a/docs/api/rest/index.rst b/docs/api/rest/index.rst
index befd709..dd2a9e7 100644
--- a/docs/api/rest/index.rst
+++ b/docs/api/rest/index.rst
@@ -12,6 +12,8 @@ exposed by the API, refer to the web browsable API. This can be found at:
where `patchwork.example.com` refers to the URL of your Patchwork instance.
+If all you want is reference guides, skip straight to :ref:`rest-api-schemas`.
+
.. important::
The REST API can be enabled/disabled by the administrator: it may not be
@@ -265,6 +267,18 @@ Supported Versions
Further information about this and more can typically be found in
:doc:`the release notes </releases/index>`.
+.. _rest-api-schemas:
+
+Schemas
+-------
+
+Auto-generated schema documentation is provided below.
+
+.. toctree::
+
+ /api/rest/schemas/v1.0
+ /api/rest/schemas/v1.1
+
.. Links
.. _curl: https://curl.haxx.se/
diff --git a/docs/api/rest/schemas/index.rst b/docs/api/rest/schemas/index.rst
new file mode 100644
index 0000000..bff0dd4
--- /dev/null
+++ b/docs/api/rest/schemas/index.rst
@@ -0,0 +1,13 @@
+:orphan:
+
+Schemas
+=======
+
+The APIs for the :doc:`REST API </api/rest/index>` are listed below. For
+further information, refer to the :doc:`REST API overview </api/rest/index>`.
+
+.. toctree::
+ :maxdepth: 2
+
+ /api/rest/schemas/v1.0
+ /api/rest/schemas/v1.1
diff --git a/docs/api/rest/schemas/v1.0.rst b/docs/api/rest/schemas/v1.0.rst
new file mode 100644
index 0000000..a9add8e
--- /dev/null
+++ b/docs/api/rest/schemas/v1.0.rst
@@ -0,0 +1,5 @@
+API v1.0
+========
+
+.. openapi:: ../../schemas/v1.0/patchwork.yaml
+ :examples:
diff --git a/docs/api/rest/schemas/v1.1.rst b/docs/api/rest/schemas/v1.1.rst
new file mode 100644
index 0000000..e18f813
--- /dev/null
+++ b/docs/api/rest/schemas/v1.1.rst
@@ -0,0 +1,5 @@
+API v1.1 (latest)
+=================
+
+.. openapi:: ../../schemas/v1.1/patchwork.yaml
+ :examples:
diff --git a/docs/conf.py b/docs/conf.py
index 98c7aa3..f0ca797 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -20,7 +20,11 @@ needs_sphinx = '1.5'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
-extensions = ['sphinx.ext.todo', 'reno.sphinxext']
+extensions = [
+ 'sphinx.ext.todo',
+ 'reno.sphinxext',
+ 'sphinxcontrib.openapi'
+]
# The theme to use for HTML and HTML Help pages.
html_theme = 'sphinx_rtd_theme'
diff --git a/docs/requirements.txt b/docs/requirements.txt
index ec930de..a2d02d5 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -2,3 +2,4 @@ sphinx>=1.5
reno>=2.2
sphinx_rtd_theme==0.4.2
jinja2==2.10
+sphinxcontrib-openapi==0.4.0