{"action":"opened","number":1993,"pull_request":{"url":"https://api.github.com/repos/ianstormtaylor/slate/pulls/1993","id":203393296,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAzMzkzMjk2","html_url":"https://github.com/ianstormtaylor/slate/pull/1993","diff_url":"https://github.com/ianstormtaylor/slate/pull/1993.diff","patch_url":"https://github.com/ianstormtaylor/slate/pull/1993.patch","issue_url":"https://api.github.com/repos/ianstormtaylor/slate/issues/1993","number":1993,"state":"open","locked":false,"title":"Refactor schema","user":{"login":"ianstormtaylor","id":311752,"node_id":"MDQ6VXNlcjMxMTc1Mg==","avatar_url":"https://avatars0.githubusercontent.com/u/311752?v=4","gravatar_id":"","url":"https://api.github.com/users/ianstormtaylor","html_url":"https://github.com/ianstormtaylor","followers_url":"https://api.github.com/users/ianstormtaylor/followers","following_url":"https://api.github.com/users/ianstormtaylor/following{/other_user}","gists_url":"https://api.github.com/users/ianstormtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/ianstormtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianstormtaylor/subscriptions","organizations_url":"https://api.github.com/users/ianstormtaylor/orgs","repos_url":"https://api.github.com/users/ianstormtaylor/repos","events_url":"https://api.github.com/users/ianstormtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/ianstormtaylor/received_events","type":"User","site_admin":false},"body":"#### Is this adding or improving a _feature_ or fixing a _bug_?\r\n\r\nImprovement.\r\n\r\n#### What's the new behavior?\r\n\r\n- Tweaking the declarative schema definition syntax to make it easier to represent more complex states, as well as enable it to validate previously impossible things.\r\n- Rename `validateNode` to `normalizeNode` for clarity.\r\n- Introduce `validateNode`, `checkNode`, `assertNode` helpers for more advanced use cases, like front-end API validation of \"invalid\" fields that need to be fixed before they are sent to the server.\r\n\r\n#### How does this change work?\r\n\r\nThe `schema.blocks/inlines/document` entries are now a shorthand for a more powerful `schema.rules` syntax. For example, this now allows for declaratively validating by a node's data, regardless of type:\r\n\r\n```js\r\n{\r\n  rules: [\r\n    {\r\n      match: {\r\n        data: { id: '2kd293lry' },\r\n      },\r\n      nodes: [\r\n        { match: { type: 'paragraph' }},\r\n        { match: { type: 'image' }},\r\n      ]\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\nPreviously you'd have to use `validateNode` for this, since the syntax wasn't flexible enough to validate nodes without hard-coding their `type`.\r\n\r\nThis also simplifies the \"concatenation\" of schema rules, because under the covers all of them are implemented using the `schema.rules` array, so they simply take effect in order, just like everything else in plugins.\r\n\r\n#### Have you checked that...?\r\n\r\n<!-- \r\nPlease run through this checklist for your pull request: \r\n-->\r\n\r\n* [x] The new code matches the existing patterns and styles.\r\n* [x] The tests pass with `yarn test`.\r\n* [x] The linter passes with `yarn lint`. (Fix errors with `yarn prettier`.)\r\n* [x] The relevant examples still work. (Run examples with `yarn watch`.)\r\n\r\n#### Does this fix any issues or need any specific reviewers?\r\n\r\nFixes: #1842\r\nFixes: #1923\r\n","created_at":"2018-07-24T02:32:04Z","updated_at":"2018-07-24T02:32:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":404055732,"node_id":"MDU6TGFiZWw0MDQwNTU3MzI=","url":"https://api.github.com/repos/ianstormtaylor/slate/labels/improvement","name":"improvement","color":"c2e0c6","default":false},{"id":423372501,"node_id":"MDU6TGFiZWw0MjMzNzI1MDE=","url":"https://api.github.com/repos/ianstormtaylor/slate/labels/%E2%9C%B6%20breaking","name":"✶ breaking","color":"fef2c0","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ianstormtaylor/slate/pulls/1993/commits","review_comments_url":"https://api.github.com/repos/ianstormtaylor/slate/pulls/1993/comments","review_comment_url":"https://api.github.com/repos/ianstormtaylor/slate/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ianstormtaylor/slate/issues/1993/comments","statuses_url":"https://api.github.com/repos/ianstormtaylor/slate/statuses/0a885d32e01d0d138fe84165374151898529de91","head":{"label":"ianstormtaylor:refactor-schema","ref":"refactor-schema","sha":"0a885d32e01d0d138fe84165374151898529de91","user":{"login":"ianstormtaylor","id":311752,"node_id":"MDQ6VXNlcjMxMTc1Mg==","avatar_url":"https://avatars0.githubusercontent.com/u/311752?v=4","gravatar_id":"","url":"https://api.github.com/users/ianstormtaylor","html_url":"https://github.com/ianstormtaylor","followers_url":"https://api.github.com/users/ianstormtaylor/followers","following_url":"https://api.github.com/users/ianstormtaylor/following{/other_user}","gists_url":"https://api.github.com/users/ianstormtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/ianstormtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianstormtaylor/subscriptions","organizations_url":"https://api.github.com/users/ianstormtaylor/orgs","repos_url":"https://api.github.com/users/ianstormtaylor/repos","events_url":"https://api.github.com/users/ianstormtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/ianstormtaylor/received_events","type":"User","site_admin":false},"repo":{"id":61412022,"node_id":"MDEwOlJlcG9zaXRvcnk2MTQxMjAyMg==","name":"slate","full_name":"ianstormtaylor/slate","owner":{"login":"ianstormtaylor","id":311752,"node_id":"MDQ6VXNlcjMxMTc1Mg==","avatar_url":"https://avatars0.githubusercontent.com/u/311752?v=4","gravatar_id":"","url":"https://api.github.com/users/ianstormtaylor","html_url":"https://github.com/ianstormtaylor","followers_url":"https://api.github.com/users/ianstormtaylor/followers","following_url":"https://api.github.com/users/ianstormtaylor/following{/other_user}","gists_url":"https://api.github.com/users/ianstormtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/ianstormtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianstormtaylor/subscriptions","organizations_url":"https://api.github.com/users/ianstormtaylor/orgs","repos_url":"https://api.github.com/users/ianstormtaylor/repos","events_url":"https://api.github.com/users/ianstormtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/ianstormtaylor/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ianstormtaylor/slate","description":"A completely customizable framework for building rich text editors.","fork":false,"url":"https://api.github.com/repos/ianstormtaylor/slate","forks_url":"https://api.github.com/repos/ianstormtaylor/slate/forks","keys_url":"https://api.github.com/repos/ianstormtaylor/slate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ianstormtaylor/slate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ianstormtaylor/slate/teams","hooks_url":"https://api.github.com/repos/ianstormtaylor/slate/hooks","issue_events_url":"https://api.github.com/repos/ianstormtaylor/slate/issues/events{/number}","events_url":"https://api.github.com/repos/ianstormtaylor/slate/events","assignees_url":"https://api.github.com/repos/ianstormtaylor/slate/assignees{/user}","branches_url":"https://api.github.com/repos/ianstormtaylor/slate/branches{/branch}","tags_url":"https://api.github.com/repos/ianstormtaylor/slate/tags","blobs_url":"https://api.github.com/repos/ianstormtaylor/slate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ianstormtaylor/slate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ianstormtaylor/slate/git/refs{/sha}","trees_url":"https://api.github.com/repos/ianstormtaylor/slate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ianstormtaylor/slate/statuses/{sha}","languages_url":"https://api.github.com/repos/ianstormtaylor/slate/languages","stargazers_url":"https://api.github.com/repos/ianstormtaylor/slate/stargazers","contributors_url":"https://api.github.com/repos/ianstormtaylor/slate/contributors","subscribers_url":"https://api.github.com/repos/ianstormtaylor/slate/subscribers","subscription_url":"https://api.github.com/repos/ianstormtaylor/slate/subscription","commits_url":"https://api.github.com/repos/ianstormtaylor/slate/commits{/sha}","git_commits_url":"https://api.github.com/repos/ianstormtaylor/slate/git/commits{/sha}","comments_url":"https://api.github.com/repos/ianstormtaylor/slate/comments{/number}","issue_comment_url":"https://api.github.com/repos/ianstormtaylor/slate/issues/comments{/number}","contents_url":"https://api.github.com/repos/ianstormtaylor/slate/contents/{+path}","compare_url":"https://api.github.com/repos/ianstormtaylor/slate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ianstormtaylor/slate/merges","archive_url":"https://api.github.com/repos/ianstormtaylor/slate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ianstormtaylor/slate/downloads","issues_url":"https://api.github.com/repos/ianstormtaylor/slate/issues{/number}","pulls_url":"https://api.github.com/repos/ianstormtaylor/slate/pulls{/number}","milestones_url":"https://api.github.com/repos/ianstormtaylor/slate/milestones{/number}","notifications_url":"https://api.github.com/repos/ianstormtaylor/slate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ianstormtaylor/slate/labels{/name}","releases_url":"https://api.github.com/repos/ianstormtaylor/slate/releases{/id}","deployments_url":"https://api.github.com/repos/ianstormtaylor/slate/deployments","created_at":"2016-06-18T01:52:42Z","updated_at":"2018-07-24T02:03:04Z","pushed_at":"2018-07-24T02:19:43Z","git_url":"git://github.com/ianstormtaylor/slate.git","ssh_url":"git@github.com:ianstormtaylor/slate.git","clone_url":"https://github.com/ianstormtaylor/slate.git","svn_url":"https://github.com/ianstormtaylor/slate","homepage":"http://slatejs.org","size":197602,"stargazers_count":7992,"watchers_count":7992,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":642,"mirror_url":null,"archived":false,"open_issues_count":268,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":642,"open_issues":268,"watchers":7992,"default_branch":"master"}},"base":{"label":"ianstormtaylor:master","ref":"master","sha":"695f83bd408702b08621b18997c7c5f88ec45208","user":{"login":"ianstormtaylor","id":311752,"node_id":"MDQ6VXNlcjMxMTc1Mg==","avatar_url":"https://avatars0.githubusercontent.com/u/311752?v=4","gravatar_id":"","url":"https://api.github.com/users/ianstormtaylor","html_url":"https://github.com/ianstormtaylor","followers_url":"https://api.github.com/users/ianstormtaylor/followers","following_url":"https://api.github.com/users/ianstormtaylor/following{/other_user}","gists_url":"https://api.github.com/users/ianstormtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/ianstormtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianstormtaylor/subscriptions","organizations_url":"https://api.github.com/users/ianstormtaylor/orgs","repos_url":"https://api.github.com/users/ianstormtaylor/repos","events_url":"https://api.github.com/users/ianstormtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/ianstormtaylor/received_events","type":"User","site_admin":false},"repo":{"id":61412022,"node_id":"MDEwOlJlcG9zaXRvcnk2MTQxMjAyMg==","name":"slate","full_name":"ianstormtaylor/slate","owner":{"login":"ianstormtaylor","id":311752,"node_id":"MDQ6VXNlcjMxMTc1Mg==","avatar_url":"https://avatars0.githubusercontent.com/u/311752?v=4","gravatar_id":"","url":"https://api.github.com/users/ianstormtaylor","html_url":"https://github.com/ianstormtaylor","followers_url":"https://api.github.com/users/ianstormtaylor/followers","following_url":"https://api.github.com/users/ianstormtaylor/following{/other_user}","gists_url":"https://api.github.com/users/ianstormtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/ianstormtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianstormtaylor/subscriptions","organizations_url":"https://api.github.com/users/ianstormtaylor/orgs","repos_url":"https://api.github.com/users/ianstormtaylor/repos","events_url":"https://api.github.com/users/ianstormtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/ianstormtaylor/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ianstormtaylor/slate","description":"A completely customizable framework for building rich text editors.","fork":false,"url":"https://api.github.com/repos/ianstormtaylor/slate","forks_url":"https://api.github.com/repos/ianstormtaylor/slate/forks","keys_url":"https://api.github.com/repos/ianstormtaylor/slate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ianstormtaylor/slate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ianstormtaylor/slate/teams","hooks_url":"https://api.github.com/repos/ianstormtaylor/slate/hooks","issue_events_url":"https://api.github.com/repos/ianstormtaylor/slate/issues/events{/number}","events_url":"https://api.github.com/repos/ianstormtaylor/slate/events","assignees_url":"https://api.github.com/repos/ianstormtaylor/slate/assignees{/user}","branches_url":"https://api.github.com/repos/ianstormtaylor/slate/branches{/branch}","tags_url":"https://api.github.com/repos/ianstormtaylor/slate/tags","blobs_url":"https://api.github.com/repos/ianstormtaylor/slate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ianstormtaylor/slate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ianstormtaylor/slate/git/refs{/sha}","trees_url":"https://api.github.com/repos/ianstormtaylor/slate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ianstormtaylor/slate/statuses/{sha}","languages_url":"https://api.github.com/repos/ianstormtaylor/slate/languages","stargazers_url":"https://api.github.com/repos/ianstormtaylor/slate/stargazers","contributors_url":"https://api.github.com/repos/ianstormtaylor/slate/contributors","subscribers_url":"https://api.github.com/repos/ianstormtaylor/slate/subscribers","subscription_url":"https://api.github.com/repos/ianstormtaylor/slate/subscription","commits_url":"https://api.github.com/repos/ianstormtaylor/slate/commits{/sha}","git_commits_url":"https://api.github.com/repos/ianstormtaylor/slate/git/commits{/sha}","comments_url":"https://api.github.com/repos/ianstormtaylor/slate/comments{/number}","issue_comment_url":"https://api.github.com/repos/ianstormtaylor/slate/issues/comments{/number}","contents_url":"https://api.github.com/repos/ianstormtaylor/slate/contents/{+path}","compare_url":"https://api.github.com/repos/ianstormtaylor/slate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ianstormtaylor/slate/merges","archive_url":"https://api.github.com/repos/ianstormtaylor/slate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ianstormtaylor/slate/downloads","issues_url":"https://api.github.com/repos/ianstormtaylor/slate/issues{/number}","pulls_url":"https://api.github.com/repos/ianstormtaylor/slate/pulls{/number}","milestones_url":"https://api.github.com/repos/ianstormtaylor/slate/milestones{/number}","notifications_url":"https://api.github.com/repos/ianstormtaylor/slate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ianstormtaylor/slate/labels{/name}","releases_url":"https://api.github.com/repos/ianstormtaylor/slate/releases{/id}","deployments_url":"https://api.github.com/repos/ianstormtaylor/slate/deployments","created_at":"2016-06-18T01:52:42Z","updated_at":"2018-07-24T02:03:04Z","pushed_at":"2018-07-24T02:19:43Z","git_url":"git://github.com/ianstormtaylor/slate.git","ssh_url":"git@github.com:ianstormtaylor/slate.git","clone_url":"https://github.com/ianstormtaylor/slate.git","svn_url":"https://github.com/ianstormtaylor/slate","homepage":"http://slatejs.org","size":197602,"stargazers_count":7992,"watchers_count":7992,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":642,"mirror_url":null,"archived":false,"open_issues_count":268,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":642,"open_issues":268,"watchers":7992,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ianstormtaylor/slate/pulls/1993"},"html":{"href":"https://github.com/ianstormtaylor/slate/pull/1993"},"issue":{"href":"https://api.github.com/repos/ianstormtaylor/slate/issues/1993"},"comments":{"href":"https://api.github.com/repos/ianstormtaylor/slate/issues/1993/comments"},"review_comments":{"href":"https://api.github.com/repos/ianstormtaylor/slate/pulls/1993/comments"},"review_comment":{"href":"https://api.github.com/repos/ianstormtaylor/slate/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ianstormtaylor/slate/pulls/1993/commits"},"statuses":{"href":"https://api.github.com/repos/ianstormtaylor/slate/statuses/0a885d32e01d0d138fe84165374151898529de91"}},"author_association":"OWNER","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":3,"additions":746,"deletions":492,"changed_files":47}}
{"actor":{"display_login":"ianstormtaylor"}}