-
Notifications
You must be signed in to change notification settings - Fork 271
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
django-filters emits warnings during schema generation #81
Comments
i had a quick look and it seems django-filters does not like being accessed without an request. maybe this is solved by always providing a mock request. i believe it happens on getting the queryset. we have "hacky" fallbacks for going around the queryset, which we do use on missing querysets. though imho the queryset it is still the most robust way extract info. i agree this is not pretty but we might not be able to prevent it without doing some horrible hacks. i'm not in favor or magically altering stdout/stderr behaviour to make those dissapear. at least not by default. that might lead to hard to debug problems. |
I have a WIP for this, but not polished enough to PR. Can have it ready by next week.
I am talking about stdlib |
there have been several improvements in that regard (global mocked requests). also there is improved |
there have been further improvements to |
Describe the bug
Very low priority, but worth starting to investigate..
If nothing else, the occurrence of these warnings is distracting, and not as informative as the warnings from drf-spectacular. Very likely they existing because of the way DRF core swagger support is/was built, and it is a useful warning for the benefit of people using the DRF core schema generation.
To Reproduce
I should be able to get a snippet if it is necessary, but it would probably be easier to replicate with a new sample meeting the criteria explained fairly easily based on the django-filters code which is getting triggered.
Expected behavior
Some of the time, but rarely it seems, drf-spectacular is doing a reasonable job despite django-filter saying there is a problem. I would need to study the generated schema more closely to understand this.
Other times, the warning from django-filters is appropriate, and drf-spectacular also emits a warning about the same thing.
Long term, the warning should be avoided because it is either redundant or incorrect. It could be avoided either by drf-spectacular pre-empting the same conditions and not invoking that code, or by filtering the warning in advance or reformatting it if it was an unexpected warning and include it in the warnings that drf-spectacular counts.
The text was updated successfully, but these errors were encountered: