              path = self.coerce_path(path, method, view)
              paths.append(path)
              view_endpoints.append((path, method, view))
  
          # Only generate the path prefix for paths that will be included
          if not paths:
              return None
          prefix = self.determine_path_prefix(paths)
  
          for path, method, view in view_endpoints:
              if not self.has_view_permissions(path, method, view):
                  continue
              link = view.schema.get_link(path, method, base_url=self.url)
 
</s> remove         for path, method, view in view_endpoints:
            if not self.has_view_permissions(path, method, view):
                continue
            link = view.schema.get_link(path, method, base_url=self.url)
            subpath = path[len(prefix):]
            keys = self.get_keys(subpath, method, view)
            insert_into(links, keys, link)
 </s> add     def create_view(self, callback, method, request=None):
        """
        Given a callback, return an actual view instance.
        """
        view = callback.cls(**getattr(callback, 'initkwargs', {}))
        view.args = ()
        view.kwargs = {}
        view.format_kwarg = None
        view.request = None
        view.action_map = getattr(callback, 'actions', None) </s> remove         links = LinkNode()

        # Generate (path, method, view) given (path, method, callback).
 </s> add  </s> remove         Return a dictionary containing all the links that should be
        included in the API schema.
 </s> add         Generate (path, method, view) given (path, method, callback) for paths. </s> remove         return links
 </s> add         actions = getattr(callback, 'actions', None)
        if actions is not None:
            if method == 'OPTIONS':
                view.action = 'metadata'
            else:
                view.action = actions.get(method.lower())

        if request is not None:
            view.request = clone_request(request, method)

        return view

    def coerce_path(self, path, method, view):
        """
        Coerce {pk} path arguments into the name of the model field,
        where possible. This is cleaner for an external representation.
        (Ie. "this is an identifier", not "this is a database primary key")
        """
        if not self.coerce_path_pk or '{pk}' not in path:
            return path
        model = getattr(getattr(view, 'queryset', None), 'model', None)
        if model:
            field_name = get_pk_name(model)
        else:
            field_name = 'id'
        return path.replace('{pk}', '{%s}' % field_name) </s> remove     def create_view(self, callback, method, request=None):
        """
        Given a callback, return an actual view instance.
        """
        view = callback.cls(**getattr(callback, 'initkwargs', {}))
        view.args = ()
        view.kwargs = {}
        view.format_kwarg = None
        view.request = None
        view.action_map = getattr(callback, 'actions', None)

        actions = getattr(callback, 'actions', None)
        if actions is not None:
            if method == 'OPTIONS':
                view.action = 'metadata'
            else:
                view.action = actions.get(method.lower())

        if request is not None:
            view.request = clone_request(request, method)

        return view

 </s> add 
        return paths, view_endpoints
              path = self.coerce_path(path, method, view)
              paths.append(path)
              view_endpoints.append((path, method, view))
  
        return paths, view_endpoints
        return paths, view_endpoints
        return paths, view_endpoints
        return paths, view_endpoints
  
          for path, method, view in view_endpoints:
              if not self.has_view_permissions(path, method, view):
                  continue
              link = view.schema.get_link(path, method, base_url=self.url)
keep keep keep keep replace replace replace replace keep keep keep keep keep
 Added OpenAPI Schema Generation. (#6532)

Co-authored-by: Lucidiot <lucidiot@protonmail.com>
Co-authored-by: dongfangtianyu <dongfangtianyu@qq.com> 
rest_framework/schemas/generators.py