Open CDavantzis opened 5 years ago
As DJA we support BrowsableAPIRenderer
so using the different filter backend should work. I haven't looked into it in detail so not sure whether you fix is the only solution. Feel free thought to work on a PR also with a reproducing test.
In terms of format
parameter see discussion in #535
If a viewset is using the filter backend
rest_framework_json_api.filters.QueryParameterValidationFilter
the server will throw a 500 error when an invalid parameter is provided and the response is being rendered usingrest_framework.renderers.BrowsableAPIRenderer
.The below code snippet is one way to fix the issue.
It may be in the scope of this project to add this fix to
rest_framework_json_api.renderers
or mention it in the documentation.There are other issues with allowing the BrowsableApiRenderer with the QueryParameterValidationFilter such as the 'format' option the browsable api provides.
Users can use the above fix to allow
format
, however they may want to do something more complex such as overridingQueryParameterValidationFilter.validate_query_params
so that it uses a different query_regex based on the if the view is a subclass ofrest_framework.renderers.BrowsableAPIRenderer