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

Avoid instantiating classes in swagger_auto_schema when possible #1608

Merged
merged 1 commit into from
May 31, 2023

Conversation

mvandenburgh
Copy link
Member

As we discovered last week while discussing #1598, serializer classes used in the swagger_auto_schema decorator don't need to be instantiated; just passing the class itself is sufficient. Instantiating the class causes the __init__ constructor to be called, which in most cases has no negative impact, but has the potential to lead to strange bugs like we saw with the search serializer.

@mvandenburgh mvandenburgh merged commit 1d0dc9c into master May 31, 2023
@mvandenburgh mvandenburgh deleted the avoid-instantiating-serializer-classes branch May 31, 2023 15:16
@dandibot
Copy link
Member

dandibot commented Jun 6, 2023

🚀 PR was released in v0.3.39 🚀

@dandibot dandibot added the released This issue/pull request has been released. label Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants