Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing SwaggerAutoSchema removes the custom DRF parameter DEFAULT_AUTHENTICATION_CLASSES #842

Open
hntirgeam opened this issue Mar 3, 2023 · 0 comments

Comments

@hntirgeam
Copy link

Bug Report

Importing SwaggerAutoSchema removes the custom DRF parameter DEFAULT_AUTHENTICATION_CLASSES

Am I missing something?

Description

Importing SwaggerAutoSchema anywhere in the project removes the custom DRF parameter DEFAULT_AUTHENTICATION_CLASSES.

I imported it to overload some behavior that generates docstring.

Is this a regression?

Not sure

Minimal Reproduction

Using custom auth class in the DRF settings

REST_FRAMEWORK = {
    "DEFAULT_AUTHENTICATION_CLASSES": (
        "user.authentication.CustomOAuth2Authentication",
    )
}

Import class anywhere in project code

from drf_yasg.inspectors.view import SwaggerAutoSchema

Inspecting base APIView class in DRF source code (method get_authenticators)

I can clearly trace that before the import there was:

[<class 'user.authentication.CustomOAuth2Authentication'>]

and after the import there are:

[<class 'rest_framework.authentication.SessionAuthentication'>, <class 'rest_framework.authentication.BasicAuthentication'>]

Your Environment

drf-yasg==1.21.5
djangorestframework==3.14.0
Django==3.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant