From 17acb444bdba5fe766b613bfde4987acdd0697ba Mon Sep 17 00:00:00 2001 From: Michael Price Date: Tue, 13 Mar 2018 16:33:33 -0400 Subject: [PATCH] Add link to API documentation generated by ReDoc. Signed-off-by: Michael Price --- mayan/apps/rest_api/apps.py | 8 ++++++-- mayan/apps/rest_api/links.py | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/mayan/apps/rest_api/apps.py b/mayan/apps/rest_api/apps.py index 8c963307ea..1e8d2c4198 100644 --- a/mayan/apps/rest_api/apps.py +++ b/mayan/apps/rest_api/apps.py @@ -7,7 +7,9 @@ from django.utils.translation import ugettext_lazy as _ from common import MayanAppConfig, menu_tools -from .links import link_api, link_api_documentation +from .links import ( + link_api, link_api_documentation, link_api_documentation_redoc +) from .licenses import * # NOQA @@ -21,7 +23,9 @@ class RESTAPIApp(MayanAppConfig): from .urls import api_urls settings.STRONGHOLD_PUBLIC_URLS += (r'^/%s/.+$' % self.app_url,) - menu_tools.bind_links(links=(link_api_documentation,)) + menu_tools.bind_links( + links=(link_api_documentation, link_api_documentation_redoc) + ) for app in apps.get_app_configs(): if getattr(app, 'has_rest_api', False): diff --git a/mayan/apps/rest_api/links.py b/mayan/apps/rest_api/links.py index 0581163cd4..ae5a876f8b 100644 --- a/mayan/apps/rest_api/links.py +++ b/mayan/apps/rest_api/links.py @@ -9,6 +9,11 @@ link_api = Link( view='rest_api:api_root' ) link_api_documentation = Link( - icon='fa fa-book', tags='new_window', text=_('API Documentation'), + icon='fa fa-book', tags='new_window', text=_('API Documentation (Swagger)'), view='schema-swagger-ui' ) + +link_api_documentation_redoc = Link( + icon='fa fa-book', tags='new_window', text=_('API Documentation (ReDoc)'), + view='schema-redoc' +)