From 78bd8d6f9722b41bb33a36788f969c5dada46ac5 Mon Sep 17 00:00:00 2001 From: "halil.cakal" Date: Mon, 11 Jul 2022 11:29:06 +0100 Subject: [PATCH] Alternative docs to Redoc lib: sphinxcontrib.openapi Issue-ID: NONRTRIC-777 Change-Id: Iea828e8b11138255da2d0f4c6fda139b3b1aed9e Signed-off-by: halil.cakal --- .gitignore | 3 +++ docs/api-docs.rst | 14 +++----------- docs/conf.py | 29 +++++++++++++++++++---------- docs/requirements-docs.txt | 4 ++++ tox.ini | 4 ++-- 5 files changed, 31 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index 88a00f6..be1dfec 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,6 @@ coverage.* .swagger-codegen-ignore .swagger-codegen/ api/README.md + +# Python virtual env +venv/ diff --git a/docs/api-docs.rst b/docs/api-docs.rst index 925d540..a0db8f8 100644 --- a/docs/api-docs.rst +++ b/docs/api-docs.rst @@ -23,14 +23,6 @@ Non-RT-RIC App Catalogue (Initial) The Service Catalogue provides a way for services to register themselves for other services to discover. -See `App Catalogue API <./rac-api.html>`_ for full details of the API. - -The API is also described in Swagger-JSON and YAML: - - -.. csv-table:: - :header: "API name", "|swagger-icon|", "|yaml-icon|" - :widths: 10,5, 5 - - "App Catalogue API", ":download:`link <../api/rac-api.json>`", ":download:`link <../api/rac-api.yaml>`" - +.. Generates content from rac-api.json +.. openapi:: ../api/rac-api.json + :examples: diff --git a/docs/conf.py b/docs/conf.py index 95a726a..e14099c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -4,6 +4,8 @@ from docs_conf.conf import * branch = 'latest' +language = 'en' + linkcheck_ignore = [ 'http://localhost.*', 'http://127.0.0.1.*', @@ -11,18 +13,25 @@ linkcheck_ignore = [ './rac-api.html', #Generated file that doesn't exist at link check. ] -extensions = ['sphinxcontrib.redoc', 'sphinx.ext.intersphinx',] +#extensions = ['sphinxcontrib.redoc', 'sphinx.ext.intersphinx',] + +extensions = [ + # ... + #'sphinxcontrib.redoc', + 'sphinxcontrib.openapi', + 'sphinx.ext.intersphinx', +] -redoc = [ - { - 'name': 'RAC API', - 'page': 'rac-api', - 'spec': '../api/rac-api.json', - 'embed': True, - } - ] +#redoc = [ + #{ + #'name': 'RAC API', + #'page': 'rac-api', + #'spec': '../api/rac-api.json', + #'embed': True, + #} + #] -redoc_uri = 'https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js' +#redoc_uri = 'https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js' #intershpinx mapping with other projects intersphinx_mapping = {} diff --git a/docs/requirements-docs.txt b/docs/requirements-docs.txt index 8f65cbd..da9a22e 100644 --- a/docs/requirements-docs.txt +++ b/docs/requirements-docs.txt @@ -1,3 +1,7 @@ sphinx sphinxcontrib-redoc lfdocs-conf +sphinxcontrib-httpdomain +sphinxcontrib-openapi==0.6.0 +sphinx-rtd-theme +recommonmark diff --git a/tox.ini b/tox.ini index 2705e16..7e40dca 100644 --- a/tox.ini +++ b/tox.ini @@ -23,7 +23,7 @@ envlist = skipsdist = true [testenv:docs] -basepython = python3 +basepython = python3.8 deps = -r{toxinidir}/docs/requirements-docs.txt commands = @@ -32,6 +32,6 @@ commands = whitelist_externals = echo [testenv:docs-linkcheck] -basepython = python3 +basepython = python3.8 deps = -r{toxinidir}/docs/requirements-docs.txt commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck -- 2.16.6