mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-03 11:29:28 -05:00
swagger UI and redoc inerfaces are now functional
schema.yml added for convenience. Its creation should be part of the CI workflow if the API changes.
This commit is contained in:
parent
b0714280bc
commit
0da8b928d6
@ -359,11 +359,27 @@ MIDDLEWARE = [
|
|||||||
]
|
]
|
||||||
SPECTACULAR_SETTINGS = {
|
SPECTACULAR_SETTINGS = {
|
||||||
"TITLE": "Paperless API",
|
"TITLE": "Paperless API",
|
||||||
"DESCRIPTION": "Generated with drf-spectacular (unmodified) python manage.py spectacular --color --file schema.yml",
|
"DESCRIPTION": """
|
||||||
"VERSION": "5.0.0",
|
WARNING: Not yet complete due to errors in the processing of the API Information
|
||||||
"SERVE_INCLUDE_SCHEMA": False,
|
""",
|
||||||
# OTHER SETTINGS
|
"VERSION": "6.0.0",
|
||||||
}# Optional to enable compression
|
"SERVE_INCLUDE_SCHEMA": True,
|
||||||
|
"SERVER_PUBLIC": True,
|
||||||
|
"COMPONENT_SPLIT_REQUEST": True,
|
||||||
|
# swagger ui
|
||||||
|
"SWAGGER_UI_SETTINGS": {
|
||||||
|
"deepLinking": True,
|
||||||
|
"persistAuthorization": True,
|
||||||
|
"displayOperationId": True,
|
||||||
|
},
|
||||||
|
# available SwaggerUI versions: https://github.com/swagger-api/swagger-ui/releases
|
||||||
|
"SWAGGER_UI_DIST": "https://cdn.jsdelivr.net/npm/swagger-ui-dist@latest", # default
|
||||||
|
# redoc
|
||||||
|
"REDOC_UI_SETTINGS": {},
|
||||||
|
"REDOC_DIST": "https://cdn.jsdelivr.net/npm/redoc@latest",
|
||||||
|
}
|
||||||
|
|
||||||
|
# Optional to enable compression
|
||||||
if __get_boolean("PAPERLESS_ENABLE_COMPRESSION", "yes"): # pragma: no cover
|
if __get_boolean("PAPERLESS_ENABLE_COMPRESSION", "yes"): # pragma: no cover
|
||||||
MIDDLEWARE.insert(0, "compression_middleware.middleware.CompressionMiddleware")
|
MIDDLEWARE.insert(0, "compression_middleware.middleware.CompressionMiddleware")
|
||||||
|
|
||||||
|
@ -15,6 +15,9 @@ from django.views.decorators.csrf import csrf_exempt
|
|||||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||||
from django.views.generic import RedirectView
|
from django.views.generic import RedirectView
|
||||||
from django.views.static import serve
|
from django.views.static import serve
|
||||||
|
from drf_spectacular.views import SpectacularAPIView
|
||||||
|
from drf_spectacular.views import SpectacularRedocView
|
||||||
|
from drf_spectacular.views import SpectacularSwaggerView
|
||||||
from rest_framework.authtoken import views
|
from rest_framework.authtoken import views
|
||||||
from rest_framework.routers import DefaultRouter
|
from rest_framework.routers import DefaultRouter
|
||||||
|
|
||||||
@ -316,6 +319,12 @@ urlpatterns = [
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
# drf spectacular
|
||||||
|
path("api/schema/", SpectacularAPIView.as_view(), name="schema"),
|
||||||
|
# Optional UI:
|
||||||
|
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"),
|
||||||
|
|
||||||
# Root of the Frontend
|
# Root of the Frontend
|
||||||
re_path(
|
re_path(
|
||||||
r".*",
|
r".*",
|
||||||
@ -324,7 +333,6 @@ urlpatterns = [
|
|||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
websocket_urlpatterns = [
|
websocket_urlpatterns = [
|
||||||
path(settings.BASE_URL.lstrip("/") + "ws/status/", StatusConsumer.as_asgi()),
|
path(settings.BASE_URL.lstrip("/") + "ws/status/", StatusConsumer.as_asgi()),
|
||||||
]
|
]
|
||||||
|
7439
src/schema.yml
Normal file
7439
src/schema.yml
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user