mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 04:50:12 +03:00
Support nested serializers in SimpleMetadata's representation of metadata
With this commit, nested serializer fields in the representation done by SimpleMetadata class are getting a type of 'serializer' and a 'fields' attribute containing metadata for their inner fields.
This commit is contained in:
parent
859c20804c
commit
91f825d755
|
@ -34,6 +34,7 @@ class SimpleMetadata(BaseMetadata):
|
|||
for us to base this on.
|
||||
"""
|
||||
label_lookup = ClassLookupDict({
|
||||
serializers.Serializer: 'serializer',
|
||||
serializers.Field: 'field',
|
||||
serializers.BooleanField: 'boolean',
|
||||
serializers.NullBooleanField: 'boolean',
|
||||
|
@ -136,4 +137,7 @@ class SimpleMetadata(BaseMetadata):
|
|||
for choice_value, choice_name in field.choices.items()
|
||||
]
|
||||
|
||||
if isinstance(field, serializers.Serializer):
|
||||
field_info['fields'] = self.get_serializer_info(field)
|
||||
|
||||
return field_info
|
||||
|
|
Loading…
Reference in New Issue
Block a user