diff --git a/requirements/base.txt b/requirements/base.txt index 3eb96db1..03cda47f 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -78,6 +78,7 @@ django==4.2.11 # django-relativedelta # django-rest-framework-condition # django-rosetta + # django-sendfile2 # django-simple-certmanager # django-solo # django-two-factor-auth @@ -152,7 +153,7 @@ drf-nested-routers==0.93.4 # via # -r requirements/base.in # commonground-api-common -drf-spectacular==0.16.0 +drf-spectacular==0.26.5 # via -r requirements/base.in drf-yasg==1.21.7 # via commonground-api-common diff --git a/requirements/ci.txt b/requirements/ci.txt index 8795434e..ff6d6606 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -203,6 +203,7 @@ django-solo==2.0.0 django-two-factor-auth[phonenumberslite,webauthn]==1.16.0 # via # -r requirements/base.txt + # django-two-factor-auth # maykin-2fa django-webtest==1.9.10 # via -r requirements/test-tools.in @@ -223,7 +224,7 @@ drf-nested-routers==0.93.4 # via # -r requirements/base.txt # commonground-api-common -drf-spectacular==0.16.0 +drf-spectacular==0.26.5 # via -r requirements/base.txt drf-yasg==1.21.7 # via diff --git a/requirements/dev.txt b/requirements/dev.txt index 75778c0e..fc8143c7 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -227,6 +227,7 @@ django-solo==2.0.0 django-two-factor-auth[phonenumberslite,webauthn]==1.16.0 # via # -r requirements/ci.txt + # django-two-factor-auth # maykin-2fa django-webtest==1.9.10 # via -r requirements/ci.txt @@ -251,7 +252,7 @@ drf-nested-routers==0.93.4 # via # -r requirements/ci.txt # commonground-api-common -drf-spectacular==0.16.0 +drf-spectacular==0.26.5 # via -r requirements/ci.txt drf-yasg==1.21.7 # via @@ -514,6 +515,7 @@ tomli==2.0.1 # via # black # build + # pyproject-hooks uritemplate==4.1.1 # via # -r requirements/ci.txt diff --git a/src/objecttypes/tests/v1/test_schema.py b/src/objecttypes/tests/v1/test_schema.py new file mode 100644 index 00000000..e0b07335 --- /dev/null +++ b/src/objecttypes/tests/v1/test_schema.py @@ -0,0 +1,10 @@ +from rest_framework import status +from rest_framework.test import APITestCase + +from .utils import reverse + + +class APISchemaTest(APITestCase): + def test_schema_endoint(self): + response = self.client.get(reverse("schema-redoc")) + self.assertEqual(response.status_code, status.HTTP_200_OK) diff --git a/src/objecttypes/tests/v2/test_schema.py b/src/objecttypes/tests/v2/test_schema.py new file mode 100644 index 00000000..e0b07335 --- /dev/null +++ b/src/objecttypes/tests/v2/test_schema.py @@ -0,0 +1,10 @@ +from rest_framework import status +from rest_framework.test import APITestCase + +from .utils import reverse + + +class APISchemaTest(APITestCase): + def test_schema_endoint(self): + response = self.client.get(reverse("schema-redoc")) + self.assertEqual(response.status_code, status.HTTP_200_OK) diff --git a/src/objecttypes/utils/autoschema.py b/src/objecttypes/utils/autoschema.py index f29302ec..9faa4d7e 100644 --- a/src/objecttypes/utils/autoschema.py +++ b/src/objecttypes/utils/autoschema.py @@ -24,9 +24,13 @@ def get_override_parameters(self): parent_path_headers = self.get_parent_path_headers() return content_type_headers + parent_path_headers - def _get_response_for_code(self, serializer, status_code, media_types=None): + def _get_response_for_code( + self, serializer, status_code, media_types=None, direction="response" + ): """add default description to the response""" - response = super()._get_response_for_code(serializer, status_code, media_types) + response = super()._get_response_for_code( + serializer, status_code, media_types, direction + ) if not response.get("description"): response["description"] = HTTP_STATUS_CODE_TITLES.get(int(status_code))