From b1048984a7a839234ca604d199edbc9985c8a059 Mon Sep 17 00:00:00 2001 From: Kevin Brown Date: Thu, 9 Jan 2020 21:07:52 -0500 Subject: [PATCH] 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`. --- tests/schemas/test_openapi.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/schemas/test_openapi.py b/tests/schemas/test_openapi.py index 8a723b85d..6ad47359e 100644 --- a/tests/schemas/test_openapi.py +++ b/tests/schemas/test_openapi.py @@ -52,6 +52,8 @@ class TestFieldMapping(TestCase): (serializers.ListField(child=serializers.CharField()), {'items': {'type': 'string'}, 'type': 'array'}), (serializers.ListField(child=serializers.IntegerField(max_value=4294967295)), {'items': {'type': 'integer', 'format': 'int64'}, 'type': 'array'}), + (serializers.ListField(child=serializers.ChoiceField(choices=[('a', 'Choice A'), ('b', 'Choice B')])), + {'items': {'enum': ['a', 'b']}, 'type': 'array'}), (serializers.IntegerField(min_value=2147483648), {'type': 'integer', 'minimum': 2147483648, 'format': 'int64'}), ]