Skip to content

Commit

Permalink
fix: add redoc & spectacular settings
Browse files Browse the repository at this point in the history
  • Loading branch information
irtazaakram committed Oct 2, 2024
1 parent 7d86a38 commit eec767c
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 12 deletions.
8 changes: 8 additions & 0 deletions notesserver/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@
'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',
}

SPECTACULAR_SETTINGS = {
'TITLE': 'edx-notes-api',
'DESCRIPTION': 'API documentation for edx-notes-api',
'VERSION': '1.0.0',
'SERVE_INCLUDE_SCHEMA': False,
'SCHEMA_PATH_PREFIX': '/api/'
}

# CORS is configured to allow all origins because requests to the
# Notes API do not rely on ambient authority; instead, they are
# authorized explicitly via an X-Annotator-Auth-Token header. (The
Expand Down
1 change: 1 addition & 0 deletions notesserver/settings/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import platform
import sys
from logging.handlers import SysLogHandler

from django.conf import settings


Expand Down
2 changes: 1 addition & 1 deletion notesserver/settings/yaml_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import yaml
from django.core.exceptions import ImproperlyConfigured
from path import path

from notesserver.settings.logger import build_logging_config
from path import path

from .common import * # pylint: disable=unused-wildcard-import, wildcard-import

Expand Down
3 changes: 2 additions & 1 deletion notesserver/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.urls import include, path, re_path
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView
from drf_spectacular.views import SpectacularAPIView, SpectacularRedocView, SpectacularSwaggerView

import notesserver.views

Expand All @@ -11,4 +11,5 @@
path('api/', include('notesapi.urls', namespace='api')),
path('api/schema/', SpectacularAPIView.as_view(), name='schema'),
path('api/schema/swagger-ui/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
path('api/schema/redoc/', SpectacularRedocView.as_view(url_name='schema'), name='redoc'),
]
6 changes: 3 additions & 3 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ drf-spectacular==0.27.2
# via -r requirements/base.in
edx-django-release-util==1.4.0
# via -r requirements/base.in
edx-django-utils==5.15.0
edx-django-utils==5.16.0
# via
# -r requirements/base.in
# edx-drf-extensions
Expand Down Expand Up @@ -128,7 +128,7 @@ pyjwt[crypto]==2.9.0
# -r requirements/base.in
# drf-jwt
# edx-drf-extensions
pymongo==4.9.1
pymongo==4.10.1
# via edx-opaque-keys
pynacl==1.5.0
# via edx-django-utils
Expand All @@ -138,7 +138,7 @@ python-dateutil==2.4.0
# -r requirements/base.in
# elasticsearch-dsl
pytz==2024.2
# via drf-yasg
# via -r requirements/base.in
pyyaml==6.0.2
# via
# drf-spectacular
Expand Down
2 changes: 1 addition & 1 deletion requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pluggy==1.5.0
# via tox
pyproject-api==1.8.0
# via tox
tox==4.20.0
tox==4.21.0
# via -r requirements/ci.in
virtualenv==20.26.6
# via tox
11 changes: 5 additions & 6 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ drf-spectacular==0.27.2
# via -r requirements/base.txt
edx-django-release-util==1.4.0
# via -r requirements/base.txt
edx-django-utils==5.15.0
edx-django-utils==5.16.0
# via
# -r requirements/base.txt
# edx-drf-extensions
Expand All @@ -137,7 +137,7 @@ elasticsearch-dsl==7.4.1
# django-elasticsearch-dsl-drf
factory-boy==3.3.1
# via -r requirements/test.in
faker==30.0.0
faker==30.1.0
# via factory-boy
filelock==3.16.1
# via
Expand Down Expand Up @@ -226,7 +226,7 @@ pylint==1.5.0
# via
# -c requirements/constraints.txt
# -r requirements/test.in
pymongo==4.9.1
pymongo==4.10.1
# via
# -r requirements/base.txt
# edx-opaque-keys
Expand All @@ -252,9 +252,7 @@ python-dateutil==2.4.0
python-slugify==8.0.4
# via code-annotations
pytz==2024.2
# via
# -r requirements/base.txt
# drf-yasg
# via -r requirements/base.txt
pyyaml==6.0.2
# via
# -r requirements/base.txt
Expand Down Expand Up @@ -310,6 +308,7 @@ typing-extensions==4.12.2
# via
# -r requirements/base.txt
# edx-opaque-keys
# faker
uritemplate==4.1.1
# via
# -r requirements/base.txt
Expand Down

0 comments on commit eec767c

Please sign in to comment.