Files
ihrm/horilla_api/swagger_settings.py

30 lines
816 B
Python
Raw Permalink Normal View History

2025-12-23 15:01:24 +05:30
"""
Custom Swagger settings for the API
"""
2025-12-23 15:01:24 +05:30
from django.conf import settings
# Define security definitions for Swagger UI
SWAGGER_SETTINGS = {
"SECURITY_DEFINITIONS": {
"Bearer": {
"type": "apiKey",
"name": "Authorization",
"in": "header",
"description": 'JWT Token Authentication: Enter your token with the "Bearer " prefix, e.g. "Bearer abcde12345"',
2025-12-23 15:01:24 +05:30
}
},
"USE_SESSION_AUTH": False,
"DEFAULT_UI_SETTINGS": {
2025-12-23 15:01:24 +05:30
# Keep tag order as defined in the generated spec
"tagsSorter": "none"
2025-12-23 15:01:24 +05:30
},
"SECURITY_REQUIREMENTS": [{"Bearer": []}],
2025-12-23 15:01:24 +05:30
}
# Apply settings
if hasattr(settings, "SWAGGER_SETTINGS"):
2025-12-23 15:01:24 +05:30
settings.SWAGGER_SETTINGS.update(SWAGGER_SETTINGS)
else:
setattr(settings, "SWAGGER_SETTINGS", SWAGGER_SETTINGS)