Skip to content

More docstrings #107

@jayvdb

Description

@jayvdb

Followup from #96 , now I am getting the following appear in my schema

six (6) times:

description: Concrete view for retrieving, updating a model instance.

24 times:

description: Concrete view for retrieving, updating or deleting a model instance.

And others

> grep 'Concrete view' public/schema.yaml | wc -l
73

Guess where they comes from... ;-)

django-rest-framework> git grep 'Concrete view'
rest_framework/generics.py:# Concrete view classes that provide method handlers
rest_framework/generics.py:    Concrete view for creating a model instance.
rest_framework/generics.py:    Concrete view for listing a queryset.
rest_framework/generics.py:    Concrete view for retrieving a model instance.
rest_framework/generics.py:    Concrete view for deleting a model instance.
rest_framework/generics.py:    Concrete view for updating a model instance.
rest_framework/generics.py:    Concrete view for listing a queryset or creating a model instance.
rest_framework/generics.py:    Concrete view for retrieving, updating a model instance.
rest_framework/generics.py:    Concrete view for retrieving or deleting a model instance.
rest_framework/generics.py:    Concrete view for retrieving, updating or deleting a model instance.

Maybe it is just some missing from the list of view bases in 57ecb4a

I suggest that instead of the very brittle approach of listing objects, drf-spectacular should have a list of importable namespaces that are blocked except when the exposed view as it appears in URLConf is from that namespace. rest_framework is clearly one of them, but it exposes a few views that are often include(..) into URLConf such as the login/etc. silk would be another, so it should be, so being configurable would be good.

The good news is that the previous change picked up the one good docstring which that previous issue was about, so thanks.

Another approach? Reject any docstring that would appear more than one in the API, because it is a clear indicator of bad docs , and inheritance is only one cause of bad docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions