mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 20:40:14 +03:00
add QueryParamField support to auto-generated documentation
This commit is contained in:
parent
a251b93792
commit
cc119d6d3d
|
@ -767,6 +767,10 @@ class CharField(Field):
|
|||
return six.text_type(value)
|
||||
|
||||
|
||||
class QueryParamField(CharField):
|
||||
pass
|
||||
|
||||
|
||||
class EmailField(CharField):
|
||||
default_error_messages = {
|
||||
'invalid': _('Enter a valid email address.')
|
||||
|
|
|
@ -590,10 +590,12 @@ class SchemaGenerator(object):
|
|||
if field.read_only or isinstance(field, serializers.HiddenField):
|
||||
continue
|
||||
|
||||
location = 'query' if isinstance(field, serializers.QueryParamField) else 'form'
|
||||
|
||||
required = field.required and method != 'PATCH'
|
||||
field = coreapi.Field(
|
||||
name=field.field_name,
|
||||
location='form',
|
||||
location=location,
|
||||
required=required,
|
||||
schema=field_to_schema(field)
|
||||
)
|
||||
|
|
|
@ -57,7 +57,7 @@ from rest_framework.fields import ( # NOQA # isort:skip
|
|||
DictField, DurationField, EmailField, Field, FileField, FilePathField, FloatField,
|
||||
HiddenField, IPAddressField, ImageField, IntegerField, JSONField, ListField,
|
||||
ModelField, MultipleChoiceField, NullBooleanField, ReadOnlyField, RegexField,
|
||||
SerializerMethodField, SlugField, TimeField, URLField, UUIDField,
|
||||
SerializerMethodField, SlugField, TimeField, URLField, UUIDField, QueryParamField,
|
||||
)
|
||||
from rest_framework.relations import ( # NOQA # isort:skip
|
||||
HyperlinkedIdentityField, HyperlinkedRelatedField, ManyRelatedField,
|
||||
|
|
Loading…
Reference in New Issue
Block a user