Skip to content

Commit

Permalink
Merge branch 'pr818'
Browse files Browse the repository at this point in the history
  • Loading branch information
tfranzel committed Sep 22, 2022
2 parents 536fac2 + 6973aa4 commit 0147d32
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 7 additions & 1 deletion drf_spectacular/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,13 @@ def _map_serializer_field(self, field, direction, bypass_extensions=False):

return append_meta(self._map_response_type_hint(method), meta)

if isinstance(field, (serializers.BooleanField, serializers.NullBooleanField)):
# NullBooleanField was removed in 3.14. Since 3.12.0 NullBooleanField was a subclass of BooleanField
if hasattr(serializers, "NullBooleanField"):
boolean_field_classes = (serializers.BooleanField, serializers.NullBooleanField)
else:
boolean_field_classes = (serializers.BooleanField,)

if isinstance(field, boolean_field_classes):
return append_meta(build_basic_type(OpenApiTypes.BOOL), meta)

if isinstance(field, serializers.JSONField):
Expand Down
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ envlist =
py39-lint,py39-docs,
{py36,py37,py38}-django{2.2}-drf{3.10,3.11},
{py37,py38,py39}-django{3.2}-drf{3.11,3.12},
{py38,py39,py310}-django{4.0,4.1}-drf{3.13},
{py38,py39,py310}-django{4.0,4.1}-drf{3.13,3.14},
py310-django4.1-drfmaster
py310-djangomaster-drf3.13
py310-djangomaster-drf3.14
py310-drfmaster-djangomaster
py310-drfmaster-djangomaster-allowcontribfail
skip_missing_interpreters = true
Expand All @@ -26,6 +26,7 @@ deps =
drf3.11: djangorestframework>=3.11,<3.12
drf3.12: djangorestframework>=3.12,<3.13
drf3.13: djangorestframework>=3.13,<3.14
drf3.14: djangorestframework>=3.14,<3.15

djangomaster: https://github.com/django/django/archive/main.tar.gz
drfmaster: https://github.com/encode/django-rest-framework/archive/master.tar.gz
Expand Down

0 comments on commit 0147d32

Please sign in to comment.