ListField mapping should map all options for the child

Previously it was only mapping the `type` and `format`, even though
for some field types (like a `MultipleChoiceField`) we map more
than just these. And for some fields (like a `ChoiceField`) we do
not map the `type` at all.
This commit is contained in:
Kevin Brown 2020-01-09 20:43:44 -05:00 committed by Carlton Gibson
parent b1048984a7
commit 98c8af5291

View File

@ -259,13 +259,7 @@ class AutoSchema(ViewInspector):
'items': {}, 'items': {},
} }
if not isinstance(field.child, _UnvalidatedField): if not isinstance(field.child, _UnvalidatedField):
map_field = self._map_field(field.child) mapping['items'] = self._map_field(field.child)
items = {
"type": map_field.get('type')
}
if 'format' in map_field:
items['format'] = map_field.get('format')
mapping['items'] = items
return mapping return mapping
# DateField and DateTimeField type is string # DateField and DateTimeField type is string