diff --git a/rest_framework/schemas.py b/rest_framework/schemas.py index ffaaa0f30..b9dce5400 100644 --- a/rest_framework/schemas.py +++ b/rest_framework/schemas.py @@ -564,8 +564,12 @@ class SchemaGenerator(object): Return a list of `coreapi.Field` instances corresponding to any 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'): return [] @@ -592,6 +596,9 @@ class SchemaGenerator(object): location = 'query' if isinstance(field, serializers.QueryParamField) else 'form' + if not method_allow_body and location != 'query': + continue + required = field.required and method != 'PATCH' field = coreapi.Field( name=field.field_name,