payload: {"action":"closed","number":12,"pull_request":{"url":"https://api.github.com/repos/ismasan/parametric/pulls/12","id":305108757,"node_id":"MDExOlB1bGxSZXF1ZXN0MzA1MTA4NzU3","html_url":"https://github.com/ismasan/parametric/pull/12","diff_url":"https://github.com/ismasan/parametric/pull/12.diff","patch_url":"https://github.com/ismasan/parametric/pull/12.patch","issue_url":"https://api.github.com/repos/ismasan/parametric/issues/12","number":12,"state":"closed","locked":false,"title":"Optionally yield schema to definition block and preserve block context.","user":{"login":"ismasan","id":1081,"node_id":"MDQ6VXNlcjEwODE=","avatar_url":"https://avatars2.githubusercontent.com/u/1081?v=4","gravatar_id":"","url":"https://api.github.com/users/ismasan","html_url":"https://github.com/ismasan","followers_url":"https://api.github.com/users/ismasan/followers","following_url":"https://api.github.com/users/ismasan/following{/other_user}","gists_url":"https://api.github.com/users/ismasan/gists{/gist_id}","starred_url":"https://api.github.com/users/ismasan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ismasan/subscriptions","organizations_url":"https://api.github.com/users/ismasan/orgs","repos_url":"https://api.github.com/users/ismasan/repos","events_url":"https://api.github.com/users/ismasan/events{/privacy}","received_events_url":"https://api.github.com/users/ismasan/received_events","type":"User","site_admin":false},"body":"## Problem\r\n\r\nDefinition blocks are run in the context of the defining schema instance by default.\r\n\r\nThe following works because `FRIENDS_SCHEMA` is a constant.\r\n\r\n```ruby\r\nperson_schema = Parametric::Schema.new do\r\n  field(:name).type(:string).required\r\n  field(:age).type(:integer)\r\n  # Nest friends_schema\r\n  field(:friends).type(:array).schema(FRIENDS_SCHEMA)\r\nend\r\n```\r\n\r\nSometimes, however, we'll want to have access to local variables in a definition block.\r\n\r\n## Solution\r\n\r\nIf a definition block declares 2 arguments, the defining schema instance will be yielded to it (the second argument is the options hash). The block preserves its context including access to local variables.\r\n\r\n```ruby\r\nperson_schema = Parametric::Schema.new do |sc, options|\r\n  # this block now preserves its context. Call `sc.field` to add fields to the current schema.\r\n  sc.field(:name).type(:string).required\r\n  sc.field(:age).type(:integer)\r\n  # We now have access to local variables\r\n  sc.field(:friends).type(:array).schema(friends_schema)\r\nend\r\n```","created_at":"2019-08-07T11:40:45Z","updated_at":"2019-08-07T11:43:47Z","closed_at":"2019-08-07T11:43:47Z","merged_at":"2019-08-07T11:43:47Z","merge_commit_sha":"ed68f14945031c843e2c33fce4e0fa993ad8e2d9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ismasan/parametric/pulls/12/commits","review_comments_url":"https://api.github.com/repos/ismasan/parametric/pulls/12/comments","review_comment_url":"https://api.github.com/repos/ismasan/parametric/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ismasan/parametric/issues/12/comments","statuses_url":"https://api.github.com/repos/ismasan/parametric/statuses/037e4b8aef64d98be071faa178b0fd2e3e6bb2b6","head":{"label":"ismasan:definitions_preserve_context","ref":"definitions_preserve_context","sha":"037e4b8aef64d98be071faa178b0fd2e3e6bb2b6","user":{"login":"ismasan","id":1081,"node_id":"MDQ6VXNlcjEwODE=","avatar_url":"https://avatars2.githubusercontent.com/u/1081?v=4","gravatar_id":"","url":"https://api.github.com/users/ismasan","html_url":"https://github.com/ismasan","followers_url":"https://api.github.com/users/ismasan/followers","following_url":"https://api.github.com/users/ismasan/following{/other_user}","gists_url":"https://api.github.com/users/ismasan/gists{/gist_id}","starred_url":"https://api.github.com/users/ismasan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ismasan/subscriptions","organizations_url":"https://api.github.com/users/ismasan/orgs","repos_url":"https://api.github.com/users/ismasan/repos","events_url":"https://api.github.com/users/ismasan/events{/privacy}","received_events_url":"https://api.github.com/users/ismasan/received_events","type":"User","site_admin":false},"repo":{"id":17717224,"node_id":"MDEwOlJlcG9zaXRvcnkxNzcxNzIyNA==","name":"parametric","full_name":"ismasan/parametric","private":false,"owner":{"login":"ismasan","id":1081,"node_id":"MDQ6VXNlcjEwODE=","avatar_url":"https://avatars2.githubusercontent.com/u/1081?v=4","gravatar_id":"","url":"https://api.github.com/users/ismasan","html_url":"https://github.com/ismasan","followers_url":"https://api.github.com/users/ismasan/followers","following_url":"https://api.github.com/users/ismasan/following{/other_user}","gists_url":"https://api.github.com/users/ismasan/gists{/gist_id}","starred_url":"https://api.github.com/users/ismasan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ismasan/subscriptions","organizations_url":"https://api.github.com/users/ismasan/orgs","repos_url":"https://api.github.com/users/ismasan/repos","events_url":"https://api.github.com/users/ismasan/events{/privacy}","received_events_url":"https://api.github.com/users/ismasan/received_events","type":"User","site_admin":false},"html_url":"https://github.com/ismasan/parametric","description":"Declarative input schemas for Ruby apps.","fork":false,"url":"https://api.github.com/repos/ismasan/parametric","forks_url":"https://api.github.com/repos/ismasan/parametric/forks","keys_url":"https://api.github.com/repos/ismasan/parametric/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ismasan/parametric/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ismasan/parametric/teams","hooks_url":"https://api.github.com/repos/ismasan/parametric/hooks","issue_events_url":"https://api.github.com/repos/ismasan/parametric/issues/events{/number}","events_url":"https://api.github.com/repos/ismasan/parametric/events","assignees_url":"https://api.github.com/repos/ismasan/parametric/assignees{/user}","branches_url":"https://api.github.com/repos/ismasan/parametric/branches{/branch}","tags_url":"https://api.github.com/repos/ismasan/parametric/tags","blobs_url":"https://api.github.com/repos/ismasan/parametric/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ismasan/parametric/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ismasan/parametric/git/refs{/sha}","trees_url":"https://api.github.com/repos/ismasan/parametric/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ismasan/parametric/statuses/{sha}","languages_url":"https://api.github.com/repos/ismasan/parametric/languages","stargazers_url":"https://api.github.com/repos/ismasan/parametric/stargazers","contributors_url":"https://api.github.com/repos/ismasan/parametric/contributors","subscribers_url":"https://api.github.com/repos/ismasan/parametric/subscribers","subscription_url":"https://api.github.com/repos/ismasan/parametric/subscription","commits_url":"https://api.github.com/repos/ismasan/parametric/commits{/sha}","git_commits_url":"https://api.github.com/repos/ismasan/parametric/git/commits{/sha}","comments_url":"https://api.github.com/repos/ismasan/parametric/comments{/number}","issue_comment_url":"https://api.github.com/repos/ismasan/parametric/issues/comments{/number}","contents_url":"https://api.github.com/repos/ismasan/parametric/contents/{+path}","compare_url":"https://api.github.com/repos/ismasan/parametric/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ismasan/parametric/merges","archive_url":"https://api.github.com/repos/ismasan/parametric/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ismasan/parametric/downloads","issues_url":"https://api.github.com/repos/ismasan/parametric/issues{/number}","pulls_url":"https://api.github.com/repos/ismasan/parametric/pulls{/number}","milestones_url":"https://api.github.com/repos/ismasan/parametric/milestones{/number}","notifications_url":"https://api.github.com/repos/ismasan/parametric/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ismasan/parametric/labels{/name}","releases_url":"https://api.github.com/repos/ismasan/parametric/releases{/id}","deployments_url":"https://api.github.com/repos/ismasan/parametric/deployments","created_at":"2014-03-13T16:37:09Z","updated_at":"2019-07-22T18:14:59Z","pushed_at":"2019-08-07T11:43:47Z","git_url":"git://github.com/ismasan/parametric.git","ssh_url":"git@github.com:ismasan/parametric.git","clone_url":"https://github.com/ismasan/parametric.git","svn_url":"https://github.com/ismasan/parametric","homepage":"","size":148,"stargazers_count":27,"watchers_count":27,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"disabled":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":3,"open_issues":0,"watchers":27,"default_branch":"master"}},"base":{"label":"ismasan:master","ref":"master","sha":"f03b262685d44f27ddad5efb098302edfef6c3dd","user":{"login":"ismasan","id":1081,"node_id":"MDQ6VXNlcjEwODE=","avatar_url":"https://avatars2.githubusercontent.com/u/1081?v=4","gravatar_id":"","url":"https://api.github.com/users/ismasan","html_url":"https://github.com/ismasan","followers_url":"https://api.github.com/users/ismasan/followers","following_url":"https://api.github.com/users/ismasan/following{/other_user}","gists_url":"https://api.github.com/users/ismasan/gists{/gist_id}","starred_url":"https://api.github.com/users/ismasan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ismasan/subscriptions","organizations_url":"https://api.github.com/users/ismasan/orgs","repos_url":"https://api.github.com/users/ismasan/repos","events_url":"https://api.github.com/users/ismasan/events{/privacy}","received_events_url":"https://api.github.com/users/ismasan/received_events","type":"User","site_admin":false},"repo":{"id":17717224,"node_id":"MDEwOlJlcG9zaXRvcnkxNzcxNzIyNA==","name":"parametric","full_name":"ismasan/parametric","private":false,"owner":{"login":"ismasan","id":1081,"node_id":"MDQ6VXNlcjEwODE=","avatar_url":"https://avatars2.githubusercontent.com/u/1081?v=4","gravatar_id":"","url":"https://api.github.com/users/ismasan","html_url":"https://github.com/ismasan","followers_url":"https://api.github.com/users/ismasan/followers","following_url":"https://api.github.com/users/ismasan/following{/other_user}","gists_url":"https://api.github.com/users/ismasan/gists{/gist_id}","starred_url":"https://api.github.com/users/ismasan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ismasan/subscriptions","organizations_url":"https://api.github.com/users/ismasan/orgs","repos_url":"https://api.github.com/users/ismasan/repos","events_url":"https://api.github.com/users/ismasan/events{/privacy}","received_events_url":"https://api.github.com/users/ismasan/received_events","type":"User","site_admin":false},"html_url":"https://github.com/ismasan/parametric","description":"Declarative input schemas for Ruby apps.","fork":false,"url":"https://api.github.com/repos/ismasan/parametric","forks_url":"https://api.github.com/repos/ismasan/parametric/forks","keys_url":"https://api.github.com/repos/ismasan/parametric/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ismasan/parametric/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ismasan/parametric/teams","hooks_url":"https://api.github.com/repos/ismasan/parametric/hooks","issue_events_url":"https://api.github.com/repos/ismasan/parametric/issues/events{/number}","events_url":"https://api.github.com/repos/ismasan/parametric/events","assignees_url":"https://api.github.com/repos/ismasan/parametric/assignees{/user}","branches_url":"https://api.github.com/repos/ismasan/parametric/branches{/branch}","tags_url":"https://api.github.com/repos/ismasan/parametric/tags","blobs_url":"https://api.github.com/repos/ismasan/parametric/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ismasan/parametric/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ismasan/parametric/git/refs{/sha}","trees_url":"https://api.github.com/repos/ismasan/parametric/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ismasan/parametric/statuses/{sha}","languages_url":"https://api.github.com/repos/ismasan/parametric/languages","stargazers_url":"https://api.github.com/repos/ismasan/parametric/stargazers","contributors_url":"https://api.github.com/repos/ismasan/parametric/contributors","subscribers_url":"https://api.github.com/repos/ismasan/parametric/subscribers","subscription_url":"https://api.github.com/repos/ismasan/parametric/subscription","commits_url":"https://api.github.com/repos/ismasan/parametric/commits{/sha}","git_commits_url":"https://api.github.com/repos/ismasan/parametric/git/commits{/sha}","comments_url":"https://api.github.com/repos/ismasan/parametric/comments{/number}","issue_comment_url":"https://api.github.com/repos/ismasan/parametric/issues/comments{/number}","contents_url":"https://api.github.com/repos/ismasan/parametric/contents/{+path}","compare_url":"https://api.github.com/repos/ismasan/parametric/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ismasan/parametric/merges","archive_url":"https://api.github.com/repos/ismasan/parametric/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ismasan/parametric/downloads","issues_url":"https://api.github.com/repos/ismasan/parametric/issues{/number}","pulls_url":"https://api.github.com/repos/ismasan/parametric/pulls{/number}","milestones_url":"https://api.github.com/repos/ismasan/parametric/milestones{/number}","notifications_url":"https://api.github.com/repos/ismasan/parametric/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ismasan/parametric/labels{/name}","releases_url":"https://api.github.com/repos/ismasan/parametric/releases{/id}","deployments_url":"https://api.github.com/repos/ismasan/parametric/deployments","created_at":"2014-03-13T16:37:09Z","updated_at":"2019-07-22T18:14:59Z","pushed_at":"2019-08-07T11:43:47Z","git_url":"git://github.com/ismasan/parametric.git","ssh_url":"git@github.com:ismasan/parametric.git","clone_url":"https://github.com/ismasan/parametric.git","svn_url":"https://github.com/ismasan/parametric","homepage":"","size":148,"stargazers_count":27,"watchers_count":27,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"disabled":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":3,"open_issues":0,"watchers":27,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ismasan/parametric/pulls/12"},"html":{"href":"https://github.com/ismasan/parametric/pull/12"},"issue":{"href":"https://api.github.com/repos/ismasan/parametric/issues/12"},"comments":{"href":"https://api.github.com/repos/ismasan/parametric/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/ismasan/parametric/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/ismasan/parametric/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ismasan/parametric/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/ismasan/parametric/statuses/037e4b8aef64d98be071faa178b0fd2e3e6bb2b6"}},"author_association":"OWNER","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"ismasan","id":1081,"node_id":"MDQ6VXNlcjEwODE=","avatar_url":"https://avatars2.githubusercontent.com/u/1081?v=4","gravatar_id":"","url":"https://api.github.com/users/ismasan","html_url":"https://github.com/ismasan","followers_url":"https://api.github.com/users/ismasan/followers","following_url":"https://api.github.com/users/ismasan/following{/other_user}","gists_url":"https://api.github.com/users/ismasan/gists{/gist_id}","starred_url":"https://api.github.com/users/ismasan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ismasan/subscriptions","organizations_url":"https://api.github.com/users/ismasan/orgs","repos_url":"https://api.github.com/users/ismasan/repos","events_url":"https://api.github.com/users/ismasan/events{/privacy}","received_events_url":"https://api.github.com/users/ismasan/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":1,"additions":35,"deletions":3,"changed_files":3}}
other: {"actor":{"display_login":"ismasan"}}