mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 04:50:12 +03:00
fix doc's for GET requisition
This commit is contained in:
parent
afabebcaab
commit
fb1b6dc472
|
@ -564,8 +564,12 @@ class SchemaGenerator(object):
|
||||||
Return a list of `coreapi.Field` instances corresponding to any
|
Return a list of `coreapi.Field` instances corresponding to any
|
||||||
request body input, as determined by the serializer class.
|
request body input, as determined by the serializer class.
|
||||||
"""
|
"""
|
||||||
if method not in ('PUT', 'GET', 'PATCH', 'POST'):
|
|
||||||
return []
|
if hasattr(view, 'action') and view.action == 'add_item':
|
||||||
|
pass
|
||||||
|
|
||||||
|
body_allowed_methods = ('PUT', 'PATCH', 'POST')
|
||||||
|
method_allow_body = method in body_allowed_methods
|
||||||
|
|
||||||
if not hasattr(view, 'get_serializer'):
|
if not hasattr(view, 'get_serializer'):
|
||||||
return []
|
return []
|
||||||
|
@ -592,6 +596,9 @@ class SchemaGenerator(object):
|
||||||
|
|
||||||
location = 'query' if isinstance(field, serializers.QueryParamField) else 'form'
|
location = 'query' if isinstance(field, serializers.QueryParamField) else 'form'
|
||||||
|
|
||||||
|
if not method_allow_body and location != 'query':
|
||||||
|
continue
|
||||||
|
|
||||||
required = field.required and method != 'PATCH'
|
required = field.required and method != 'PATCH'
|
||||||
field = coreapi.Field(
|
field = coreapi.Field(
|
||||||
name=field.field_name,
|
name=field.field_name,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user