From fb1b6dc4728432e93126abb236f1ba6b68dd61ff Mon Sep 17 00:00:00 2001 From: Lucas Paim Date: Thu, 11 May 2017 11:46:03 -0300 Subject: [PATCH] fix doc's for GET requisition --- rest_framework/schemas.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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,