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

MPP-3786: Add type hints, make changes for browsable API #4590

Merged
merged 5 commits into from
Apr 17, 2024

Conversation

jwhitlock
Copy link
Member

@jwhitlock jwhitlock commented Apr 11, 2024

Make changes to make drf_spectacular a bit happier.

How to test:

  • Run ./manage.py check --deploy on main. See lots of drf_spectacular.W001 and drf_spectacular.W002 warnings.
  • Run ./manage.py check --deploy on this branch. See no drf_spectacular.W001 warnings, but drf_spectacular.W002 warnings remain.

@jwhitlock jwhitlock marked this pull request as draft April 11, 2024 17:00
These properties are used in the API, and the hints are used by
drf_spectacular for documentation.

This includes the suggest change in Profile.emails_replied to use the
default=0 parameter available in Django 4.2.
Add type annotations and return Model.objects.none(), so that
drf_spectacular can determine the QuerySet type outside of an
authenticated request.
@jwhitlock jwhitlock force-pushed the browsable-api-mpp-3786 branch from 65a07b9 to 518bba9 Compare April 11, 2024 18:27
@jwhitlock jwhitlock marked this pull request as ready for review April 11, 2024 18:45
Copy link
Member

@groovecoder groovecoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question (blocking): are you sure it's the drf_spectacular.W002 warnings that are supposed to go away? When I ran the check on this branch, all the drf_spectacular.W001 warnings went away, but the W002 warnings are still there.

@jwhitlock
Copy link
Member Author

🤦 yep, you are correct, it is the W001 warnings that go away. I'll fix the comment.

@jwhitlock jwhitlock requested a review from groovecoder April 15, 2024 16:01
@@ -0,0 +1,39 @@
"""Schema Extensions for drf-spectacular"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwhitlock jwhitlock added this pull request to the merge queue Apr 17, 2024
Merged via the queue into main with commit f1214e3 Apr 17, 2024
27 checks passed
@jwhitlock jwhitlock deleted the browsable-api-mpp-3786 branch April 17, 2024 15:37
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

Successfully merging this pull request may close these issues.

2 participants