{"action":"closed","number":37,"pull_request":{"url":"https://api.github.com/repos/dpla/frontend/pulls/37","id":22809202,"html_url":"https://github.com/dpla/frontend/pull/37","diff_url":"https://github.com/dpla/frontend/pull/37.diff","patch_url":"https://github.com/dpla/frontend/pull/37.patch","issue_url":"https://api.github.com/repos/dpla/frontend/issues/37","number":37,"state":"closed","locked":false,"title":"Field validation for item model (7616, 7627)","user":{"login":"AudreyAltman","id":3615206,"avatar_url":"https://avatars.githubusercontent.com/u/3615206?v=3","gravatar_id":"","url":"https://api.github.com/users/AudreyAltman","html_url":"https://github.com/AudreyAltman","followers_url":"https://api.github.com/users/AudreyAltman/followers","following_url":"https://api.github.com/users/AudreyAltman/following{/other_user}","gists_url":"https://api.github.com/users/AudreyAltman/gists{/gist_id}","starred_url":"https://api.github.com/users/AudreyAltman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AudreyAltman/subscriptions","organizations_url":"https://api.github.com/users/AudreyAltman/orgs","repos_url":"https://api.github.com/users/AudreyAltman/repos","events_url":"https://api.github.com/users/AudreyAltman/events{/privacy}","received_events_url":"https://api.github.com/users/AudreyAltman/received_events","type":"User","site_admin":false},"body":"This introduced field validation for the item model.  It addresses tasks #7616 and #7627.\n\nThis addresses the following problem:  Before these changes, if item views encountered unexpected data types, they would fail and show the user an error message.  Search result views that included items with unexpected data types would also fail and show the user an error message.\n\nThis new code attempts to catch unexpected data types and fail silently so that the user experience is not disrupted. For each item field, the model validates that it is returning a string, an array of strings, or a valid URL.   To alert the developers of the unexpected data types, messages are written to the error log.  I also added comments to code detailing the data type that is expected from the API for future ease/debugging. \n\nIt would also be possible to check whether or not URLs are live (as opposed to checking whether the format of the URL is valid).  This could be a plus for user experience, but may slow down page load time as each validation would involve sending a GET request to the URL and checking for a 200 response.\n","created_at":"2014-10-15T19:40:42Z","updated_at":"2016-11-01T23:58:40Z","closed_at":"2016-11-01T23:58:40Z","merged_at":null,"merge_commit_sha":"172db3dd1c66140b6970c490051aee5ee083cd9e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dpla/frontend/pulls/37/commits","review_comments_url":"https://api.github.com/repos/dpla/frontend/pulls/37/comments","review_comment_url":"https://api.github.com/repos/dpla/frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dpla/frontend/issues/37/comments","statuses_url":"https://api.github.com/repos/dpla/frontend/statuses/20cbc5187ad0d56173a900351a10afe0866cb476","head":{"label":"dpla:7616-7627-item-field-validation","ref":"7616-7627-item-field-validation","sha":"20cbc5187ad0d56173a900351a10afe0866cb476","user":{"login":"dpla","id":1252916,"avatar_url":"https://avatars.githubusercontent.com/u/1252916?v=3","gravatar_id":"","url":"https://api.github.com/users/dpla","html_url":"https://github.com/dpla","followers_url":"https://api.github.com/users/dpla/followers","following_url":"https://api.github.com/users/dpla/following{/other_user}","gists_url":"https://api.github.com/users/dpla/gists{/gist_id}","starred_url":"https://api.github.com/users/dpla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpla/subscriptions","organizations_url":"https://api.github.com/users/dpla/orgs","repos_url":"https://api.github.com/users/dpla/repos","events_url":"https://api.github.com/users/dpla/events{/privacy}","received_events_url":"https://api.github.com/users/dpla/received_events","type":"Organization","site_admin":false},"repo":{"id":7411781,"name":"frontend","full_name":"dpla/frontend","owner":{"login":"dpla","id":1252916,"avatar_url":"https://avatars.githubusercontent.com/u/1252916?v=3","gravatar_id":"","url":"https://api.github.com/users/dpla","html_url":"https://github.com/dpla","followers_url":"https://api.github.com/users/dpla/followers","following_url":"https://api.github.com/users/dpla/following{/other_user}","gists_url":"https://api.github.com/users/dpla/gists{/gist_id}","starred_url":"https://api.github.com/users/dpla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpla/subscriptions","organizations_url":"https://api.github.com/users/dpla/orgs","repos_url":"https://api.github.com/users/dpla/repos","events_url":"https://api.github.com/users/dpla/events{/privacy}","received_events_url":"https://api.github.com/users/dpla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dpla/frontend","description":"The DPLA portal","fork":false,"url":"https://api.github.com/repos/dpla/frontend","forks_url":"https://api.github.com/repos/dpla/frontend/forks","keys_url":"https://api.github.com/repos/dpla/frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dpla/frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dpla/frontend/teams","hooks_url":"https://api.github.com/repos/dpla/frontend/hooks","issue_events_url":"https://api.github.com/repos/dpla/frontend/issues/events{/number}","events_url":"https://api.github.com/repos/dpla/frontend/events","assignees_url":"https://api.github.com/repos/dpla/frontend/assignees{/user}","branches_url":"https://api.github.com/repos/dpla/frontend/branches{/branch}","tags_url":"https://api.github.com/repos/dpla/frontend/tags","blobs_url":"https://api.github.com/repos/dpla/frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dpla/frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dpla/frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/dpla/frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dpla/frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/dpla/frontend/languages","stargazers_url":"https://api.github.com/repos/dpla/frontend/stargazers","contributors_url":"https://api.github.com/repos/dpla/frontend/contributors","subscribers_url":"https://api.github.com/repos/dpla/frontend/subscribers","subscription_url":"https://api.github.com/repos/dpla/frontend/subscription","commits_url":"https://api.github.com/repos/dpla/frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/dpla/frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/dpla/frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/dpla/frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/dpla/frontend/contents/{+path}","compare_url":"https://api.github.com/repos/dpla/frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dpla/frontend/merges","archive_url":"https://api.github.com/repos/dpla/frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dpla/frontend/downloads","issues_url":"https://api.github.com/repos/dpla/frontend/issues{/number}","pulls_url":"https://api.github.com/repos/dpla/frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/dpla/frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/dpla/frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dpla/frontend/labels{/name}","releases_url":"https://api.github.com/repos/dpla/frontend/releases{/id}","deployments_url":"https://api.github.com/repos/dpla/frontend/deployments","created_at":"2013-01-02T19:09:35Z","updated_at":"2016-01-26T21:17:39Z","pushed_at":"2016-10-24T18:15:03Z","git_url":"git://github.com/dpla/frontend.git","ssh_url":"git@github.com:dpla/frontend.git","clone_url":"https://github.com/dpla/frontend.git","svn_url":"https://github.com/dpla/frontend","homepage":"http://dp.la/","size":3997,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":1,"forks":6,"open_issues":1,"watchers":4,"default_branch":"develop"}},"base":{"label":"dpla:develop","ref":"develop","sha":"6e04851f80879ee0a88b953e512a7e9e7b3eb712","user":{"login":"dpla","id":1252916,"avatar_url":"https://avatars.githubusercontent.com/u/1252916?v=3","gravatar_id":"","url":"https://api.github.com/users/dpla","html_url":"https://github.com/dpla","followers_url":"https://api.github.com/users/dpla/followers","following_url":"https://api.github.com/users/dpla/following{/other_user}","gists_url":"https://api.github.com/users/dpla/gists{/gist_id}","starred_url":"https://api.github.com/users/dpla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpla/subscriptions","organizations_url":"https://api.github.com/users/dpla/orgs","repos_url":"https://api.github.com/users/dpla/repos","events_url":"https://api.github.com/users/dpla/events{/privacy}","received_events_url":"https://api.github.com/users/dpla/received_events","type":"Organization","site_admin":false},"repo":{"id":7411781,"name":"frontend","full_name":"dpla/frontend","owner":{"login":"dpla","id":1252916,"avatar_url":"https://avatars.githubusercontent.com/u/1252916?v=3","gravatar_id":"","url":"https://api.github.com/users/dpla","html_url":"https://github.com/dpla","followers_url":"https://api.github.com/users/dpla/followers","following_url":"https://api.github.com/users/dpla/following{/other_user}","gists_url":"https://api.github.com/users/dpla/gists{/gist_id}","starred_url":"https://api.github.com/users/dpla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpla/subscriptions","organizations_url":"https://api.github.com/users/dpla/orgs","repos_url":"https://api.github.com/users/dpla/repos","events_url":"https://api.github.com/users/dpla/events{/privacy}","received_events_url":"https://api.github.com/users/dpla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dpla/frontend","description":"The DPLA portal","fork":false,"url":"https://api.github.com/repos/dpla/frontend","forks_url":"https://api.github.com/repos/dpla/frontend/forks","keys_url":"https://api.github.com/repos/dpla/frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dpla/frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dpla/frontend/teams","hooks_url":"https://api.github.com/repos/dpla/frontend/hooks","issue_events_url":"https://api.github.com/repos/dpla/frontend/issues/events{/number}","events_url":"https://api.github.com/repos/dpla/frontend/events","assignees_url":"https://api.github.com/repos/dpla/frontend/assignees{/user}","branches_url":"https://api.github.com/repos/dpla/frontend/branches{/branch}","tags_url":"https://api.github.com/repos/dpla/frontend/tags","blobs_url":"https://api.github.com/repos/dpla/frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dpla/frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dpla/frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/dpla/frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dpla/frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/dpla/frontend/languages","stargazers_url":"https://api.github.com/repos/dpla/frontend/stargazers","contributors_url":"https://api.github.com/repos/dpla/frontend/contributors","subscribers_url":"https://api.github.com/repos/dpla/frontend/subscribers","subscription_url":"https://api.github.com/repos/dpla/frontend/subscription","commits_url":"https://api.github.com/repos/dpla/frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/dpla/frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/dpla/frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/dpla/frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/dpla/frontend/contents/{+path}","compare_url":"https://api.github.com/repos/dpla/frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dpla/frontend/merges","archive_url":"https://api.github.com/repos/dpla/frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dpla/frontend/downloads","issues_url":"https://api.github.com/repos/dpla/frontend/issues{/number}","pulls_url":"https://api.github.com/repos/dpla/frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/dpla/frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/dpla/frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dpla/frontend/labels{/name}","releases_url":"https://api.github.com/repos/dpla/frontend/releases{/id}","deployments_url":"https://api.github.com/repos/dpla/frontend/deployments","created_at":"2013-01-02T19:09:35Z","updated_at":"2016-01-26T21:17:39Z","pushed_at":"2016-10-24T18:15:03Z","git_url":"git://github.com/dpla/frontend.git","ssh_url":"git@github.com:dpla/frontend.git","clone_url":"https://github.com/dpla/frontend.git","svn_url":"https://github.com/dpla/frontend","homepage":"http://dp.la/","size":3997,"stargazers_count":4,"watchers_count":4,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":1,"forks":6,"open_issues":1,"watchers":4,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/dpla/frontend/pulls/37"},"html":{"href":"https://github.com/dpla/frontend/pull/37"},"issue":{"href":"https://api.github.com/repos/dpla/frontend/issues/37"},"comments":{"href":"https://api.github.com/repos/dpla/frontend/issues/37/comments"},"review_comments":{"href":"https://api.github.com/repos/dpla/frontend/pulls/37/comments"},"review_comment":{"href":"https://api.github.com/repos/dpla/frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dpla/frontend/pulls/37/commits"},"statuses":{"href":"https://api.github.com/repos/dpla/frontend/statuses/20cbc5187ad0d56173a900351a10afe0866cb476"}},"merged":false,"mergeable":false,"mergeable_state":"dirty","merged_by":null,"comments":2,"review_comments":1,"commits":1,"additions":288,"deletions":51,"changed_files":3}}
{"actor":{"display_login":"AudreyAltman"}}