Rename swagger_serializer_method parameter and update docs
This commit is contained in:
@@ -459,8 +459,8 @@ def get_basic_type_info_from_hint(hint_class):
|
||||
|
||||
|
||||
class SerializerMethodFieldInspector(FieldInspector):
|
||||
"""Provides conversion for SerializerMethodField, optionally using information from the swagger_method_field
|
||||
decorator
|
||||
"""Provides conversion for SerializerMethodField, optionally using information from the swagger_serializer_method
|
||||
decorator.
|
||||
"""
|
||||
|
||||
def field_to_swagger_object(self, field, swagger_object_type, use_references, **kwargs):
|
||||
|
||||
@@ -178,18 +178,18 @@ def swagger_auto_schema(method=None, methods=None, auto_schema=unset, request_bo
|
||||
return decorator
|
||||
|
||||
|
||||
def swagger_serializer_method(serializer):
|
||||
def swagger_serializer_method(serializer_or_field):
|
||||
"""
|
||||
Decorates the method of a serializers.SerializerMethodField
|
||||
to hint as to how Swagger should be generated for this field.
|
||||
|
||||
:param serializer: serializer class or instance
|
||||
:param serializer_or_field: ``Serializer``/``Field`` class or instance
|
||||
:return:
|
||||
"""
|
||||
|
||||
def decorator(serializer_method):
|
||||
# stash the serializer for SerializerMethodFieldInspector to find
|
||||
serializer_method._swagger_serializer = serializer
|
||||
serializer_method._swagger_serializer = serializer_or_field
|
||||
return serializer_method
|
||||
|
||||
return decorator
|
||||
|
||||
Reference in New Issue
Block a user