def schema_serializer_class(serializer_class, **kwargs):
 def decorator(func):
  func.schema_serializer_class = serializer_class
  func.kwargs = kwargs
  return func
 return decorator

def schema_serializer_class ( serializer_class , ** kwargs ) : def decorator ( func ) : func . schema_serializer_class = serializer_class func . kwargs = kwargs return func return decorator
a decorator to set a serializer class in detail or list method of viewsets making it possible to extract the right serializer to generate the proper documentation .