Skip to content

Commit

Permalink
api: openapi specification generation
Browse files Browse the repository at this point in the history
* Adds CLI to generate OpenAPI spec out of docstrings.

* Adds initial test to validate spec.

* Adds Marshmallow validation for `/jobs` POST endpoint.

Signed-off-by: Diego Rodriguez <diego.rodriguez@cern.ch>
  • Loading branch information
Diego Rodriguez committed May 15, 2017
1 parent dfa2e19 commit e9b7dad
Show file tree
Hide file tree
Showing 12 changed files with 386 additions and 174 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -78,3 +78,6 @@ target/

# Vagrant
.vagrant

# OpenAPI
openapi.json
1 change: 1 addition & 0 deletions MANIFEST.in
Expand Up @@ -23,6 +23,7 @@ include COPYING
include *.rst
include *.sh
include pytest.ini
include docs/openapi.json
recursive-include reana_job_controller *.json
recursive-include docs *.py
recursive-include docs *.png
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Expand Up @@ -51,6 +51,7 @@
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinxcontrib.httpdomain',
'sphinxcontrib.openapi'
]

# Add any paths that contain templates here, relative to this directory.
Expand Down
9 changes: 9 additions & 0 deletions docs/gettingstarted.rst
Expand Up @@ -10,3 +10,12 @@ Complex example
---------------

FIXME

CLI
---

The REANA Job Controller package offers the possibility to create its OpenAPI specification file using the Flask CLI.

.. code-block:: console
$ FLASK_APP=reana_job_controller/app.py flask openapi create openapi.json
15 changes: 1 addition & 14 deletions docs/restapi.rst
@@ -1,17 +1,4 @@
REST API
========

GET /jobs
---------

.. autofunction:: reana_job_controller.app.get_jobs

POST /jobs
----------

.. autofunction:: reana_job_controller.app.create_job

GET /jobs/<job_id>
------------------

.. autofunction:: reana_job_controller.app.get_job
.. openapi:: openapi.json

0 comments on commit e9b7dad

Please sign in to comment.