{"action":"created","comment":{"url":"https://api.github.com/repos/elifesciences/digests/pulls/comments/205472374","pull_request_review_id":140746379,"id":205472374,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNTQ3MjM3NA==","diff_hunk":"@@ -1,26 +1,54 @@\n+import json\n+import os\n from typing import Any, Dict\n \n from django.conf import settings\n-from rest_framework import viewsets\n+from elife_api_validator import SCHEMA_DIRECTORY\n+from jsonschema import validate as validate_json\n+from jsonschema import ValidationError\n+from rest_framework import viewsets, status\n+from rest_framework.request import Request\n from rest_framework.response import Response\n \n+from digests.exceptions import generate_error_string\n from digests.models import Digest\n from digests.pagination import DigestPagination\n from digests.serializers import DigestSerializer\n \n \n+def get_schema(schema_name: str) -> Dict:\n+    with open(os.path.join(SCHEMA_DIRECTORY, schema_name)) as schema:\n+        val = json.loads(schema.read())\n+        return val\n+\n+\n class DigestViewSet(viewsets.ModelViewSet):\n     model = Digest\n     queryset = Digest.objects.all()\n     serializer_class = DigestSerializer\n     pagination_class = DigestPagination\n \n     content_type = settings.DIGESTS_CONTENT_TYPE\n+    schema_name = 'digest.v1.json'","path":"app/digests/api.py","position":33,"original_position":33,"commit_id":"92cc4410e10dc01d373c13e39c63e2daa5a9f1f0","original_commit_id":"92cc4410e10dc01d373c13e39c63e2daa5a9f1f0","user":{"login":"thewilkybarkid","id":1784740,"node_id":"MDQ6VXNlcjE3ODQ3NDA=","avatar_url":"https://avatars0.githubusercontent.com/u/1784740?v=4","gravatar_id":"","url":"https://api.github.com/users/thewilkybarkid","html_url":"https://github.com/thewilkybarkid","followers_url":"https://api.github.com/users/thewilkybarkid/followers","following_url":"https://api.github.com/users/thewilkybarkid/following{/other_user}","gists_url":"https://api.github.com/users/thewilkybarkid/gists{/gist_id}","starred_url":"https://api.github.com/users/thewilkybarkid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thewilkybarkid/subscriptions","organizations_url":"https://api.github.com/users/thewilkybarkid/orgs","repos_url":"https://api.github.com/users/thewilkybarkid/repos","events_url":"https://api.github.com/users/thewilkybarkid/events{/privacy}","received_events_url":"https://api.github.com/users/thewilkybarkid/received_events","type":"User","site_admin":false},"body":"The `Content-Type` header on the request should be matched to this, rather than it being hard-coded.","created_at":"2018-07-26T14:11:20Z","updated_at":"2018-07-26T14:11:20Z","html_url":"https://github.com/elifesciences/digests/pull/14#discussion_r205472374","pull_request_url":"https://api.github.com/repos/elifesciences/digests/pulls/14","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/elifesciences/digests/pulls/comments/205472374"},"html":{"href":"https://github.com/elifesciences/digests/pull/14#discussion_r205472374"},"pull_request":{"href":"https://api.github.com/repos/elifesciences/digests/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/elifesciences/digests/pulls/14","id":204074916,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0MDc0OTE2","html_url":"https://github.com/elifesciences/digests/pull/14","diff_url":"https://github.com/elifesciences/digests/pull/14.diff","patch_url":"https://github.com/elifesciences/digests/pull/14.patch","issue_url":"https://api.github.com/repos/elifesciences/digests/issues/14","number":14,"state":"open","locked":false,"title":"Digest creation endpoint","user":{"login":"seanwiseman","id":30619751,"node_id":"MDQ6VXNlcjMwNjE5NzUx","avatar_url":"https://avatars2.githubusercontent.com/u/30619751?v=4","gravatar_id":"","url":"https://api.github.com/users/seanwiseman","html_url":"https://github.com/seanwiseman","followers_url":"https://api.github.com/users/seanwiseman/followers","following_url":"https://api.github.com/users/seanwiseman/following{/other_user}","gists_url":"https://api.github.com/users/seanwiseman/gists{/gist_id}","starred_url":"https://api.github.com/users/seanwiseman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanwiseman/subscriptions","organizations_url":"https://api.github.com/users/seanwiseman/orgs","repos_url":"https://api.github.com/users/seanwiseman/repos","events_url":"https://api.github.com/users/seanwiseman/events{/privacy}","received_events_url":"https://api.github.com/users/seanwiseman/received_events","type":"User","site_admin":false},"body":"Adds `POST /digests`.\r\n\r\nWill address `POST` in [#4348](https://github.com/elifesciences/jira-import/issues/4348).\r\n\r\nAllows creation of digests via `POST /digests`, validates payload against [the digest schema](https://github.com/elifesciences/api-raml/blob/develop/dist/model/digest.v1.json) and returns some meaningful error messages in the case of a validation error (ala lax).\r\n\r\nNote: Any Kong stuff will be done in a seperate PR as will `PATCH` / `PUT` to keep things smaller.","created_at":"2018-07-26T09:07:24Z","updated_at":"2018-07-26T14:11:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4b3af1f96034b48d5757c12291a0bdd6dab91dc8","assignee":null,"assignees":[],"requested_reviewers":[{"login":"giorgiosironi","id":160299,"node_id":"MDQ6VXNlcjE2MDI5OQ==","avatar_url":"https://avatars3.githubusercontent.com/u/160299?v=4","gravatar_id":"","url":"https://api.github.com/users/giorgiosironi","html_url":"https://github.com/giorgiosironi","followers_url":"https://api.github.com/users/giorgiosironi/followers","following_url":"https://api.github.com/users/giorgiosironi/following{/other_user}","gists_url":"https://api.github.com/users/giorgiosironi/gists{/gist_id}","starred_url":"https://api.github.com/users/giorgiosironi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/giorgiosironi/subscriptions","organizations_url":"https://api.github.com/users/giorgiosironi/orgs","repos_url":"https://api.github.com/users/giorgiosironi/repos","events_url":"https://api.github.com/users/giorgiosironi/events{/privacy}","received_events_url":"https://api.github.com/users/giorgiosironi/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/elifesciences/digests/pulls/14/commits","review_comments_url":"https://api.github.com/repos/elifesciences/digests/pulls/14/comments","review_comment_url":"https://api.github.com/repos/elifesciences/digests/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elifesciences/digests/issues/14/comments","statuses_url":"https://api.github.com/repos/elifesciences/digests/statuses/92cc4410e10dc01d373c13e39c63e2daa5a9f1f0","head":{"label":"elifesciences:create-digest-api","ref":"create-digest-api","sha":"92cc4410e10dc01d373c13e39c63e2daa5a9f1f0","user":{"login":"elifesciences","id":1777367,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3NzczNjc=","avatar_url":"https://avatars2.githubusercontent.com/u/1777367?v=4","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"repo":{"id":141993848,"node_id":"MDEwOlJlcG9zaXRvcnkxNDE5OTM4NDg=","name":"digests","full_name":"elifesciences/digests","owner":{"login":"elifesciences","id":1777367,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3NzczNjc=","avatar_url":"https://avatars2.githubusercontent.com/u/1777367?v=4","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elifesciences/digests","description":null,"fork":false,"url":"https://api.github.com/repos/elifesciences/digests","forks_url":"https://api.github.com/repos/elifesciences/digests/forks","keys_url":"https://api.github.com/repos/elifesciences/digests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elifesciences/digests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elifesciences/digests/teams","hooks_url":"https://api.github.com/repos/elifesciences/digests/hooks","issue_events_url":"https://api.github.com/repos/elifesciences/digests/issues/events{/number}","events_url":"https://api.github.com/repos/elifesciences/digests/events","assignees_url":"https://api.github.com/repos/elifesciences/digests/assignees{/user}","branches_url":"https://api.github.com/repos/elifesciences/digests/branches{/branch}","tags_url":"https://api.github.com/repos/elifesciences/digests/tags","blobs_url":"https://api.github.com/repos/elifesciences/digests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elifesciences/digests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elifesciences/digests/git/refs{/sha}","trees_url":"https://api.github.com/repos/elifesciences/digests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elifesciences/digests/statuses/{sha}","languages_url":"https://api.github.com/repos/elifesciences/digests/languages","stargazers_url":"https://api.github.com/repos/elifesciences/digests/stargazers","contributors_url":"https://api.github.com/repos/elifesciences/digests/contributors","subscribers_url":"https://api.github.com/repos/elifesciences/digests/subscribers","subscription_url":"https://api.github.com/repos/elifesciences/digests/subscription","commits_url":"https://api.github.com/repos/elifesciences/digests/commits{/sha}","git_commits_url":"https://api.github.com/repos/elifesciences/digests/git/commits{/sha}","comments_url":"https://api.github.com/repos/elifesciences/digests/comments{/number}","issue_comment_url":"https://api.github.com/repos/elifesciences/digests/issues/comments{/number}","contents_url":"https://api.github.com/repos/elifesciences/digests/contents/{+path}","compare_url":"https://api.github.com/repos/elifesciences/digests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elifesciences/digests/merges","archive_url":"https://api.github.com/repos/elifesciences/digests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elifesciences/digests/downloads","issues_url":"https://api.github.com/repos/elifesciences/digests/issues{/number}","pulls_url":"https://api.github.com/repos/elifesciences/digests/pulls{/number}","milestones_url":"https://api.github.com/repos/elifesciences/digests/milestones{/number}","notifications_url":"https://api.github.com/repos/elifesciences/digests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elifesciences/digests/labels{/name}","releases_url":"https://api.github.com/repos/elifesciences/digests/releases{/id}","deployments_url":"https://api.github.com/repos/elifesciences/digests/deployments","created_at":"2018-07-23T09:41:17Z","updated_at":"2018-07-25T15:13:30Z","pushed_at":"2018-07-26T13:54:14Z","git_url":"git://github.com/elifesciences/digests.git","ssh_url":"git@github.com:elifesciences/digests.git","clone_url":"https://github.com/elifesciences/digests.git","svn_url":"https://github.com/elifesciences/digests","homepage":null,"size":53,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":0,"open_issues":2,"watchers":0,"default_branch":"develop"}},"base":{"label":"elifesciences:develop","ref":"develop","sha":"5e7e797c67dc8f2796dc90d3c0b56789ae3b4d71","user":{"login":"elifesciences","id":1777367,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3NzczNjc=","avatar_url":"https://avatars2.githubusercontent.com/u/1777367?v=4","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"repo":{"id":141993848,"node_id":"MDEwOlJlcG9zaXRvcnkxNDE5OTM4NDg=","name":"digests","full_name":"elifesciences/digests","owner":{"login":"elifesciences","id":1777367,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3NzczNjc=","avatar_url":"https://avatars2.githubusercontent.com/u/1777367?v=4","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elifesciences/digests","description":null,"fork":false,"url":"https://api.github.com/repos/elifesciences/digests","forks_url":"https://api.github.com/repos/elifesciences/digests/forks","keys_url":"https://api.github.com/repos/elifesciences/digests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elifesciences/digests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elifesciences/digests/teams","hooks_url":"https://api.github.com/repos/elifesciences/digests/hooks","issue_events_url":"https://api.github.com/repos/elifesciences/digests/issues/events{/number}","events_url":"https://api.github.com/repos/elifesciences/digests/events","assignees_url":"https://api.github.com/repos/elifesciences/digests/assignees{/user}","branches_url":"https://api.github.com/repos/elifesciences/digests/branches{/branch}","tags_url":"https://api.github.com/repos/elifesciences/digests/tags","blobs_url":"https://api.github.com/repos/elifesciences/digests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elifesciences/digests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elifesciences/digests/git/refs{/sha}","trees_url":"https://api.github.com/repos/elifesciences/digests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elifesciences/digests/statuses/{sha}","languages_url":"https://api.github.com/repos/elifesciences/digests/languages","stargazers_url":"https://api.github.com/repos/elifesciences/digests/stargazers","contributors_url":"https://api.github.com/repos/elifesciences/digests/contributors","subscribers_url":"https://api.github.com/repos/elifesciences/digests/subscribers","subscription_url":"https://api.github.com/repos/elifesciences/digests/subscription","commits_url":"https://api.github.com/repos/elifesciences/digests/commits{/sha}","git_commits_url":"https://api.github.com/repos/elifesciences/digests/git/commits{/sha}","comments_url":"https://api.github.com/repos/elifesciences/digests/comments{/number}","issue_comment_url":"https://api.github.com/repos/elifesciences/digests/issues/comments{/number}","contents_url":"https://api.github.com/repos/elifesciences/digests/contents/{+path}","compare_url":"https://api.github.com/repos/elifesciences/digests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elifesciences/digests/merges","archive_url":"https://api.github.com/repos/elifesciences/digests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elifesciences/digests/downloads","issues_url":"https://api.github.com/repos/elifesciences/digests/issues{/number}","pulls_url":"https://api.github.com/repos/elifesciences/digests/pulls{/number}","milestones_url":"https://api.github.com/repos/elifesciences/digests/milestones{/number}","notifications_url":"https://api.github.com/repos/elifesciences/digests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elifesciences/digests/labels{/name}","releases_url":"https://api.github.com/repos/elifesciences/digests/releases{/id}","deployments_url":"https://api.github.com/repos/elifesciences/digests/deployments","created_at":"2018-07-23T09:41:17Z","updated_at":"2018-07-25T15:13:30Z","pushed_at":"2018-07-26T13:54:14Z","git_url":"git://github.com/elifesciences/digests.git","ssh_url":"git@github.com:elifesciences/digests.git","clone_url":"https://github.com/elifesciences/digests.git","svn_url":"https://github.com/elifesciences/digests","homepage":null,"size":53,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":0,"open_issues":2,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/elifesciences/digests/pulls/14"},"html":{"href":"https://github.com/elifesciences/digests/pull/14"},"issue":{"href":"https://api.github.com/repos/elifesciences/digests/issues/14"},"comments":{"href":"https://api.github.com/repos/elifesciences/digests/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/elifesciences/digests/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/elifesciences/digests/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elifesciences/digests/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/elifesciences/digests/statuses/92cc4410e10dc01d373c13e39c63e2daa5a9f1f0"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"thewilkybarkid"}}