Skip to content

Commit f4d826d

Browse files
committed
use component's reference for serializers without model
1 parent a800cea commit f4d826d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rest_framework/schemas/openapi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,8 +517,8 @@ def _get_request_body(self, path, method):
517517

518518
if not isinstance(serializer, serializers.Serializer):
519519
item_schema = {}
520-
elif hasattr(serializer, 'Meta') and hasattr(serializer.Meta, 'model'):
521-
# If the serializer uses a model, we should use a reference
520+
elif hasattr(serializer, 'Meta'):
521+
# If possible, the serializer should use a reference
522522
item_schema = self._get_reference(serializer)
523523
else:
524524
# There is no model, we'll map the serializer's fields

0 commit comments

Comments
 (0)