Revert "Use drf-yasg for Open API documentation"

This commit is contained in:
Ned Batchelder
2019-06-11 16:05:00 -04:00
committed by GitHub
parent a7bc22eb9c
commit 39c7a2db7c
27 changed files with 46 additions and 105 deletions

View File

@@ -45,10 +45,6 @@ class CourseSerializer(serializers.Serializer): # pylint: disable=abstract-meth
invite_only = serializers.BooleanField(source="invitation_only")
course_modes = serializers.SerializerMethodField()
class Meta(object):
# For disambiguating within the drf-yasg swagger schema
ref_name = 'enrollment.Course'
def __init__(self, *args, **kwargs):
self.include_expired = kwargs.pop("include_expired", False)
super(CourseSerializer, self).__init__(*args, **kwargs)

View File

@@ -551,7 +551,7 @@ class TestAccountsAPI(CacheIsolationTestCase, UserAPITestCase):
("level_of_education", "none", u"ȻħȺɍłɇs", u'"ȻħȺɍłɇs" is not a valid choice.'),
("country", "GB", "XY", u'"XY" is not a valid choice.'),
("year_of_birth", 2009, "not_an_int", u"A valid integer is required."),
("name", "bob", "z" * 256, u"Ensure this field has no more than 255 characters."),
("name", "bob", "z" * 256, u"Ensure this value has at most 255 characters (it has 256)."),
("name", u"ȻħȺɍłɇs", " ", u"The name field must be at least 1 character long."),
("goals", "Smell the roses"),
("mailing_address", "Sesame Street"),

View File

@@ -470,7 +470,7 @@ def get_expected_validation_developer_message(preference_key, preference_value):
preference_key=preference_key,
preference_value=preference_value,
error={
"key": [u"Ensure this field has no more than 255 characters."]
"key": [u"Ensure this value has at most 255 characters (it has 256)."]
}
)

View File

@@ -34,8 +34,6 @@ class UserSerializer(serializers.HyperlinkedModelSerializer):
# This list is the minimal set required by the notification service
fields = ("id", "url", "email", "name", "username", "preferences")
read_only_fields = ("id", "email", "username")
# For disambiguating within the drf-yasg swagger schema
ref_name = 'user_api.User'
class UserPreferenceSerializer(serializers.HyperlinkedModelSerializer):

View File

@@ -1,20 +0,0 @@
"""
Open API support.
"""
from rest_framework import permissions
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
schema_view = get_schema_view(
openapi.Info(
title="Open edX API",
default_version="v1",
description="APIs for access to Open edX information",
#terms_of_service="https://www.google.com/policies/terms/", # TODO: Do we have these?
contact=openapi.Contact(email="oscm@edx.org"),
#license=openapi.License(name="BSD License"), # TODO: What does this mean?
),
public=True,
permission_classes=(permissions.AllowAny,),
)