Skip to content

Commit b104898

Browse files
kevin-browncarltongibson
authored andcommitted
Add failing test for ListField schema generation
The `ListField` was generating a schema that contained `type=None` when a `ChoiceField` was the child, since we are not currently able to introspect the type of a `ChoiceField`.
1 parent 496947b commit b104898

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tests/schemas/test_openapi.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ def test_list_field_mapping(self):
5252
(serializers.ListField(child=serializers.CharField()), {'items': {'type': 'string'}, 'type': 'array'}),
5353
(serializers.ListField(child=serializers.IntegerField(max_value=4294967295)),
5454
{'items': {'type': 'integer', 'format': 'int64'}, 'type': 'array'}),
55+
(serializers.ListField(child=serializers.ChoiceField(choices=[('a', 'Choice A'), ('b', 'Choice B')])),
56+
{'items': {'enum': ['a', 'b']}, 'type': 'array'}),
5557
(serializers.IntegerField(min_value=2147483648),
5658
{'type': 'integer', 'minimum': 2147483648, 'format': 'int64'}),
5759
]

0 commit comments

Comments
 (0)