mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-10 19:56:59 +03:00
Fixed schema for UUIDField in SimpleMetadata. (#5872)
* fix schema for UUIDField
* Add unit test for d4c8f2db
This commit is contained in:
parent
e3544f999e
commit
9e08a7cbec
|
@ -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',
|
||||||
|
|
|
@ -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",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user