Files
edx-platform/cms/lib/spectacular.py
bszabo 5d6e925c83 feat: TNL-11173 Authoring API is v0 for now (#33644)
* feat: TNL-11173 authoring API offered as v0, not v1

* docs: correct swaggerfile for authoring api

---------

Co-authored-by: Bernard Szabo <bszabo@edx.org>
Co-authored-by: Jesper Hodge <jhodge@outlook.de>
2023-11-03 11:49:35 -04:00

22 lines
897 B
Python

""" Helper functions for drf-spectacular """
def cms_api_filter(endpoints):
"""
At the moment, we are only enabling drf-spectacular for the CMS API.
Filter out endpoints that are not part of the CMS API.
"""
filtered = []
for (path, path_regex, method, callback) in endpoints:
# Add only paths to the list that are part of the CMS API
if (
# Don't just replace this with /v1 when switching to a later version of the CMS API.
# That would include some unintended endpoints.
path.startswith("/api/contentstore/v0/xblock") or
path.startswith("/api/contentstore/v0/videos") or
path.startswith("/api/contentstore/v0/video_transcripts") or
path.startswith("/api/contentstore/v0/file_assets")
):
filtered.append((path, path_regex, method, callback))
return filtered