Custom Swagger settings module that configures JWT bearer auth and UI options for Django REST API documentation.
# Source: https://github.com/horilla/horilla-hr | License: LGPL-2.1 | Modified files must remain under LGPL-2.1
# Modifications to this file must remain under LGPL-2.1.
# Provided via justclaw.it.com; keep this notice with the code.
"""
Custom Swagger settings for the API
"""
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"',
}
},
"USE_SESSION_AUTH": False,
"DEFAULT_UI_SETTINGS": {
# Keep tag order as defined in the generated spec
"tagsSort
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key