{"action":"created","comment":{"url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/pulls/comments/209632373","pull_request_review_id":145682218,"id":209632373,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwOTYzMjM3Mw==","diff_hunk":"@@ -0,0 +1,148 @@\n+from django.db.models.sql.constants import ORDER_PATTERN\n+from django_filters.rest_framework import DjangoFilterBackend\n+from rest_framework.exceptions import ValidationError\n+from rest_framework.filters import (BaseFilterBackend, OrderingFilter,\n+                                    SearchFilter)\n+from rest_framework.settings import api_settings\n+\n+\n+class JsonApiFilterMixin(object):\n+    \"\"\"\n+    class to share data among filtering backends\n+    \"\"\"\n+    jsonapi_query_keywords = ('sort', 'filter', 'fields', 'page', 'include')\n+    search_param = api_settings.SEARCH_PARAM\n+    ordering_param = 'sort'\n+\n+    def __init__(self):\n+        self.filter_keys = []\n+\n+\n+class JsonApiQueryValidationFilter(JsonApiFilterMixin, BaseFilterBackend):\n+    \"\"\"","path":"rest_framework_json_api/backends.py","position":null,"original_position":22,"commit_id":"12cca8d693d3dde68af30bf6a821ef0c7606abd7","original_commit_id":"5fdb05e2318b5cbeee046537ca5129f5515fd268","user":{"login":"n2ygk","id":4356471,"node_id":"MDQ6VXNlcjQzNTY0NzE=","avatar_url":"https://avatars1.githubusercontent.com/u/4356471?v=4","gravatar_id":"","url":"https://api.github.com/users/n2ygk","html_url":"https://github.com/n2ygk","followers_url":"https://api.github.com/users/n2ygk/followers","following_url":"https://api.github.com/users/n2ygk/following{/other_user}","gists_url":"https://api.github.com/users/n2ygk/gists{/gist_id}","starred_url":"https://api.github.com/users/n2ygk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n2ygk/subscriptions","organizations_url":"https://api.github.com/users/n2ygk/orgs","repos_url":"https://api.github.com/users/n2ygk/repos","events_url":"https://api.github.com/users/n2ygk/events{/privacy}","received_events_url":"https://api.github.com/users/n2ygk/received_events","type":"User","site_admin":false},"body":"@sliverc FYI - I've closed the PR while I keep working on this. Do we want to create an experiment branch so others can test/contribute?\r\n\r\nBTW, using DjangoFilterBackend adds a new dependency for `django-filter`. That could be a problem. It's not core Django or DRF but is the top-rated filtering package and the one reference from DRF docs.","created_at":"2018-08-13T14:34:26Z","updated_at":"2018-08-13T14:34:26Z","html_url":"https://github.com/django-json-api/django-rest-framework-json-api/pull/455#discussion_r209632373","pull_request_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/pulls/455","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/pulls/comments/209632373"},"html":{"href":"https://github.com/django-json-api/django-rest-framework-json-api/pull/455#discussion_r209632373"},"pull_request":{"href":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/pulls/455"}},"in_reply_to_id":208838785},"pull_request":{"url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/pulls/455","id":207169733,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA3MTY5NzMz","html_url":"https://github.com/django-json-api/django-rest-framework-json-api/pull/455","diff_url":"https://github.com/django-json-api/django-rest-framework-json-api/pull/455.diff","patch_url":"https://github.com/django-json-api/django-rest-framework-json-api/pull/455.patch","issue_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/issues/455","number":455,"state":"closed","locked":false,"title":"WIP: Filter Backends","user":{"login":"n2ygk","id":4356471,"node_id":"MDQ6VXNlcjQzNTY0NzE=","avatar_url":"https://avatars1.githubusercontent.com/u/4356471?v=4","gravatar_id":"","url":"https://api.github.com/users/n2ygk","html_url":"https://github.com/n2ygk","followers_url":"https://api.github.com/users/n2ygk/followers","following_url":"https://api.github.com/users/n2ygk/following{/other_user}","gists_url":"https://api.github.com/users/n2ygk/gists{/gist_id}","starred_url":"https://api.github.com/users/n2ygk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n2ygk/subscriptions","organizations_url":"https://api.github.com/users/n2ygk/orgs","repos_url":"https://api.github.com/users/n2ygk/repos","events_url":"https://api.github.com/users/n2ygk/events{/privacy}","received_events_url":"https://api.github.com/users/n2ygk/received_events","type":"User","site_admin":false},"body":"Fixes # \r\n\r\n## Description of the Change\r\n* Add optional [jsonapi-style](http://jsonapi.org/format/) filter backends. See [usage docs](docs/usage.md#filter-backends)\r\n  * query parameter validation -- raises 400 errors rather than silently ignoring \"bad\" parameters\r\n  * sort - based on `rest_framework.filters.OrderingFilter`\r\n  * keyword filter across multiple fields based on `rest_framework.filters.SearchFilter`\r\n  * field-level filter based on `django_filters.rest_framework.DjangoFilterBackend`\r\n\r\nThis is an initial draft for your feedback/suggestions. Still no unit tests, and a couple of gaps in the implementation.\r\n\r\n## Checklist\r\n\r\n- [x] PR only contains one change (considered splitting up PR)\r\n- [ ] unit-test added\r\n- [x] documentation updated\r\n- [x] changelog entry added to `CHANGELOG.md`\r\n- [x] author name in `AUTHORS`\r\n","created_at":"2018-08-09T00:04:28Z","updated_at":"2018-08-13T14:34:26Z","closed_at":"2018-08-12T21:40:58Z","merged_at":null,"merge_commit_sha":"d0b3beb006bcc6ca9b20cf50435526be287d2fb0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/pulls/455/commits","review_comments_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/pulls/455/comments","review_comment_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/issues/455/comments","statuses_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/statuses/12cca8d693d3dde68af30bf6a821ef0c7606abd7","head":{"label":"n2ygk:backends","ref":"backends","sha":"12cca8d693d3dde68af30bf6a821ef0c7606abd7","user":{"login":"n2ygk","id":4356471,"node_id":"MDQ6VXNlcjQzNTY0NzE=","avatar_url":"https://avatars1.githubusercontent.com/u/4356471?v=4","gravatar_id":"","url":"https://api.github.com/users/n2ygk","html_url":"https://github.com/n2ygk","followers_url":"https://api.github.com/users/n2ygk/followers","following_url":"https://api.github.com/users/n2ygk/following{/other_user}","gists_url":"https://api.github.com/users/n2ygk/gists{/gist_id}","starred_url":"https://api.github.com/users/n2ygk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n2ygk/subscriptions","organizations_url":"https://api.github.com/users/n2ygk/orgs","repos_url":"https://api.github.com/users/n2ygk/repos","events_url":"https://api.github.com/users/n2ygk/events{/privacy}","received_events_url":"https://api.github.com/users/n2ygk/received_events","type":"User","site_admin":false},"repo":{"id":120525043,"node_id":"MDEwOlJlcG9zaXRvcnkxMjA1MjUwNDM=","name":"django-rest-framework-json-api","full_name":"n2ygk/django-rest-framework-json-api","owner":{"login":"n2ygk","id":4356471,"node_id":"MDQ6VXNlcjQzNTY0NzE=","avatar_url":"https://avatars1.githubusercontent.com/u/4356471?v=4","gravatar_id":"","url":"https://api.github.com/users/n2ygk","html_url":"https://github.com/n2ygk","followers_url":"https://api.github.com/users/n2ygk/followers","following_url":"https://api.github.com/users/n2ygk/following{/other_user}","gists_url":"https://api.github.com/users/n2ygk/gists{/gist_id}","starred_url":"https://api.github.com/users/n2ygk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/n2ygk/subscriptions","organizations_url":"https://api.github.com/users/n2ygk/orgs","repos_url":"https://api.github.com/users/n2ygk/repos","events_url":"https://api.github.com/users/n2ygk/events{/privacy}","received_events_url":"https://api.github.com/users/n2ygk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/n2ygk/django-rest-framework-json-api","description":"JSON API support for Django REST Framework","fork":true,"url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api","forks_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/forks","keys_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/teams","hooks_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/hooks","issue_events_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/issues/events{/number}","events_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/events","assignees_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/assignees{/user}","branches_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/branches{/branch}","tags_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/tags","blobs_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/statuses/{sha}","languages_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/languages","stargazers_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/stargazers","contributors_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/contributors","subscribers_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/subscribers","subscription_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/subscription","commits_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/contents/{+path}","compare_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/merges","archive_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/downloads","issues_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/issues{/number}","pulls_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/pulls{/number}","milestones_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/milestones{/number}","notifications_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/labels{/name}","releases_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/releases{/id}","deployments_url":"https://api.github.com/repos/n2ygk/django-rest-framework-json-api/deployments","created_at":"2018-02-06T21:25:04Z","updated_at":"2018-08-08T20:05:11Z","pushed_at":"2018-08-12T21:41:36Z","git_url":"git://github.com/n2ygk/django-rest-framework-json-api.git","ssh_url":"git@github.com:n2ygk/django-rest-framework-json-api.git","clone_url":"https://github.com/n2ygk/django-rest-framework-json-api.git","svn_url":"https://github.com/n2ygk/django-rest-framework-json-api","homepage":"http://django-rest-framework-json-api.readthedocs.org/","size":984,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"bsd-2-clause","name":"BSD 2-Clause \"Simplified\" License","spdx_id":"BSD-2-Clause","url":"https://api.github.com/licenses/bsd-2-clause","node_id":"MDc6TGljZW5zZTQ="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"django-json-api:master","ref":"master","sha":"3bfff93deb003907fa7640378833c48d1326f531","user":{"login":"django-json-api","id":11215076,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMjE1MDc2","avatar_url":"https://avatars1.githubusercontent.com/u/11215076?v=4","gravatar_id":"","url":"https://api.github.com/users/django-json-api","html_url":"https://github.com/django-json-api","followers_url":"https://api.github.com/users/django-json-api/followers","following_url":"https://api.github.com/users/django-json-api/following{/other_user}","gists_url":"https://api.github.com/users/django-json-api/gists{/gist_id}","starred_url":"https://api.github.com/users/django-json-api/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/django-json-api/subscriptions","organizations_url":"https://api.github.com/users/django-json-api/orgs","repos_url":"https://api.github.com/users/django-json-api/repos","events_url":"https://api.github.com/users/django-json-api/events{/privacy}","received_events_url":"https://api.github.com/users/django-json-api/received_events","type":"Organization","site_admin":false},"repo":{"id":21987374,"node_id":"MDEwOlJlcG9zaXRvcnkyMTk4NzM3NA==","name":"django-rest-framework-json-api","full_name":"django-json-api/django-rest-framework-json-api","owner":{"login":"django-json-api","id":11215076,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMjE1MDc2","avatar_url":"https://avatars1.githubusercontent.com/u/11215076?v=4","gravatar_id":"","url":"https://api.github.com/users/django-json-api","html_url":"https://github.com/django-json-api","followers_url":"https://api.github.com/users/django-json-api/followers","following_url":"https://api.github.com/users/django-json-api/following{/other_user}","gists_url":"https://api.github.com/users/django-json-api/gists{/gist_id}","starred_url":"https://api.github.com/users/django-json-api/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/django-json-api/subscriptions","organizations_url":"https://api.github.com/users/django-json-api/orgs","repos_url":"https://api.github.com/users/django-json-api/repos","events_url":"https://api.github.com/users/django-json-api/events{/privacy}","received_events_url":"https://api.github.com/users/django-json-api/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/django-json-api/django-rest-framework-json-api","description":"JSON API support for Django REST Framework","fork":false,"url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api","forks_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/forks","keys_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/teams","hooks_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/hooks","issue_events_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/issues/events{/number}","events_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/events","assignees_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/assignees{/user}","branches_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/branches{/branch}","tags_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/tags","blobs_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/statuses/{sha}","languages_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/languages","stargazers_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/stargazers","contributors_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/contributors","subscribers_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/subscribers","subscription_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/subscription","commits_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/contents/{+path}","compare_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/merges","archive_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/downloads","issues_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/issues{/number}","pulls_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/pulls{/number}","milestones_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/milestones{/number}","notifications_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/labels{/name}","releases_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/releases{/id}","deployments_url":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/deployments","created_at":"2014-07-18T16:46:14Z","updated_at":"2018-08-10T15:09:46Z","pushed_at":"2018-08-13T13:58:23Z","git_url":"git://github.com/django-json-api/django-rest-framework-json-api.git","ssh_url":"git@github.com:django-json-api/django-rest-framework-json-api.git","clone_url":"https://github.com/django-json-api/django-rest-framework-json-api.git","svn_url":"https://github.com/django-json-api/django-rest-framework-json-api","homepage":"https://django-rest-framework-json-api.readthedocs.org/","size":923,"stargazers_count":529,"watchers_count":529,"language":"Python","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":168,"mirror_url":null,"archived":false,"open_issues_count":37,"license":{"key":"bsd-2-clause","name":"BSD 2-Clause \"Simplified\" License","spdx_id":"BSD-2-Clause","url":"https://api.github.com/licenses/bsd-2-clause","node_id":"MDc6TGljZW5zZTQ="},"forks":168,"open_issues":37,"watchers":529,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/pulls/455"},"html":{"href":"https://github.com/django-json-api/django-rest-framework-json-api/pull/455"},"issue":{"href":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/issues/455"},"comments":{"href":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/issues/455/comments"},"review_comments":{"href":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/pulls/455/comments"},"review_comment":{"href":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/pulls/455/commits"},"statuses":{"href":"https://api.github.com/repos/django-json-api/django-rest-framework-json-api/statuses/12cca8d693d3dde68af30bf6a821ef0c7606abd7"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"n2ygk"}}