-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #579 from jennydaman/openapi
Add drf-spectacular for OpenAPI generation
- Loading branch information
Showing
9 changed files
with
79 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
""" | ||
Do not manually update the version number here. This file gets overwritten by CI. | ||
""" | ||
|
||
__version__ = '0.0.0+unknown' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,14 @@ | |
|
||
from pathlib import Path | ||
|
||
from environs import Env | ||
|
||
from __version__ import __version__ | ||
|
||
# Environment variables-based secrets | ||
env = Env() | ||
env.read_env() # also read .env file, if it exists | ||
|
||
|
||
# Build paths inside the project like this: BASE_DIR / 'subdir'. | ||
BASE_DIR = Path(__file__).resolve().parent.parent.parent | ||
|
@@ -32,6 +40,7 @@ | |
'rest_framework.authtoken', | ||
'corsheaders', | ||
'collectionjson', | ||
'drf_spectacular', | ||
'core', | ||
'feeds', | ||
'plugins', | ||
|
@@ -66,7 +75,8 @@ | |
), | ||
'DEFAULT_FILTER_BACKENDS': ( | ||
'django_filters.rest_framework.DjangoFilterBackend', | ||
) | ||
), | ||
'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema' | ||
} | ||
|
||
MIDDLEWARE = [ | ||
|
@@ -163,3 +173,32 @@ | |
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field | ||
|
||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' | ||
|
||
# drf-spectacular OPENAPI SCHEMA SETTINGS | ||
SPECTACULAR_SETTINGS = { | ||
'TITLE': 'ChRIS Research Integration System: Ultron BackEnd (CUBE) API', | ||
'DESCRIPTION': ( | ||
'The ChRIS Ultron BackEnd (CUBE) is the core backend API of ChRIS. ' | ||
'It manages ChRIS users, plugins, pipelines, and the provenance of ' | ||
'data analyses as ChRIS feeds.' | ||
), | ||
'VERSION': __version__, | ||
'LICENSE': { | ||
'name': 'MIT', | ||
'url': 'https://github.com/FNNDSC/ChRIS_ultron_backEnd/blob/master/LICENSE' | ||
}, | ||
'EXTERNAL_DOCS': { | ||
'url': 'https://chrisproject.org/docs' | ||
}, | ||
'CONTACT': { | ||
'name': 'Fetal-Neonatal Neuroimaging Developmental Science Center', | ||
'url': 'https://chrisproject.org', | ||
'email': '[email protected]' | ||
}, | ||
'SERVE_INCLUDE_SCHEMA': True, | ||
'COMPONENT_SPLIT_REQUEST': env.bool("SPECTACULAR_SPLIT_REQUEST", False), | ||
|
||
'SCHEMA_PATH_PREFIX': '/api/v1/', | ||
# more settings found at: | ||
# https://drf-spectacular.readthedocs.io/en/latest/settings.html | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters