{"action":"created","comment":{"url":"https://api.github.com/repos/nuwave/lighthouse/pulls/comments/333366752","pull_request_review_id":299861409,"id":333366752,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMzMzM2Njc1Mg==","diff_hunk":"@@ -0,0 +1,146 @@\n+<?php\n+\n+namespace Nuwave\\Lighthouse\\Execution\\Arguments;\n+\n+use GraphQL\\Type\\Definition\\ResolveInfo;\n+use Nuwave\\Lighthouse\\Schema\\AST\\ASTHelper;\n+use Nuwave\\Lighthouse\\Schema\\AST\\ASTBuilder;\n+use GraphQL\\Language\\AST\\FieldDefinitionNode;\n+use GraphQL\\Language\\AST\\InputObjectTypeDefinitionNode;\n+\n+class TypedArgs\n+{\n+    /**\n+     * @var \\Nuwave\\Lighthouse\\Schema\\AST\\DocumentAST\n+     */\n+    protected $documentAST;\n+\n+    /**\n+     * @var \\Nuwave\\Lighthouse\\Execution\\Arguments\\ArgumentTypeNodeConverter\n+     */\n+    protected $argumentTypeNodeConverter;\n+\n+    /**\n+     * TypedArgs constructor.\n+     *\n+     * @param  \\Nuwave\\Lighthouse\\Schema\\AST\\ASTBuilder  $astBuilder\n+     * @param  \\Nuwave\\Lighthouse\\Execution\\Arguments\\ArgumentTypeNodeConverter  $argumentTypeNodeConverter\n+     * @return void\n+     */\n+    public function __construct(ASTBuilder $astBuilder, ArgumentTypeNodeConverter $argumentTypeNodeConverter)\n+    {\n+        $this->documentAST = $astBuilder->documentAST();\n+        $this->argumentTypeNodeConverter = $argumentTypeNodeConverter;\n+    }\n+\n+    /**\n+     * Wrap client-given args with type information.\n+     *\n+     * @param  array  $args\n+     * @param  \\GraphQL\\Type\\Definition\\ResolveInfo  $resolveInfo\n+     * @return \\Nuwave\\Lighthouse\\Execution\\Arguments\\ArgumentSet\n+     */\n+    public function fromResolveInfo(array $args, ResolveInfo $resolveInfo): ArgumentSet\n+    {\n+        $parentName = $resolveInfo->parentType->name;\n+        $fieldName = $resolveInfo->fieldName;\n+\n+        /** @var \\GraphQL\\Language\\AST\\ObjectTypeDefinitionNode $parentDefinition */\n+        $parentDefinition = $this->documentAST->types[$parentName];\n+        /** @var \\GraphQL\\Language\\AST\\FieldDefinitionNode $fieldDefinition */\n+        $fieldDefinition = ASTHelper::firstByName($parentDefinition->fields, $fieldName);\n+\n+        return $this->fromField($args, $fieldDefinition);\n+    }\n+\n+    /**\n+     * Wrap client-given args with type information.\n+     *\n+     * @param  array  $args\n+     * @param  \\GraphQL\\Language\\AST\\FieldDefinitionNode  $fieldDefinition\n+     * @return \\Nuwave\\Lighthouse\\Execution\\Arguments\\ArgumentSet\n+     */\n+    public function fromField(array $args, FieldDefinitionNode $fieldDefinition): ArgumentSet\n+    {\n+        $argumentSet = new ArgumentSet();\n+        $argumentSet->directives = $fieldDefinition->directives;\n+        $argumentSet->arguments = $this->wrapArgs($args, $fieldDefinition->arguments);\n+\n+        return $argumentSet;\n+    }\n+\n+    /**\n+     * Wrap client-given args with type information.\n+     *\n+     * @param  mixed[]  $args\n+     * @param  \\GraphQL\\Language\\AST\\NodeList|\\GraphQL\\Language\\AST\\InputValueDefinitionNode[] $argumentDefinitions\n+     * @return \\Nuwave\\Lighthouse\\Execution\\Arguments\\Argument[]\n+     */\n+    protected function wrapArgs(array $args, $argumentDefinitions): array","path":"src/Execution/Arguments/TypedArgs.php","position":79,"original_position":79,"commit_id":"e33958bdb33e503b154aae505d5eeb78ec0f9a79","original_commit_id":"e33958bdb33e503b154aae505d5eeb78ec0f9a79","user":{"login":"olivernybroe","id":5870441,"node_id":"MDQ6VXNlcjU4NzA0NDE=","avatar_url":"https://avatars1.githubusercontent.com/u/5870441?v=4","gravatar_id":"","url":"https://api.github.com/users/olivernybroe","html_url":"https://github.com/olivernybroe","followers_url":"https://api.github.com/users/olivernybroe/followers","following_url":"https://api.github.com/users/olivernybroe/following{/other_user}","gists_url":"https://api.github.com/users/olivernybroe/gists{/gist_id}","starred_url":"https://api.github.com/users/olivernybroe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olivernybroe/subscriptions","organizations_url":"https://api.github.com/users/olivernybroe/orgs","repos_url":"https://api.github.com/users/olivernybroe/repos","events_url":"https://api.github.com/users/olivernybroe/events{/privacy}","received_events_url":"https://api.github.com/users/olivernybroe/received_events","type":"User","site_admin":false},"body":"I think this method could use some love. It's kinda messy and big.\r\nJust if there are any obvious refactoring you can do here :) ","created_at":"2019-10-10T07:30:25Z","updated_at":"2019-10-10T07:45:43Z","html_url":"https://github.com/nuwave/lighthouse/pull/992#discussion_r333366752","pull_request_url":"https://api.github.com/repos/nuwave/lighthouse/pulls/992","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/nuwave/lighthouse/pulls/comments/333366752"},"html":{"href":"https://github.com/nuwave/lighthouse/pull/992#discussion_r333366752"},"pull_request":{"href":"https://api.github.com/repos/nuwave/lighthouse/pulls/992"}}},"pull_request":{"url":"https://api.github.com/repos/nuwave/lighthouse/pulls/992","id":325021244,"node_id":"MDExOlB1bGxSZXF1ZXN0MzI1MDIxMjQ0","html_url":"https://github.com/nuwave/lighthouse/pull/992","diff_url":"https://github.com/nuwave/lighthouse/pull/992.diff","patch_url":"https://github.com/nuwave/lighthouse/pull/992.patch","issue_url":"https://api.github.com/repos/nuwave/lighthouse/issues/992","number":992,"state":"open","locked":false,"title":"Nested spread directive","user":{"login":"spawnia","id":12158000,"node_id":"MDQ6VXNlcjEyMTU4MDAw","avatar_url":"https://avatars2.githubusercontent.com/u/12158000?v=4","gravatar_id":"","url":"https://api.github.com/users/spawnia","html_url":"https://github.com/spawnia","followers_url":"https://api.github.com/users/spawnia/followers","following_url":"https://api.github.com/users/spawnia/following{/other_user}","gists_url":"https://api.github.com/users/spawnia/gists{/gist_id}","starred_url":"https://api.github.com/users/spawnia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spawnia/subscriptions","organizations_url":"https://api.github.com/users/spawnia/orgs","repos_url":"https://api.github.com/users/spawnia/repos","events_url":"https://api.github.com/users/spawnia/events{/privacy}","received_events_url":"https://api.github.com/users/spawnia/received_events","type":"User","site_admin":false},"body":"- [x] Added or updated tests\r\n- [x] Added Docs for all relevant versions\r\n- [x] Updated the changelog\r\n\r\nResolves #857\r\n\r\n**Changes**\r\n\r\nThis allows to use the `@spread` directive nested within a given input.\r\n\r\n```graphql\r\ntype Mutation {\r\n    updatePost(\r\n        id: ID!\r\n        input: PostInput! @spread\r\n    ): Post @update\r\n}\r\n\r\ninput PostInput {\r\n    title: String!\r\n    content: PostContent @spread\r\n}\r\n\r\ninput PostContent {\r\n    imageUrl: String\r\n}\r\n```\r\n\r\nis now flattened to\r\n\r\n```php\r\n[\r\n    'id' => 12,\r\n    'title' => 'My awesome title',\r\n    'imageUrl' = 'http://some.site/image.jpg',\r\n]\r\n```\r\n\r\n**Breaking changes**\r\n\r\nSome internals were shifted around, but there are no user-facing changes.\r\n","created_at":"2019-10-06T10:39:33Z","updated_at":"2019-10-10T07:45:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"11e4e9ac647e6c55a6c72f386b25496540e3924d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/nuwave/lighthouse/pulls/992/commits","review_comments_url":"https://api.github.com/repos/nuwave/lighthouse/pulls/992/comments","review_comment_url":"https://api.github.com/repos/nuwave/lighthouse/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nuwave/lighthouse/issues/992/comments","statuses_url":"https://api.github.com/repos/nuwave/lighthouse/statuses/e33958bdb33e503b154aae505d5eeb78ec0f9a79","head":{"label":"nuwave:nested-spread-directive","ref":"nested-spread-directive","sha":"e33958bdb33e503b154aae505d5eeb78ec0f9a79","user":{"login":"nuwave","id":15846842,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1ODQ2ODQy","avatar_url":"https://avatars3.githubusercontent.com/u/15846842?v=4","gravatar_id":"","url":"https://api.github.com/users/nuwave","html_url":"https://github.com/nuwave","followers_url":"https://api.github.com/users/nuwave/followers","following_url":"https://api.github.com/users/nuwave/following{/other_user}","gists_url":"https://api.github.com/users/nuwave/gists{/gist_id}","starred_url":"https://api.github.com/users/nuwave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nuwave/subscriptions","organizations_url":"https://api.github.com/users/nuwave/orgs","repos_url":"https://api.github.com/users/nuwave/repos","events_url":"https://api.github.com/users/nuwave/events{/privacy}","received_events_url":"https://api.github.com/users/nuwave/received_events","type":"Organization","site_admin":false},"repo":{"id":59965104,"node_id":"MDEwOlJlcG9zaXRvcnk1OTk2NTEwNA==","name":"lighthouse","full_name":"nuwave/lighthouse","private":false,"owner":{"login":"nuwave","id":15846842,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1ODQ2ODQy","avatar_url":"https://avatars3.githubusercontent.com/u/15846842?v=4","gravatar_id":"","url":"https://api.github.com/users/nuwave","html_url":"https://github.com/nuwave","followers_url":"https://api.github.com/users/nuwave/followers","following_url":"https://api.github.com/users/nuwave/following{/other_user}","gists_url":"https://api.github.com/users/nuwave/gists{/gist_id}","starred_url":"https://api.github.com/users/nuwave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nuwave/subscriptions","organizations_url":"https://api.github.com/users/nuwave/orgs","repos_url":"https://api.github.com/users/nuwave/repos","events_url":"https://api.github.com/users/nuwave/events{/privacy}","received_events_url":"https://api.github.com/users/nuwave/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/nuwave/lighthouse","description":"GraphQL Server for Laravel","fork":false,"url":"https://api.github.com/repos/nuwave/lighthouse","forks_url":"https://api.github.com/repos/nuwave/lighthouse/forks","keys_url":"https://api.github.com/repos/nuwave/lighthouse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nuwave/lighthouse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nuwave/lighthouse/teams","hooks_url":"https://api.github.com/repos/nuwave/lighthouse/hooks","issue_events_url":"https://api.github.com/repos/nuwave/lighthouse/issues/events{/number}","events_url":"https://api.github.com/repos/nuwave/lighthouse/events","assignees_url":"https://api.github.com/repos/nuwave/lighthouse/assignees{/user}","branches_url":"https://api.github.com/repos/nuwave/lighthouse/branches{/branch}","tags_url":"https://api.github.com/repos/nuwave/lighthouse/tags","blobs_url":"https://api.github.com/repos/nuwave/lighthouse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nuwave/lighthouse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nuwave/lighthouse/git/refs{/sha}","trees_url":"https://api.github.com/repos/nuwave/lighthouse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nuwave/lighthouse/statuses/{sha}","languages_url":"https://api.github.com/repos/nuwave/lighthouse/languages","stargazers_url":"https://api.github.com/repos/nuwave/lighthouse/stargazers","contributors_url":"https://api.github.com/repos/nuwave/lighthouse/contributors","subscribers_url":"https://api.github.com/repos/nuwave/lighthouse/subscribers","subscription_url":"https://api.github.com/repos/nuwave/lighthouse/subscription","commits_url":"https://api.github.com/repos/nuwave/lighthouse/commits{/sha}","git_commits_url":"https://api.github.com/repos/nuwave/lighthouse/git/commits{/sha}","comments_url":"https://api.github.com/repos/nuwave/lighthouse/comments{/number}","issue_comment_url":"https://api.github.com/repos/nuwave/lighthouse/issues/comments{/number}","contents_url":"https://api.github.com/repos/nuwave/lighthouse/contents/{+path}","compare_url":"https://api.github.com/repos/nuwave/lighthouse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nuwave/lighthouse/merges","archive_url":"https://api.github.com/repos/nuwave/lighthouse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nuwave/lighthouse/downloads","issues_url":"https://api.github.com/repos/nuwave/lighthouse/issues{/number}","pulls_url":"https://api.github.com/repos/nuwave/lighthouse/pulls{/number}","milestones_url":"https://api.github.com/repos/nuwave/lighthouse/milestones{/number}","notifications_url":"https://api.github.com/repos/nuwave/lighthouse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nuwave/lighthouse/labels{/name}","releases_url":"https://api.github.com/repos/nuwave/lighthouse/releases{/id}","deployments_url":"https://api.github.com/repos/nuwave/lighthouse/deployments","created_at":"2016-05-29T21:44:38Z","updated_at":"2019-10-09T16:07:37Z","pushed_at":"2019-10-10T06:02:00Z","git_url":"git://github.com/nuwave/lighthouse.git","ssh_url":"git@github.com:nuwave/lighthouse.git","clone_url":"https://github.com/nuwave/lighthouse.git","svn_url":"https://github.com/nuwave/lighthouse","homepage":"https://lighthouse-php.com/","size":7521,"stargazers_count":1270,"watchers_count":1270,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":137,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":47,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":137,"open_issues":47,"watchers":1270,"default_branch":"master"}},"base":{"label":"nuwave:master","ref":"master","sha":"c42225ea15e77546b219768cb35517518cc36d00","user":{"login":"nuwave","id":15846842,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1ODQ2ODQy","avatar_url":"https://avatars3.githubusercontent.com/u/15846842?v=4","gravatar_id":"","url":"https://api.github.com/users/nuwave","html_url":"https://github.com/nuwave","followers_url":"https://api.github.com/users/nuwave/followers","following_url":"https://api.github.com/users/nuwave/following{/other_user}","gists_url":"https://api.github.com/users/nuwave/gists{/gist_id}","starred_url":"https://api.github.com/users/nuwave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nuwave/subscriptions","organizations_url":"https://api.github.com/users/nuwave/orgs","repos_url":"https://api.github.com/users/nuwave/repos","events_url":"https://api.github.com/users/nuwave/events{/privacy}","received_events_url":"https://api.github.com/users/nuwave/received_events","type":"Organization","site_admin":false},"repo":{"id":59965104,"node_id":"MDEwOlJlcG9zaXRvcnk1OTk2NTEwNA==","name":"lighthouse","full_name":"nuwave/lighthouse","private":false,"owner":{"login":"nuwave","id":15846842,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1ODQ2ODQy","avatar_url":"https://avatars3.githubusercontent.com/u/15846842?v=4","gravatar_id":"","url":"https://api.github.com/users/nuwave","html_url":"https://github.com/nuwave","followers_url":"https://api.github.com/users/nuwave/followers","following_url":"https://api.github.com/users/nuwave/following{/other_user}","gists_url":"https://api.github.com/users/nuwave/gists{/gist_id}","starred_url":"https://api.github.com/users/nuwave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nuwave/subscriptions","organizations_url":"https://api.github.com/users/nuwave/orgs","repos_url":"https://api.github.com/users/nuwave/repos","events_url":"https://api.github.com/users/nuwave/events{/privacy}","received_events_url":"https://api.github.com/users/nuwave/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/nuwave/lighthouse","description":"GraphQL Server for Laravel","fork":false,"url":"https://api.github.com/repos/nuwave/lighthouse","forks_url":"https://api.github.com/repos/nuwave/lighthouse/forks","keys_url":"https://api.github.com/repos/nuwave/lighthouse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nuwave/lighthouse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nuwave/lighthouse/teams","hooks_url":"https://api.github.com/repos/nuwave/lighthouse/hooks","issue_events_url":"https://api.github.com/repos/nuwave/lighthouse/issues/events{/number}","events_url":"https://api.github.com/repos/nuwave/lighthouse/events","assignees_url":"https://api.github.com/repos/nuwave/lighthouse/assignees{/user}","branches_url":"https://api.github.com/repos/nuwave/lighthouse/branches{/branch}","tags_url":"https://api.github.com/repos/nuwave/lighthouse/tags","blobs_url":"https://api.github.com/repos/nuwave/lighthouse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nuwave/lighthouse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nuwave/lighthouse/git/refs{/sha}","trees_url":"https://api.github.com/repos/nuwave/lighthouse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nuwave/lighthouse/statuses/{sha}","languages_url":"https://api.github.com/repos/nuwave/lighthouse/languages","stargazers_url":"https://api.github.com/repos/nuwave/lighthouse/stargazers","contributors_url":"https://api.github.com/repos/nuwave/lighthouse/contributors","subscribers_url":"https://api.github.com/repos/nuwave/lighthouse/subscribers","subscription_url":"https://api.github.com/repos/nuwave/lighthouse/subscription","commits_url":"https://api.github.com/repos/nuwave/lighthouse/commits{/sha}","git_commits_url":"https://api.github.com/repos/nuwave/lighthouse/git/commits{/sha}","comments_url":"https://api.github.com/repos/nuwave/lighthouse/comments{/number}","issue_comment_url":"https://api.github.com/repos/nuwave/lighthouse/issues/comments{/number}","contents_url":"https://api.github.com/repos/nuwave/lighthouse/contents/{+path}","compare_url":"https://api.github.com/repos/nuwave/lighthouse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nuwave/lighthouse/merges","archive_url":"https://api.github.com/repos/nuwave/lighthouse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nuwave/lighthouse/downloads","issues_url":"https://api.github.com/repos/nuwave/lighthouse/issues{/number}","pulls_url":"https://api.github.com/repos/nuwave/lighthouse/pulls{/number}","milestones_url":"https://api.github.com/repos/nuwave/lighthouse/milestones{/number}","notifications_url":"https://api.github.com/repos/nuwave/lighthouse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nuwave/lighthouse/labels{/name}","releases_url":"https://api.github.com/repos/nuwave/lighthouse/releases{/id}","deployments_url":"https://api.github.com/repos/nuwave/lighthouse/deployments","created_at":"2016-05-29T21:44:38Z","updated_at":"2019-10-09T16:07:37Z","pushed_at":"2019-10-10T06:02:00Z","git_url":"git://github.com/nuwave/lighthouse.git","ssh_url":"git@github.com:nuwave/lighthouse.git","clone_url":"https://github.com/nuwave/lighthouse.git","svn_url":"https://github.com/nuwave/lighthouse","homepage":"https://lighthouse-php.com/","size":7521,"stargazers_count":1270,"watchers_count":1270,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":137,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":47,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":137,"open_issues":47,"watchers":1270,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nuwave/lighthouse/pulls/992"},"html":{"href":"https://github.com/nuwave/lighthouse/pull/992"},"issue":{"href":"https://api.github.com/repos/nuwave/lighthouse/issues/992"},"comments":{"href":"https://api.github.com/repos/nuwave/lighthouse/issues/992/comments"},"review_comments":{"href":"https://api.github.com/repos/nuwave/lighthouse/pulls/992/comments"},"review_comment":{"href":"https://api.github.com/repos/nuwave/lighthouse/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nuwave/lighthouse/pulls/992/commits"},"statuses":{"href":"https://api.github.com/repos/nuwave/lighthouse/statuses/e33958bdb33e503b154aae505d5eeb78ec0f9a79"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"olivernybroe"}}