{"action":"closed","number":311,"pull_request":{"url":"https://api.github.com/repos/graphql/graphql-js/pulls/311","id":62658837,"html_url":"https://github.com/graphql/graphql-js/pull/311","diff_url":"https://github.com/graphql/graphql-js/pull/311.diff","patch_url":"https://github.com/graphql/graphql-js/pull/311.patch","issue_url":"https://api.github.com/repos/graphql/graphql-js/issues/311","number":311,"state":"closed","locked":false,"title":"Split up the completeValue function","user":{"login":"JeffRMoore","id":479533,"avatar_url":"https://avatars.githubusercontent.com/u/479533?v=3","gravatar_id":"","url":"https://api.github.com/users/JeffRMoore","html_url":"https://github.com/JeffRMoore","followers_url":"https://api.github.com/users/JeffRMoore/followers","following_url":"https://api.github.com/users/JeffRMoore/following{/other_user}","gists_url":"https://api.github.com/users/JeffRMoore/gists{/gist_id}","starred_url":"https://api.github.com/users/JeffRMoore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeffRMoore/subscriptions","organizations_url":"https://api.github.com/users/JeffRMoore/orgs","repos_url":"https://api.github.com/users/JeffRMoore/repos","events_url":"https://api.github.com/users/JeffRMoore/events{/privacy}","received_events_url":"https://api.github.com/users/JeffRMoore/received_events","type":"User","site_admin":false},"body":"The completeValue function is fairly large and took me a while to understand.  This PR extracts out the logic that is different based on the type of the value being completed.  Four new functions are added:\r\n\r\n- completeListValue\r\n- completeLeafValue\r\n- completeObjectValue\r\n- completeAbstractValue\r\n\r\nThe code in each function is identical except i inlined one isAbstractType call to avoid having to add an invariant.\r\n\r\nI did add an invariant for an unreachable condition that also exists in the current logic in master, but ends on a return null.\r\n\r\nThis is a change that I did as part of #304.  I'm submitting it as a separate PR. I think its a good change regardless of whether #304 is accepted.\r\n\r\nNote that the names in this PR do not match #304.  I tried to match the spec more closely with the names here and I will change the other to comply.\r\n\r\nThe exception to this is using the term leaf to refer to Scalar or Enum, which is established in type/definition.js, but not defined in the spec.","created_at":"2016-03-13T01:57:02Z","updated_at":"2016-03-23T00:12:06Z","closed_at":"2016-03-23T00:12:06Z","merged_at":"2016-03-23T00:12:06Z","merge_commit_sha":"371a5a0908123302a82de4a8d203df404681269e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/graphql/graphql-js/pulls/311/commits","review_comments_url":"https://api.github.com/repos/graphql/graphql-js/pulls/311/comments","review_comment_url":"https://api.github.com/repos/graphql/graphql-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/graphql/graphql-js/issues/311/comments","statuses_url":"https://api.github.com/repos/graphql/graphql-js/statuses/7a15a3f17452fadf2cc7d4f43fd41a7c24b38c8a","head":{"label":"JeffRMoore:split-complete-value","ref":"split-complete-value","sha":"7a15a3f17452fadf2cc7d4f43fd41a7c24b38c8a","user":{"login":"JeffRMoore","id":479533,"avatar_url":"https://avatars.githubusercontent.com/u/479533?v=3","gravatar_id":"","url":"https://api.github.com/users/JeffRMoore","html_url":"https://github.com/JeffRMoore","followers_url":"https://api.github.com/users/JeffRMoore/followers","following_url":"https://api.github.com/users/JeffRMoore/following{/other_user}","gists_url":"https://api.github.com/users/JeffRMoore/gists{/gist_id}","starred_url":"https://api.github.com/users/JeffRMoore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeffRMoore/subscriptions","organizations_url":"https://api.github.com/users/JeffRMoore/orgs","repos_url":"https://api.github.com/users/JeffRMoore/repos","events_url":"https://api.github.com/users/JeffRMoore/events{/privacy}","received_events_url":"https://api.github.com/users/JeffRMoore/received_events","type":"User","site_admin":false},"repo":{"id":52539128,"name":"graphql-js","full_name":"JeffRMoore/graphql-js","owner":{"login":"JeffRMoore","id":479533,"avatar_url":"https://avatars.githubusercontent.com/u/479533?v=3","gravatar_id":"","url":"https://api.github.com/users/JeffRMoore","html_url":"https://github.com/JeffRMoore","followers_url":"https://api.github.com/users/JeffRMoore/followers","following_url":"https://api.github.com/users/JeffRMoore/following{/other_user}","gists_url":"https://api.github.com/users/JeffRMoore/gists{/gist_id}","starred_url":"https://api.github.com/users/JeffRMoore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JeffRMoore/subscriptions","organizations_url":"https://api.github.com/users/JeffRMoore/orgs","repos_url":"https://api.github.com/users/JeffRMoore/repos","events_url":"https://api.github.com/users/JeffRMoore/events{/privacy}","received_events_url":"https://api.github.com/users/JeffRMoore/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JeffRMoore/graphql-js","description":"A reference implementation of GraphQL for JavaScript","fork":true,"url":"https://api.github.com/repos/JeffRMoore/graphql-js","forks_url":"https://api.github.com/repos/JeffRMoore/graphql-js/forks","keys_url":"https://api.github.com/repos/JeffRMoore/graphql-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JeffRMoore/graphql-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JeffRMoore/graphql-js/teams","hooks_url":"https://api.github.com/repos/JeffRMoore/graphql-js/hooks","issue_events_url":"https://api.github.com/repos/JeffRMoore/graphql-js/issues/events{/number}","events_url":"https://api.github.com/repos/JeffRMoore/graphql-js/events","assignees_url":"https://api.github.com/repos/JeffRMoore/graphql-js/assignees{/user}","branches_url":"https://api.github.com/repos/JeffRMoore/graphql-js/branches{/branch}","tags_url":"https://api.github.com/repos/JeffRMoore/graphql-js/tags","blobs_url":"https://api.github.com/repos/JeffRMoore/graphql-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JeffRMoore/graphql-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JeffRMoore/graphql-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/JeffRMoore/graphql-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JeffRMoore/graphql-js/statuses/{sha}","languages_url":"https://api.github.com/repos/JeffRMoore/graphql-js/languages","stargazers_url":"https://api.github.com/repos/JeffRMoore/graphql-js/stargazers","contributors_url":"https://api.github.com/repos/JeffRMoore/graphql-js/contributors","subscribers_url":"https://api.github.com/repos/JeffRMoore/graphql-js/subscribers","subscription_url":"https://api.github.com/repos/JeffRMoore/graphql-js/subscription","commits_url":"https://api.github.com/repos/JeffRMoore/graphql-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/JeffRMoore/graphql-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/JeffRMoore/graphql-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/JeffRMoore/graphql-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/JeffRMoore/graphql-js/contents/{+path}","compare_url":"https://api.github.com/repos/JeffRMoore/graphql-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JeffRMoore/graphql-js/merges","archive_url":"https://api.github.com/repos/JeffRMoore/graphql-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JeffRMoore/graphql-js/downloads","issues_url":"https://api.github.com/repos/JeffRMoore/graphql-js/issues{/number}","pulls_url":"https://api.github.com/repos/JeffRMoore/graphql-js/pulls{/number}","milestones_url":"https://api.github.com/repos/JeffRMoore/graphql-js/milestones{/number}","notifications_url":"https://api.github.com/repos/JeffRMoore/graphql-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JeffRMoore/graphql-js/labels{/name}","releases_url":"https://api.github.com/repos/JeffRMoore/graphql-js/releases{/id}","deployments_url":"https://api.github.com/repos/JeffRMoore/graphql-js/deployments","created_at":"2016-02-25T16:20:05Z","updated_at":"2016-02-25T16:20:06Z","pushed_at":"2016-03-13T01:22:39Z","git_url":"git://github.com/JeffRMoore/graphql-js.git","ssh_url":"git@github.com:JeffRMoore/graphql-js.git","clone_url":"https://github.com/JeffRMoore/graphql-js.git","svn_url":"https://github.com/JeffRMoore/graphql-js","homepage":null,"size":967,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"graphql:master","ref":"master","sha":"57d71e108afc0bdd205f5019fb8d0143b24b55b6","user":{"login":"graphql","id":12972006,"avatar_url":"https://avatars.githubusercontent.com/u/12972006?v=3","gravatar_id":"","url":"https://api.github.com/users/graphql","html_url":"https://github.com/graphql","followers_url":"https://api.github.com/users/graphql/followers","following_url":"https://api.github.com/users/graphql/following{/other_user}","gists_url":"https://api.github.com/users/graphql/gists{/gist_id}","starred_url":"https://api.github.com/users/graphql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/graphql/subscriptions","organizations_url":"https://api.github.com/users/graphql/orgs","repos_url":"https://api.github.com/users/graphql/repos","events_url":"https://api.github.com/users/graphql/events{/privacy}","received_events_url":"https://api.github.com/users/graphql/received_events","type":"Organization","site_admin":false},"repo":{"id":38307428,"name":"graphql-js","full_name":"graphql/graphql-js","owner":{"login":"graphql","id":12972006,"avatar_url":"https://avatars.githubusercontent.com/u/12972006?v=3","gravatar_id":"","url":"https://api.github.com/users/graphql","html_url":"https://github.com/graphql","followers_url":"https://api.github.com/users/graphql/followers","following_url":"https://api.github.com/users/graphql/following{/other_user}","gists_url":"https://api.github.com/users/graphql/gists{/gist_id}","starred_url":"https://api.github.com/users/graphql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/graphql/subscriptions","organizations_url":"https://api.github.com/users/graphql/orgs","repos_url":"https://api.github.com/users/graphql/repos","events_url":"https://api.github.com/users/graphql/events{/privacy}","received_events_url":"https://api.github.com/users/graphql/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/graphql/graphql-js","description":"A reference implementation of GraphQL for JavaScript","fork":false,"url":"https://api.github.com/repos/graphql/graphql-js","forks_url":"https://api.github.com/repos/graphql/graphql-js/forks","keys_url":"https://api.github.com/repos/graphql/graphql-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/graphql/graphql-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/graphql/graphql-js/teams","hooks_url":"https://api.github.com/repos/graphql/graphql-js/hooks","issue_events_url":"https://api.github.com/repos/graphql/graphql-js/issues/events{/number}","events_url":"https://api.github.com/repos/graphql/graphql-js/events","assignees_url":"https://api.github.com/repos/graphql/graphql-js/assignees{/user}","branches_url":"https://api.github.com/repos/graphql/graphql-js/branches{/branch}","tags_url":"https://api.github.com/repos/graphql/graphql-js/tags","blobs_url":"https://api.github.com/repos/graphql/graphql-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/graphql/graphql-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/graphql/graphql-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/graphql/graphql-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/graphql/graphql-js/statuses/{sha}","languages_url":"https://api.github.com/repos/graphql/graphql-js/languages","stargazers_url":"https://api.github.com/repos/graphql/graphql-js/stargazers","contributors_url":"https://api.github.com/repos/graphql/graphql-js/contributors","subscribers_url":"https://api.github.com/repos/graphql/graphql-js/subscribers","subscription_url":"https://api.github.com/repos/graphql/graphql-js/subscription","commits_url":"https://api.github.com/repos/graphql/graphql-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/graphql/graphql-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/graphql/graphql-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/graphql/graphql-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/graphql/graphql-js/contents/{+path}","compare_url":"https://api.github.com/repos/graphql/graphql-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/graphql/graphql-js/merges","archive_url":"https://api.github.com/repos/graphql/graphql-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/graphql/graphql-js/downloads","issues_url":"https://api.github.com/repos/graphql/graphql-js/issues{/number}","pulls_url":"https://api.github.com/repos/graphql/graphql-js/pulls{/number}","milestones_url":"https://api.github.com/repos/graphql/graphql-js/milestones{/number}","notifications_url":"https://api.github.com/repos/graphql/graphql-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/graphql/graphql-js/labels{/name}","releases_url":"https://api.github.com/repos/graphql/graphql-js/releases{/id}","deployments_url":"https://api.github.com/repos/graphql/graphql-js/deployments","created_at":"2015-06-30T12:16:50Z","updated_at":"2016-03-22T22:31:42Z","pushed_at":"2016-03-23T00:12:06Z","git_url":"git://github.com/graphql/graphql-js.git","ssh_url":"git@github.com:graphql/graphql-js.git","clone_url":"https://github.com/graphql/graphql-js.git","svn_url":"https://github.com/graphql/graphql-js","homepage":null,"size":1078,"stargazers_count":3292,"watchers_count":3292,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":213,"mirror_url":null,"open_issues_count":55,"forks":213,"open_issues":55,"watchers":3292,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/graphql/graphql-js/pulls/311"},"html":{"href":"https://github.com/graphql/graphql-js/pull/311"},"issue":{"href":"https://api.github.com/repos/graphql/graphql-js/issues/311"},"comments":{"href":"https://api.github.com/repos/graphql/graphql-js/issues/311/comments"},"review_comments":{"href":"https://api.github.com/repos/graphql/graphql-js/pulls/311/comments"},"review_comment":{"href":"https://api.github.com/repos/graphql/graphql-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/graphql/graphql-js/pulls/311/commits"},"statuses":{"href":"https://api.github.com/repos/graphql/graphql-js/statuses/7a15a3f17452fadf2cc7d4f43fd41a7c24b38c8a"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"leebyron","id":50130,"avatar_url":"https://avatars.githubusercontent.com/u/50130?v=3","gravatar_id":"","url":"https://api.github.com/users/leebyron","html_url":"https://github.com/leebyron","followers_url":"https://api.github.com/users/leebyron/followers","following_url":"https://api.github.com/users/leebyron/following{/other_user}","gists_url":"https://api.github.com/users/leebyron/gists{/gist_id}","starred_url":"https://api.github.com/users/leebyron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leebyron/subscriptions","organizations_url":"https://api.github.com/users/leebyron/orgs","repos_url":"https://api.github.com/users/leebyron/repos","events_url":"https://api.github.com/users/leebyron/events{/privacy}","received_events_url":"https://api.github.com/users/leebyron/received_events","type":"User","site_admin":false},"comments":2,"review_comments":0,"commits":5,"additions":128,"deletions":43,"changed_files":1}}