diff options
author | Don Naro <dnaro@redhat.com> | 2023-11-11 14:33:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-11 14:33:41 +0100 |
commit | 0057c8daf6c0e4077458384cc8ee5c4543d48f8f (patch) | |
tree | 80e9b59afbcc2ae7ca945d551564fcf8083b41db /docs | |
parent | Added alt text for settings-menu.rst (#14639) (diff) | |
download | awx-0057c8daf6c0e4077458384cc8ee5c4543d48f8f.tar.xz awx-0057c8daf6c0e4077458384cc8ee5c4543d48f8f.zip |
Docs: Include REST API reference content from swagger.json (#14607)
Diffstat (limited to 'docs')
-rw-r--r-- | docs/docsite/conf.py | 3 | ||||
-rw-r--r-- | docs/docsite/rst/rest_api/_swagger/awx-rest-api.css (renamed from docs/docsite/rst/rest_api/_swagger/tower.css) | 0 | ||||
-rw-r--r-- | docs/docsite/rst/rest_api/_swagger/download-json.py | 13 | ||||
-rw-r--r-- | docs/docsite/rst/rest_api/api_ref.rst | 4 | ||||
-rw-r--r-- | docs/docsite/rst/rest_api/index.rst | 2 |
5 files changed, 17 insertions, 5 deletions
diff --git a/docs/docsite/conf.py b/docs/docsite/conf.py index 74553d56b1..2a733792ed 100644 --- a/docs/docsite/conf.py +++ b/docs/docsite/conf.py @@ -5,7 +5,7 @@ import shlex from datetime import datetime from importlib import import_module -#sys.path.insert(0, os.path.abspath('./rst/rest_api/_swagger')) +sys.path.insert(0, os.path.abspath('./rst/rest_api/_swagger')) project = u'Ansible AWX' copyright = u'2023, Red Hat' @@ -35,6 +35,7 @@ extensions = [ 'sphinx.ext.coverage', 'sphinx.ext.ifconfig', 'sphinx_ansible_theme', + 'swagger', ] html_theme = 'sphinx_ansible_theme' diff --git a/docs/docsite/rst/rest_api/_swagger/tower.css b/docs/docsite/rst/rest_api/_swagger/awx-rest-api.css index 06af18fa26..06af18fa26 100644 --- a/docs/docsite/rst/rest_api/_swagger/tower.css +++ b/docs/docsite/rst/rest_api/_swagger/awx-rest-api.css diff --git a/docs/docsite/rst/rest_api/_swagger/download-json.py b/docs/docsite/rst/rest_api/_swagger/download-json.py new file mode 100644 index 0000000000..47ded50a2a --- /dev/null +++ b/docs/docsite/rst/rest_api/_swagger/download-json.py @@ -0,0 +1,13 @@ +import requests + +url = "https://awx-public-ci-files.s3.amazonaws.com/community-docs/swagger.json" +swagger_json = "./docs/docsite/rst/rest_api/_swagger/swagger.json" + +response = requests.get(url) + +if response.status_code == 200: + with open(swagger_json, 'wb') as file: + file.write(response.content) + print(f"JSON file downloaded to {swagger_json}") +else: + print(f"Request failed with status code: {response.status_code}") diff --git a/docs/docsite/rst/rest_api/api_ref.rst b/docs/docsite/rst/rest_api/api_ref.rst index 144d21854f..5b049e6ae4 100644 --- a/docs/docsite/rst/rest_api/api_ref.rst +++ b/docs/docsite/rst/rest_api/api_ref.rst @@ -1,5 +1,3 @@ -:orphan: - .. _api_reference: AWX API Reference Guide @@ -48,7 +46,7 @@ The API Reference Manual provides in-depth documentation for the AWX REST API, i <script> window.onload = function() { $('head').append('<link rel="stylesheet" href="../_static/swagger-ui.css" type="text/css"></link>'); - $('head').append('<link rel="stylesheet" href="../_static/tower.css" type="text/css"></link>'); + $('head').append('<link rel="stylesheet" href="../_static/awx-rest-api.css" type="text/css"></link>'); $('#swagger-ui').on('click', function(e) { // By default, swagger-ui has a show/hide toggle for headers, and // there's no way to turn it off; this code intercepts the click event diff --git a/docs/docsite/rst/rest_api/index.rst b/docs/docsite/rst/rest_api/index.rst index 5a3031a275..73e4ef3d08 100644 --- a/docs/docsite/rst/rest_api/index.rst +++ b/docs/docsite/rst/rest_api/index.rst @@ -31,7 +31,7 @@ You can also find lots of AWX discussion and get answers to questions at `forum. access_resources read_only_fields authentication -.. api_ref + api_ref .. intro .. auth_token |