diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 59a81b05..da8b0a22 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,7 +23,7 @@ jobs: - name: Validate REST API uses: char0n/swagger-editor-validate@182d1a5d26ff5c2f4f452c43bd55e2c7d8064003 with: - definition-file: docs/rest-api.yml + definition-file: docs/source/_static/rest-api.yml - uses: actions/setup-python@v2 with: diff --git a/README.md b/README.md index d804b312..1163dd5e 100644 --- a/README.md +++ b/README.md @@ -56,9 +56,11 @@ Basic principles for operation are: servers. JupyterHub also provides a -[REST API](https://petstore3.swagger.io/?url=https://raw.githubusercontent.com/jupyter/jupyterhub/HEAD/docs/rest-api.yml#/default) +[REST API][] for administration of the Hub and its users. +[rest api]: https://juptyerhub.readthedocs.io/en/latest/reference/rest-api.html + ## Installation ### Check prerequisites @@ -239,7 +241,7 @@ You can also talk with us on our JupyterHub [Gitter](https://gitter.im/jupyterhu - [Reporting Issues](https://github.com/jupyterhub/jupyterhub/issues) - [JupyterHub tutorial](https://github.com/jupyterhub/jupyterhub-tutorial) - [Documentation for JupyterHub](https://jupyterhub.readthedocs.io/en/latest/) | [PDF (latest)](https://media.readthedocs.org/pdf/jupyterhub/latest/jupyterhub.pdf) | [PDF (stable)](https://media.readthedocs.org/pdf/jupyterhub/stable/jupyterhub.pdf) -- [Documentation for JupyterHub's REST API](https://petstore3.swagger.io/?url=https://raw.githubusercontent.com/jupyter/jupyterhub/HEAD/docs/rest-api.yml#/default) +- [Documentation for JupyterHub's REST API][rest api] - [Documentation for Project Jupyter](http://jupyter.readthedocs.io/en/latest/index.html) | [PDF](https://media.readthedocs.org/pdf/jupyter/latest/jupyter.pdf) - [Project Jupyter website](https://jupyter.org) - [Project Jupyter community](https://jupyter.org/community) diff --git a/docs/Makefile b/docs/Makefile index 694d5a35..64f7d449 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -53,14 +53,6 @@ help: clean: rm -rf $(BUILDDIR)/* -node_modules: package.json - npm install && touch node_modules - -rest-api: source/_static/rest-api/index.html - -source/_static/rest-api/index.html: rest-api.yml node_modules - npm run rest-api - metrics: source/reference/metrics.rst source/reference/metrics.rst: generate-metrics.py @@ -71,7 +63,7 @@ scopes: source/rbac/scope-table.md source/rbac/scope-table.md: source/rbac/generate-scope-table.py python3 source/rbac/generate-scope-table.py -html: rest-api metrics scopes +html: metrics scopes $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." diff --git a/docs/package.json b/docs/package.json deleted file mode 100644 index 5ba8b2b2..00000000 --- a/docs/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "jupyterhub-docs-build", - "version": "0.8.0", - "description": "build JupyterHub swagger docs", - "scripts": { - "rest-api": "bootprint openapi ./rest-api.yml source/_static/rest-api" - }, - "author": "", - "license": "BSD-3-Clause", - "devDependencies": { - "bootprint": "^1.0.0", - "bootprint-openapi": "^1.0.0" - } -} diff --git a/docs/source/_static/custom.css b/docs/source/_static/custom.css index 5da11561..56c21625 100644 --- a/docs/source/_static/custom.css +++ b/docs/source/_static/custom.css @@ -2,3 +2,9 @@ .navbar-brand { height: 4rem !important; } + +/* hide redundant funky-formatted swagger-ui version */ + +.swagger-ui .info .title small { + display: none !important; +} diff --git a/docs/rest-api.yml b/docs/source/_static/rest-api.yml similarity index 100% rename from docs/rest-api.yml rename to docs/source/_static/rest-api.yml diff --git a/docs/source/api/index.rst b/docs/source/api/index.rst index c5535af8..38f1328a 100644 --- a/docs/source/api/index.rst +++ b/docs/source/api/index.rst @@ -17,11 +17,6 @@ information on: - making an API request programmatically using the requests library - learning more about JupyterHub's API -The same JupyterHub API spec, as found here, is available in an interactive form -`here (on swagger's petstore) `__. -The `OpenAPI Initiative`_ (fka Swaggerâ„¢) is a project used to describe -and document RESTful APIs. - JupyterHub API Reference: .. toctree:: diff --git a/docs/source/conf.py b/docs/source/conf.py index d5107062..1e3d0cb5 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -215,7 +215,7 @@ if on_rtd: # build both metrics and rest-api, since RTD doesn't run make from subprocess import check_call as sh - sh(['make', 'metrics', 'rest-api', 'scopes'], cwd=docs) + sh(['make', 'metrics', 'scopes'], cwd=docs) # -- Spell checking ------------------------------------------------------- diff --git a/docs/source/index.rst b/docs/source/index.rst index 903555ff..a7b2c0c8 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -43,7 +43,7 @@ JupyterHub performs the following functions: notebook servers For convenient administration of the Hub, its users, and services, -JupyterHub also provides a `REST API`_. +JupyterHub also provides a :doc:`REST API `. The JupyterHub team and Project Jupyter value our community, and JupyterHub follows the Jupyter `Community Guides `_. @@ -155,4 +155,3 @@ Questions? Suggestions? .. _JupyterHub: https://github.com/jupyterhub/jupyterhub .. _Jupyter notebook: https://jupyter-notebook.readthedocs.io/en/latest/ -.. _REST API: https://petstore3.swagger.io/?url=https://raw.githubusercontent.com/jupyterhub/jupyterhub/HEAD/docs/rest-api.yml#!/default diff --git a/docs/source/rbac/generate-scope-table.py b/docs/source/rbac/generate-scope-table.py index 2ba82e97..ed7241a7 100644 --- a/docs/source/rbac/generate-scope-table.py +++ b/docs/source/rbac/generate-scope-table.py @@ -9,7 +9,8 @@ import jupyterhub from jupyterhub.scopes import scope_definitions HERE = os.path.abspath(os.path.dirname(__file__)) -PARENT = Path(HERE).parent.parent.absolute() +DOCS = Path(HERE).parent.parent.absolute() +REST_API_YAML = DOCS.joinpath("source", "_static", "rest-api.yml") class ScopeTableGenerator: @@ -99,7 +100,7 @@ class ScopeTableGenerator: def write_api(self): """Generates the API description in markdown format and writes it into `rest-api.yml`""" - filename = f"{PARENT}/rest-api.yml" + filename = REST_API_YAML yaml = YAML(typ='rt') yaml.preserve_quotes = True scope_dict = {} diff --git a/docs/source/reference/index.rst b/docs/source/reference/index.rst index b985cbf6..46362d22 100644 --- a/docs/source/reference/index.rst +++ b/docs/source/reference/index.rst @@ -16,6 +16,7 @@ what happens under-the-hood when you deploy and configure your JupyterHub. proxy separate-proxy rest + rest-api server-api monitoring database diff --git a/docs/source/reference/rest-api.md b/docs/source/reference/rest-api.md new file mode 100644 index 00000000..38d690f1 --- /dev/null +++ b/docs/source/reference/rest-api.md @@ -0,0 +1,27 @@ +# JupyterHub REST API + +Below is an interactive view of JupyterHub's OpenAPI specification. + + + + + + + + +
+ + diff --git a/docs/source/reference/rest-api.rst b/docs/source/reference/rest-api.rst deleted file mode 100644 index c16d678d..00000000 --- a/docs/source/reference/rest-api.rst +++ /dev/null @@ -1,14 +0,0 @@ -:orphan: - -=================== -JupyterHub REST API -=================== - -.. this doc exists as a resolvable link target -.. which _static files are not - -.. meta:: - :http-equiv=refresh: 0;url=../_static/rest-api/index.html - -The rest API docs are `here <../_static/rest-api/index.html>`_ -if you are not redirected automatically. diff --git a/docs/source/reference/rest.md b/docs/source/reference/rest.md index 24048cbe..a25382b8 100644 --- a/docs/source/reference/rest.md +++ b/docs/source/reference/rest.md @@ -302,12 +302,8 @@ or kubernetes pods. ## Learn more about the API -You can see the full [JupyterHub REST API][] for details. This REST API Spec can -be viewed in a more [interactive style on swagger's petstore][]. -Both resources contain the same information and differ only in its display. -Note: The Swagger specification is being renamed the [OpenAPI Initiative][]. +You can see the full [JupyterHub REST API][] for details. -[interactive style on swagger's petstore]: https://petstore3.swagger.io/?url=https://raw.githubusercontent.com/jupyterhub/jupyterhub/HEAD/docs/rest-api.yml#!/default [openapi initiative]: https://www.openapis.org/ [jupyterhub rest api]: ./rest-api [jupyter notebook rest api]: https://petstore3.swagger.io/?url=https://raw.githubusercontent.com/jupyter/notebook/HEAD/notebook/services/api/api.yaml