mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 03:23:59 +03:00
Skip HiddenField from Schema fields (#4429)
This commit is contained in:
parent
d540f0262b
commit
d0ed482d70
|
@ -296,8 +296,9 @@ class SchemaGenerator(object):
|
|||
|
||||
fields = []
|
||||
for field in serializer.fields.values():
|
||||
if field.read_only:
|
||||
if field.read_only or isinstance(field, serializers.HiddenField):
|
||||
continue
|
||||
|
||||
required = field.required and method != 'PATCH'
|
||||
description = force_text(field.help_text) if field.help_text else ''
|
||||
field = coreapi.Field(
|
||||
|
|
|
@ -26,6 +26,8 @@ class ExamplePagination(pagination.PageNumberPagination):
|
|||
class ExampleSerializer(serializers.Serializer):
|
||||
a = serializers.CharField(required=True, help_text='A field description')
|
||||
b = serializers.CharField(required=False)
|
||||
read_only = serializers.CharField(read_only=True)
|
||||
hidden = serializers.HiddenField(default='hello')
|
||||
|
||||
|
||||
class AnotherSerializer(serializers.Serializer):
|
||||
|
|
Loading…
Reference in New Issue
Block a user