-
Notifications
You must be signed in to change notification settings - Fork 771
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
fix openapi fields rendering for range type filters #1323
fix openapi fields rendering for range type filters #1323
Conversation
This will be followed up with tests + a fix for my use of f-strings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @A-Ashiq. Here you're adjusting the old CoreAPI generation, rather than the OpenAPI fields that we need.
* A new view under `/eox-tagging/api-docs` can be used to interact with the REST API * Added descriptions of all the parameters and methods used by the API * Included a backport fix for [django-filter](carltongibson/django-filter#1323)
* A new view under `/eox-tagging/api-docs` can be used to interact with the REST API * Added descriptions of all the parameters and methods used by the API * Included a backport fix for carltongibson/django-filter#1323
@carltongibson can this be reviewed again? |
Hi. Is there any news about this? |
Hi. Any news on this? Why the PR cannot be merged? This will help a lot. Thank you! |
As per #1432 the in-built schema support is going to be deprecated in the next version. Rather, I recommend you migrate to use https://drf-spectacular.readthedocs.io/en/latest/readme.html If for some reason you're not able to use Thanks. |
This fix is aimed at Issue 1292.
Within the
get_schema_fields
method onDjangoFilterBackend
. The coreapi field named tuples are made by looping over the filters retrieved from the filterset class. This change adds a check to see if there is widget which has been declared which in turn will provide us with the suffixes used to build range type fields. If nosuffixes
have been declared or the list is empty, then a single field will be rendered as normal with reference to thefield_name
.For example, the
DateFromToRangeFilter
requires 2 fields to be rendered on swagger. If say the field name iscreated_at
then we would expectcreated_at_after
andcreated_at_before
to be rendered. The current implementation will only render a single field ascreated_at
which won't work.