forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add swagger for CMS API via drf-spectacular (openedx#33282)
This adds two new urls: `<studio-base>/cms-api/ui` and `<studio-base>/cms-api/schema` with swagger ui and swaggerfile only for the new CMS API using drf-spectacular
- Loading branch information
1 parent
6714062
commit f197f9e
Showing
22 changed files
with
184 additions
and
98 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
15 changes: 15 additions & 0 deletions
15
cms/djangoapps/contentstore/rest_api/v1/serializers/xblock.py
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,15 @@ | ||
""" | ||
API Serializers for xblocks | ||
""" | ||
|
||
|
||
# TODO: implement and use serializer | ||
# from rest_framework import serializers | ||
|
||
# class XblockSerializer(serializers.Serializer): | ||
# """Serializer for xblocks""" | ||
# id=serializers.CharField(required=False) | ||
# display_name=serializers.CharField(required=False) | ||
# category=serializers.CharField(required=False) | ||
# data=serializers.CharField(required=False) | ||
# metadata=serializers.DictField(required=False) |
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
2 changes: 1 addition & 1 deletion
2
cms/djangoapps/contentstore/rest_api/v1/views/tests/test_assets.py
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
2 changes: 1 addition & 1 deletion
2
cms/djangoapps/contentstore/rest_api/v1/views/tests/test_xblock.py
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
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,19 @@ | ||
""" 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 ( | ||
path.startswith("/api/contentstore/v1/xblock") or | ||
path.startswith("/api/contentstore/v1/videos") or | ||
path.startswith("/api/contentstore/v1/video_transcripts") or | ||
path.startswith("/api/contentstore/v1/file_assets") | ||
): | ||
filtered.append((path, path_regex, method, callback)) | ||
return filtered |
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
Oops, something went wrong.