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

Document OpenApiAuthenticationExtension priority property #106

Closed
savitmk opened this issue Jun 26, 2020 · 1 comment
Closed

Document OpenApiAuthenticationExtension priority property #106

savitmk opened this issue Jun 26, 2020 · 1 comment

Comments

@savitmk
Copy link

savitmk commented Jun 26, 2020

I have subclassed OpenApiAuthenticationExtension to document an authentication class which subclasses rest_framework.authentication.TokenAuthentication.

Because there is an existing authentication extension for TokenAuthentication in this codebase -

class TokenScheme(OpenApiAuthenticationExtension):
- there are multiple matches here -
def get_match(cls, target) -> Optional[T]:

It is not documented - https://drf-spectacular.readthedocs.io/en/latest/customization.html#specify-authentication-with-openapiauthenticationextension - that user authentication extensions which conflict with this library's authentication extensions require setting a higher priority.

Alternatively/additionally, the default priority could be 0 while this library's authentication extensions have a negative priority, so that as a user writing an authentication extension, my extension would be preferred by default.

Thank you again!

@tfranzel
Copy link
Owner

that should do it. though if subclassing the built-in extensions, you still need to raise the -1. added a info box to the doc for that.

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

2 participants