-
Notifications
You must be signed in to change notification settings - Fork 273
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
Overriding @extend_schema
decorator in inherited class does not override exclude=True
#1025
Comments
Hi @dashdanw, that was indeed a gap in the interface. The last one I hope 😄 Thanks for offering to do a PR, but while trying to figure out the exact problem, I already implemented the fix. |
bugfix exclude behavior on subclassing #1025
tfranzel I just wanted to extend a thanks, I rely on this package at work and this is actually huge for me. I'll continue to try to submit useful issues and hopefully I'll be able to contribute! |
I just hit this bug and IMHO it's not quite fixed.
I'd expect this to generate the "SomeAdminView" endpoint in my swagger, but it won't. I must explicitly add |
Hey @alexandernst, I get your point but I would argue that it is not a bug.
Not entirely true, because the decorator argument is tri-state. The default is So you basically exclude all endpoints in tldr: I think explicit is better than implicit, and a change would break consistency. I am for leaving it as is. |
The problem (in this case's scenario) is that it's not immediately clear (to me?) that inheriting from The rest of your statement is true (and I could agree with it). It's just that I wasn't expecting this inheriting behavior. |
hehe... in the beginning when this was not a feature yet, people complained that not also inheriting the decorators would be unexpected and weird. 😄 As you see, users come with different use-cases/mindsets and thus have different expectations. I would say it currently is very close to what you would expect from regular idiomatic python code in terms of what would be inherited and how. We just had to take the concept one step further to maintain internal consistency. |
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 includedTo Reproduce
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
The text was updated successfully, but these errors were encountered: