{"action":"opened","number":447,"pull_request":{"url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/pulls/447","id":202084337,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAyMDg0MzM3","html_url":"https://github.com/apollographql/subscriptions-transport-ws/pull/447","diff_url":"https://github.com/apollographql/subscriptions-transport-ws/pull/447.diff","patch_url":"https://github.com/apollographql/subscriptions-transport-ws/pull/447.patch","issue_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/issues/447","number":447,"state":"open","locked":false,"title":"Allow dynamic schema resolution ","user":{"login":"nirinchev","id":2315687,"node_id":"MDQ6VXNlcjIzMTU2ODc=","avatar_url":"https://avatars1.githubusercontent.com/u/2315687?v=4","gravatar_id":"","url":"https://api.github.com/users/nirinchev","html_url":"https://github.com/nirinchev","followers_url":"https://api.github.com/users/nirinchev/followers","following_url":"https://api.github.com/users/nirinchev/following{/other_user}","gists_url":"https://api.github.com/users/nirinchev/gists{/gist_id}","starred_url":"https://api.github.com/users/nirinchev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nirinchev/subscriptions","organizations_url":"https://api.github.com/users/nirinchev/orgs","repos_url":"https://api.github.com/users/nirinchev/repos","events_url":"https://api.github.com/users/nirinchev/events{/privacy}","received_events_url":"https://api.github.com/users/nirinchev/received_events","type":"User","site_admin":false},"body":"Sometimes, the GraphQL schema needs to be dynamically resolved (e.g. when exposing a database interface). This change allows the schema to be provided either as a static value or as a function of the connection context:\r\n\r\n```ts\r\n this.subscriptionServer = new SubscriptionServer(\r\n{\r\n    schema: async (context) => {\r\n        await something(context);\r\n        if (context.foo) {\r\n            return schema1;\r\n        } else {\r\n            return schema2;\r\n        }\r\n    },\r\n    ...\r\n}\r\n```\r\n\r\nThere are no tests for it since it's a fairly trivial change and I wasn't sure if it would be accepted, but I can write some smoke tests if required.\r\n\r\nTODO:\r\n\r\n- [ ] Make sure all of the significant new logic is covered by tests\r\n- [x] Rebase your changes on master so that they can be merged easily\r\n- [x] Make sure all tests and linter rules pass\r\n- [ ] Update CHANGELOG.md with your change\r\n\r\n<!--**Pull Request Labels**\r\n\r\nWhile not necessary, you can help organize our pull requests by labeling this issue when you open it.  To add a label automatically, simply [x] mark the appropriate box below:\r\n\r\n- [ ] feature\r\n- [ ] blocking\r\n- [ ] docs\r\n\r\nTo add a label not listed above, simply place `/label another-label-name` on a line by itself.\r\n-->","created_at":"2018-07-17T21:51:36Z","updated_at":"2018-07-17T21:51:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/pulls/447/commits","review_comments_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/pulls/447/comments","review_comment_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/issues/447/comments","statuses_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/statuses/a5b20a860ae5f50ecaf386f72a3363db253a1e89","head":{"label":"nirinchev:ni/dynamic-schema","ref":"ni/dynamic-schema","sha":"a5b20a860ae5f50ecaf386f72a3363db253a1e89","user":{"login":"nirinchev","id":2315687,"node_id":"MDQ6VXNlcjIzMTU2ODc=","avatar_url":"https://avatars1.githubusercontent.com/u/2315687?v=4","gravatar_id":"","url":"https://api.github.com/users/nirinchev","html_url":"https://github.com/nirinchev","followers_url":"https://api.github.com/users/nirinchev/followers","following_url":"https://api.github.com/users/nirinchev/following{/other_user}","gists_url":"https://api.github.com/users/nirinchev/gists{/gist_id}","starred_url":"https://api.github.com/users/nirinchev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nirinchev/subscriptions","organizations_url":"https://api.github.com/users/nirinchev/orgs","repos_url":"https://api.github.com/users/nirinchev/repos","events_url":"https://api.github.com/users/nirinchev/events{/privacy}","received_events_url":"https://api.github.com/users/nirinchev/received_events","type":"User","site_admin":false},"repo":{"id":141344915,"node_id":"MDEwOlJlcG9zaXRvcnkxNDEzNDQ5MTU=","name":"subscriptions-transport-ws","full_name":"nirinchev/subscriptions-transport-ws","owner":{"login":"nirinchev","id":2315687,"node_id":"MDQ6VXNlcjIzMTU2ODc=","avatar_url":"https://avatars1.githubusercontent.com/u/2315687?v=4","gravatar_id":"","url":"https://api.github.com/users/nirinchev","html_url":"https://github.com/nirinchev","followers_url":"https://api.github.com/users/nirinchev/followers","following_url":"https://api.github.com/users/nirinchev/following{/other_user}","gists_url":"https://api.github.com/users/nirinchev/gists{/gist_id}","starred_url":"https://api.github.com/users/nirinchev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nirinchev/subscriptions","organizations_url":"https://api.github.com/users/nirinchev/orgs","repos_url":"https://api.github.com/users/nirinchev/repos","events_url":"https://api.github.com/users/nirinchev/events{/privacy}","received_events_url":"https://api.github.com/users/nirinchev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nirinchev/subscriptions-transport-ws","description":":arrows_clockwise: A WebSocket client + server for GraphQL subscriptions","fork":true,"url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws","forks_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/forks","keys_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/teams","hooks_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/hooks","issue_events_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/issues/events{/number}","events_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/events","assignees_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/assignees{/user}","branches_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/branches{/branch}","tags_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/tags","blobs_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/git/refs{/sha}","trees_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/statuses/{sha}","languages_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/languages","stargazers_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/stargazers","contributors_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/contributors","subscribers_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/subscribers","subscription_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/subscription","commits_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/commits{/sha}","git_commits_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/git/commits{/sha}","comments_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/comments{/number}","issue_comment_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/issues/comments{/number}","contents_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/contents/{+path}","compare_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/merges","archive_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/downloads","issues_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/issues{/number}","pulls_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/pulls{/number}","milestones_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/milestones{/number}","notifications_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/labels{/name}","releases_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/releases{/id}","deployments_url":"https://api.github.com/repos/nirinchev/subscriptions-transport-ws/deployments","created_at":"2018-07-17T21:22:05Z","updated_at":"2018-07-17T21:22:07Z","pushed_at":"2018-07-17T21:43:18Z","git_url":"git://github.com/nirinchev/subscriptions-transport-ws.git","ssh_url":"git@github.com:nirinchev/subscriptions-transport-ws.git","clone_url":"https://github.com/nirinchev/subscriptions-transport-ws.git","svn_url":"https://github.com/nirinchev/subscriptions-transport-ws","homepage":"https://www.npmjs.com/package/subscriptions-transport-ws","size":632,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apollographql:master","ref":"master","sha":"714c84d707356ebd45d59a2597c0a0b59731bc70","user":{"login":"apollographql","id":17189275,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3MTg5Mjc1","avatar_url":"https://avatars0.githubusercontent.com/u/17189275?v=4","gravatar_id":"","url":"https://api.github.com/users/apollographql","html_url":"https://github.com/apollographql","followers_url":"https://api.github.com/users/apollographql/followers","following_url":"https://api.github.com/users/apollographql/following{/other_user}","gists_url":"https://api.github.com/users/apollographql/gists{/gist_id}","starred_url":"https://api.github.com/users/apollographql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apollographql/subscriptions","organizations_url":"https://api.github.com/users/apollographql/orgs","repos_url":"https://api.github.com/users/apollographql/repos","events_url":"https://api.github.com/users/apollographql/events{/privacy}","received_events_url":"https://api.github.com/users/apollographql/received_events","type":"Organization","site_admin":false},"repo":{"id":63733328,"node_id":"MDEwOlJlcG9zaXRvcnk2MzczMzMyOA==","name":"subscriptions-transport-ws","full_name":"apollographql/subscriptions-transport-ws","owner":{"login":"apollographql","id":17189275,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3MTg5Mjc1","avatar_url":"https://avatars0.githubusercontent.com/u/17189275?v=4","gravatar_id":"","url":"https://api.github.com/users/apollographql","html_url":"https://github.com/apollographql","followers_url":"https://api.github.com/users/apollographql/followers","following_url":"https://api.github.com/users/apollographql/following{/other_user}","gists_url":"https://api.github.com/users/apollographql/gists{/gist_id}","starred_url":"https://api.github.com/users/apollographql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apollographql/subscriptions","organizations_url":"https://api.github.com/users/apollographql/orgs","repos_url":"https://api.github.com/users/apollographql/repos","events_url":"https://api.github.com/users/apollographql/events{/privacy}","received_events_url":"https://api.github.com/users/apollographql/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apollographql/subscriptions-transport-ws","description":":arrows_clockwise: A WebSocket client + server for GraphQL subscriptions","fork":false,"url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws","forks_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/forks","keys_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/teams","hooks_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/hooks","issue_events_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/issues/events{/number}","events_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/events","assignees_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/assignees{/user}","branches_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/branches{/branch}","tags_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/tags","blobs_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/git/refs{/sha}","trees_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/statuses/{sha}","languages_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/languages","stargazers_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/stargazers","contributors_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/contributors","subscribers_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/subscribers","subscription_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/subscription","commits_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/commits{/sha}","git_commits_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/git/commits{/sha}","comments_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/comments{/number}","issue_comment_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/issues/comments{/number}","contents_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/contents/{+path}","compare_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/merges","archive_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/downloads","issues_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/issues{/number}","pulls_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/pulls{/number}","milestones_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/milestones{/number}","notifications_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/labels{/name}","releases_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/releases{/id}","deployments_url":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/deployments","created_at":"2016-07-19T22:58:49Z","updated_at":"2018-07-17T07:38:23Z","pushed_at":"2018-07-14T01:00:24Z","git_url":"git://github.com/apollographql/subscriptions-transport-ws.git","ssh_url":"git@github.com:apollographql/subscriptions-transport-ws.git","clone_url":"https://github.com/apollographql/subscriptions-transport-ws.git","svn_url":"https://github.com/apollographql/subscriptions-transport-ws","homepage":"https://www.npmjs.com/package/subscriptions-transport-ws","size":632,"stargazers_count":706,"watchers_count":706,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":135,"mirror_url":null,"archived":false,"open_issues_count":88,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":135,"open_issues":88,"watchers":706,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/pulls/447"},"html":{"href":"https://github.com/apollographql/subscriptions-transport-ws/pull/447"},"issue":{"href":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/issues/447"},"comments":{"href":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/issues/447/comments"},"review_comments":{"href":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/pulls/447/comments"},"review_comment":{"href":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/pulls/447/commits"},"statuses":{"href":"https://api.github.com/repos/apollographql/subscriptions-transport-ws/statuses/a5b20a860ae5f50ecaf386f72a3363db253a1e89"}},"author_association":"NONE","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":34,"deletions":25,"changed_files":1}}
{"actor":{"display_login":"nirinchev"}}