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

AttributeError when checking for NullBooleanField in schema generator with DRF 3.14 #816

Closed
MHLut opened this issue Sep 22, 2022 · 4 comments
Labels
bug Something isn't working fix confirmation pending issue has been fixed and confirmation from issue reporter is pending

Comments

@MHLut
Copy link

MHLut commented Sep 22, 2022

Describe the bug
DRF removed NullBooleanField between version 3.13.1 and 3.14.0

Class AutoSchema in openapi.py has an instance check for NullBooleanField which results in an AttributeError ("AttributeError when checking for NullBooleanField in schema generator").

To Reproduce
Register schema endpoints and try to open one of the UIs (Swagger or Redoc):

For example

from django.urls import path
from drf_spectacular.views import SpectacularAPIView

app_name = "api"

urlpatterns = [
    path("schema/", SpectacularAPIView.as_view(), name="schema"),
]

Redoc URL will be something like <host>/api/schema/redoc/ if you registered these URLs under /api/. Opening the page shows the Django error page in the browser.

Expected behavior
Remove the NullBooleanCheck for newer versions of DRF, but keep it for older versions.

@miko13
Copy link

miko13 commented Sep 22, 2022

hopefully the fix pr will be merged soon and there will be a release!

@tfranzel tfranzel added bug Something isn't working fix confirmation pending issue has been fixed and confirmation from issue reporter is pending labels Sep 22, 2022
@tfranzel
Copy link
Owner

Reopening so people can discover this more easily.

The fix #818 is already merged. A new patch release (0.24.1) is coming shortly.

@tfranzel tfranzel reopened this Sep 22, 2022
@tfranzel
Copy link
Owner

0.24.1 just got released. cheers!

@romeopeter
Copy link

You may have to update DRF and drf_spectacular

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fix confirmation pending issue has been fixed and confirmation from issue reporter is pending
Projects
None yet
Development

No branches or pull requests

4 participants