Fixed schema for UUIDField in SimpleMetadata. (#5872)

* fix schema for UUIDField

* Add unit test for d4c8f2db
This commit is contained in:
gthieleb 2018-03-13 15:49:15 +01:00 committed by Carlton Gibson
parent e3544f999e
commit 9e08a7cbec
2 changed files with 9 additions and 1 deletions

View File

@ -40,6 +40,7 @@ class SimpleMetadata(BaseMetadata):
serializers.BooleanField: 'boolean', serializers.BooleanField: 'boolean',
serializers.NullBooleanField: 'boolean', serializers.NullBooleanField: 'boolean',
serializers.CharField: 'string', serializers.CharField: 'string',
serializers.UUIDField: 'string',
serializers.URLField: 'url', serializers.URLField: 'url',
serializers.EmailField: 'email', serializers.EmailField: 'email',
serializers.RegexField: 'regex', serializers.RegexField: 'regex',

View File

@ -84,6 +84,7 @@ class TestMetadata:
) )
) )
nested_field = NestedField() nested_field = NestedField()
uuid_field = serializers.UUIDField(label="UUID field")
class ExampleView(views.APIView): class ExampleView(views.APIView):
"""Example view.""" """Example view."""
@ -172,7 +173,13 @@ class TestMetadata:
'label': 'B' 'label': 'B'
} }
} }
} },
'uuid_field': {
"type": "string",
"required": True,
"read_only": False,
"label": "UUID field",
},
} }
} }
} }