Skip to content

Overriding @extend_schema decorator in inherited class does not override exclude=True #1025

@dashdanw

Description

@dashdanw

Describe the bug
If a base view or viewset class is decorated with @extend_schema(exclude=True) any inherited class will be excluded as well, and overriding by decorating that class with @extend_schema(exclude=False) does not seem to enable it to be included

To Reproduce

class AuthorizationMixin(APIView):
    # a view that requires that a user be logged in
    authentication_classes = [SomeAuthenticationClass,]

@extend_schema(exclude=True)
class SomeView(APIView):
    pass

@extend_schema(exclude=False)
class SomeAdminView(AuthorizationMixin, SomeView):
   # this class will be excluded from the documentation

Expected behavior
An inheriting class should be able to override the configuration of it's base class, in our implementation the base class is used as an endpoint as well which we DO want excluded.

as a note if given direction I would be happy to take a look at this and make a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfix confirmation pendingissue has been fixed and confirmation from issue reporter is pending

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions