  
          if not hasattr(view, 'get_serializer'):
              return []
  
          serializer = view.get_serializer()
  
          if isinstance(serializer, serializers.ListSerializer):
              return [
                  coreapi.Field(
                      name='data',
 
</s> remove from rest_framework import serializers
 </s> add from rest_framework import exceptions, serializers
        try:
            serializer = view.get_serializer()
        except exceptions.APIException:
            serializer = None
            warnings.warn('{}.get_serializer() raised an exception during '
                          'schema generation. Serializer fields will not be '
                          'generated for {} {}.'.format(
                              type(view), method, path))
  
          if not hasattr(view, 'get_serializer'):
              return []
  
        try:
            serializer = view.get_serializer()
        except exceptions.APIException:
            serializer = None
            warnings.warn('{}.get_serializer() raised an exception during '
                          'schema generation. Serializer fields will not be '
                          'generated for {} {}.'.format(
                              type(view), method, path))
  
          if isinstance(serializer, serializers.ListSerializer):
              return [
                  coreapi.Field(
                      name='data',
keep keep keep keep replace keep keep keep keep keep
 Catch APIException in doc generation (#5443)

The documentation generator calls view.get_serializer() in order to
inspect it for documentation generation. However, if get_serializer()
throws an APIException (e.g. PermissionDenied), it doesn't get caught at
the call site, but instead propagates up and aborts the entire view.
With the try/except in this commit, the documentation generator instead
gratiously ignores that particular view and moves on to the next one
instead. Practical concequences of this commit is that the docs no
longer break if any view's get_serializer(..) throws an APIException. 
rest_framework/schemas/inspectors.py