{"action":"created","comment":{"url":"https://api.github.com/repos/fastify/fastify/pulls/comments/165355575","pull_request_review_id":93280127,"id":165355575,"diff_hunk":"@@ -143,6 +143,14 @@ The logger instance, check [here](https://github.com/fastify/fastify/blob/master\n #### inject\n Fake http injection (for testing purposes) [here](https://github.com/fastify/fastify/blob/master/docs/Testing.md#inject).\n \n+<a name=\"add-schema\"></a>\n+#### addSchema\n+`fastify.addSchema(schemaObj)`, adds a shared schema to the Fastify instance. This allows you to reuse it everywhere in your application just by writing the schema id that you need.<br/>\n+To learn more, see [shared schema example](https://github.com/fastify/fastify/blob/master/docs/Validation-and-Serialization.md#shared-schema) in the [Validation and Serialization](https://github.com/fastify/fastify/blob/master/docs/Validation-and-Serialization.md) documentation.\n+\n+\n+You can see [here](https://github.com/fastify/fastify/blob/master/docs/Validation-and-Serialization.md#shared-schema) how it works.","path":"docs/Server-Methods.md","position":10,"original_position":10,"commit_id":"367430bd0a09fa75e1f64aaffe6c1856fde2ebb1","original_commit_id":"367430bd0a09fa75e1f64aaffe6c1856fde2ebb1","user":{"login":"jsumners","id":321201,"avatar_url":"https://avatars1.githubusercontent.com/u/321201?v=4","gravatar_id":"","url":"https://api.github.com/users/jsumners","html_url":"https://github.com/jsumners","followers_url":"https://api.github.com/users/jsumners/followers","following_url":"https://api.github.com/users/jsumners/following{/other_user}","gists_url":"https://api.github.com/users/jsumners/gists{/gist_id}","starred_url":"https://api.github.com/users/jsumners/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsumners/subscriptions","organizations_url":"https://api.github.com/users/jsumners/orgs","repos_url":"https://api.github.com/users/jsumners/repos","events_url":"https://api.github.com/users/jsumners/events{/privacy}","received_events_url":"https://api.github.com/users/jsumners/received_events","type":"User","site_admin":false},"body":"This sentence is redundant. It should be removed.","created_at":"2018-02-01T13:32:08Z","updated_at":"2018-02-01T13:32:21Z","html_url":"https://github.com/fastify/fastify/pull/735#discussion_r165355575","pull_request_url":"https://api.github.com/repos/fastify/fastify/pulls/735","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/fastify/fastify/pulls/comments/165355575"},"html":{"href":"https://github.com/fastify/fastify/pull/735#discussion_r165355575"},"pull_request":{"href":"https://api.github.com/repos/fastify/fastify/pulls/735"}}},"pull_request":{"url":"https://api.github.com/repos/fastify/fastify/pulls/735","id":166479754,"html_url":"https://github.com/fastify/fastify/pull/735","diff_url":"https://github.com/fastify/fastify/pull/735.diff","patch_url":"https://github.com/fastify/fastify/pull/735.patch","issue_url":"https://api.github.com/repos/fastify/fastify/issues/735","number":735,"state":"open","locked":false,"title":"Feature: Shared schemas","user":{"login":"delvedor","id":4865608,"avatar_url":"https://avatars0.githubusercontent.com/u/4865608?v=4","gravatar_id":"","url":"https://api.github.com/users/delvedor","html_url":"https://github.com/delvedor","followers_url":"https://api.github.com/users/delvedor/followers","following_url":"https://api.github.com/users/delvedor/following{/other_user}","gists_url":"https://api.github.com/users/delvedor/gists{/gist_id}","starred_url":"https://api.github.com/users/delvedor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delvedor/subscriptions","organizations_url":"https://api.github.com/users/delvedor/orgs","repos_url":"https://api.github.com/users/delvedor/repos","events_url":"https://api.github.com/users/delvedor/events{/privacy}","received_events_url":"https://api.github.com/users/delvedor/received_events","type":"User","site_admin":false},"body":"The implementation does not use any method of Ajv, but tries to solve all the references inside and then let Ajv compile the schema. In this way any json schema based validation library will work, regardless of its api.\r\n\r\nThe original idea of this feature was of @dougrich in https://github.com/fastify/fastify/pull/528.\r\n\r\n#### Checklist\r\n\r\n- [x] run `npm run test` and `npm run benchmark`\r\n- [x] tests and/or benchmarks are included\r\n- [x] documentation is changed or added\r\n- [x] commit message and code follows [Code of conduct](https://github.com/fastify/fastify/blob/master/CODE_OF_CONDUCT.md)\r\n","created_at":"2018-02-01T09:10:37Z","updated_at":"2018-02-01T13:32:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"897752805c4ffc127544076b499eff1059862c4b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":{"url":"https://api.github.com/repos/fastify/fastify/milestones/1","html_url":"https://github.com/fastify/fastify/milestone/1","labels_url":"https://api.github.com/repos/fastify/fastify/milestones/1/labels","id":2947145,"number":1,"title":"v1.0.0","description":"","creator":{"login":"delvedor","id":4865608,"avatar_url":"https://avatars0.githubusercontent.com/u/4865608?v=4","gravatar_id":"","url":"https://api.github.com/users/delvedor","html_url":"https://github.com/delvedor","followers_url":"https://api.github.com/users/delvedor/followers","following_url":"https://api.github.com/users/delvedor/following{/other_user}","gists_url":"https://api.github.com/users/delvedor/gists{/gist_id}","starred_url":"https://api.github.com/users/delvedor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delvedor/subscriptions","organizations_url":"https://api.github.com/users/delvedor/orgs","repos_url":"https://api.github.com/users/delvedor/repos","events_url":"https://api.github.com/users/delvedor/events{/privacy}","received_events_url":"https://api.github.com/users/delvedor/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":29,"state":"open","created_at":"2017-11-29T17:01:39Z","updated_at":"2018-02-01T09:23:08Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/fastify/fastify/pulls/735/commits","review_comments_url":"https://api.github.com/repos/fastify/fastify/pulls/735/comments","review_comment_url":"https://api.github.com/repos/fastify/fastify/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fastify/fastify/issues/735/comments","statuses_url":"https://api.github.com/repos/fastify/fastify/statuses/367430bd0a09fa75e1f64aaffe6c1856fde2ebb1","head":{"label":"fastify:shared-schemas","ref":"shared-schemas","sha":"367430bd0a09fa75e1f64aaffe6c1856fde2ebb1","user":{"login":"fastify","id":24939410,"avatar_url":"https://avatars3.githubusercontent.com/u/24939410?v=4","gravatar_id":"","url":"https://api.github.com/users/fastify","html_url":"https://github.com/fastify","followers_url":"https://api.github.com/users/fastify/followers","following_url":"https://api.github.com/users/fastify/following{/other_user}","gists_url":"https://api.github.com/users/fastify/gists{/gist_id}","starred_url":"https://api.github.com/users/fastify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fastify/subscriptions","organizations_url":"https://api.github.com/users/fastify/orgs","repos_url":"https://api.github.com/users/fastify/repos","events_url":"https://api.github.com/users/fastify/events{/privacy}","received_events_url":"https://api.github.com/users/fastify/received_events","type":"Organization","site_admin":false},"repo":{"id":69495170,"name":"fastify","full_name":"fastify/fastify","owner":{"login":"fastify","id":24939410,"avatar_url":"https://avatars3.githubusercontent.com/u/24939410?v=4","gravatar_id":"","url":"https://api.github.com/users/fastify","html_url":"https://github.com/fastify","followers_url":"https://api.github.com/users/fastify/followers","following_url":"https://api.github.com/users/fastify/following{/other_user}","gists_url":"https://api.github.com/users/fastify/gists{/gist_id}","starred_url":"https://api.github.com/users/fastify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fastify/subscriptions","organizations_url":"https://api.github.com/users/fastify/orgs","repos_url":"https://api.github.com/users/fastify/repos","events_url":"https://api.github.com/users/fastify/events{/privacy}","received_events_url":"https://api.github.com/users/fastify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fastify/fastify","description":"Fast and low overhead web framework, for Node.js","fork":false,"url":"https://api.github.com/repos/fastify/fastify","forks_url":"https://api.github.com/repos/fastify/fastify/forks","keys_url":"https://api.github.com/repos/fastify/fastify/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fastify/fastify/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fastify/fastify/teams","hooks_url":"https://api.github.com/repos/fastify/fastify/hooks","issue_events_url":"https://api.github.com/repos/fastify/fastify/issues/events{/number}","events_url":"https://api.github.com/repos/fastify/fastify/events","assignees_url":"https://api.github.com/repos/fastify/fastify/assignees{/user}","branches_url":"https://api.github.com/repos/fastify/fastify/branches{/branch}","tags_url":"https://api.github.com/repos/fastify/fastify/tags","blobs_url":"https://api.github.com/repos/fastify/fastify/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fastify/fastify/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fastify/fastify/git/refs{/sha}","trees_url":"https://api.github.com/repos/fastify/fastify/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fastify/fastify/statuses/{sha}","languages_url":"https://api.github.com/repos/fastify/fastify/languages","stargazers_url":"https://api.github.com/repos/fastify/fastify/stargazers","contributors_url":"https://api.github.com/repos/fastify/fastify/contributors","subscribers_url":"https://api.github.com/repos/fastify/fastify/subscribers","subscription_url":"https://api.github.com/repos/fastify/fastify/subscription","commits_url":"https://api.github.com/repos/fastify/fastify/commits{/sha}","git_commits_url":"https://api.github.com/repos/fastify/fastify/git/commits{/sha}","comments_url":"https://api.github.com/repos/fastify/fastify/comments{/number}","issue_comment_url":"https://api.github.com/repos/fastify/fastify/issues/comments{/number}","contents_url":"https://api.github.com/repos/fastify/fastify/contents/{+path}","compare_url":"https://api.github.com/repos/fastify/fastify/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fastify/fastify/merges","archive_url":"https://api.github.com/repos/fastify/fastify/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fastify/fastify/downloads","issues_url":"https://api.github.com/repos/fastify/fastify/issues{/number}","pulls_url":"https://api.github.com/repos/fastify/fastify/pulls{/number}","milestones_url":"https://api.github.com/repos/fastify/fastify/milestones{/number}","notifications_url":"https://api.github.com/repos/fastify/fastify/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fastify/fastify/labels{/name}","releases_url":"https://api.github.com/repos/fastify/fastify/releases{/id}","deployments_url":"https://api.github.com/repos/fastify/fastify/deployments","created_at":"2016-09-28T19:10:14Z","updated_at":"2018-02-01T13:12:47Z","pushed_at":"2018-02-01T13:29:42Z","git_url":"git://github.com/fastify/fastify.git","ssh_url":"git@github.com:fastify/fastify.git","clone_url":"https://github.com/fastify/fastify.git","svn_url":"https://github.com/fastify/fastify","homepage":"https://www.fastify.io","size":1274,"stargazers_count":6199,"watchers_count":6199,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":315,"mirror_url":null,"archived":false,"open_issues_count":22,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":315,"open_issues":22,"watchers":6199,"default_branch":"master"}},"base":{"label":"fastify:master","ref":"master","sha":"c429171850a6b36bd19dd9645118fcd62fadb24e","user":{"login":"fastify","id":24939410,"avatar_url":"https://avatars3.githubusercontent.com/u/24939410?v=4","gravatar_id":"","url":"https://api.github.com/users/fastify","html_url":"https://github.com/fastify","followers_url":"https://api.github.com/users/fastify/followers","following_url":"https://api.github.com/users/fastify/following{/other_user}","gists_url":"https://api.github.com/users/fastify/gists{/gist_id}","starred_url":"https://api.github.com/users/fastify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fastify/subscriptions","organizations_url":"https://api.github.com/users/fastify/orgs","repos_url":"https://api.github.com/users/fastify/repos","events_url":"https://api.github.com/users/fastify/events{/privacy}","received_events_url":"https://api.github.com/users/fastify/received_events","type":"Organization","site_admin":false},"repo":{"id":69495170,"name":"fastify","full_name":"fastify/fastify","owner":{"login":"fastify","id":24939410,"avatar_url":"https://avatars3.githubusercontent.com/u/24939410?v=4","gravatar_id":"","url":"https://api.github.com/users/fastify","html_url":"https://github.com/fastify","followers_url":"https://api.github.com/users/fastify/followers","following_url":"https://api.github.com/users/fastify/following{/other_user}","gists_url":"https://api.github.com/users/fastify/gists{/gist_id}","starred_url":"https://api.github.com/users/fastify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fastify/subscriptions","organizations_url":"https://api.github.com/users/fastify/orgs","repos_url":"https://api.github.com/users/fastify/repos","events_url":"https://api.github.com/users/fastify/events{/privacy}","received_events_url":"https://api.github.com/users/fastify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fastify/fastify","description":"Fast and low overhead web framework, for Node.js","fork":false,"url":"https://api.github.com/repos/fastify/fastify","forks_url":"https://api.github.com/repos/fastify/fastify/forks","keys_url":"https://api.github.com/repos/fastify/fastify/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fastify/fastify/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fastify/fastify/teams","hooks_url":"https://api.github.com/repos/fastify/fastify/hooks","issue_events_url":"https://api.github.com/repos/fastify/fastify/issues/events{/number}","events_url":"https://api.github.com/repos/fastify/fastify/events","assignees_url":"https://api.github.com/repos/fastify/fastify/assignees{/user}","branches_url":"https://api.github.com/repos/fastify/fastify/branches{/branch}","tags_url":"https://api.github.com/repos/fastify/fastify/tags","blobs_url":"https://api.github.com/repos/fastify/fastify/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fastify/fastify/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fastify/fastify/git/refs{/sha}","trees_url":"https://api.github.com/repos/fastify/fastify/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fastify/fastify/statuses/{sha}","languages_url":"https://api.github.com/repos/fastify/fastify/languages","stargazers_url":"https://api.github.com/repos/fastify/fastify/stargazers","contributors_url":"https://api.github.com/repos/fastify/fastify/contributors","subscribers_url":"https://api.github.com/repos/fastify/fastify/subscribers","subscription_url":"https://api.github.com/repos/fastify/fastify/subscription","commits_url":"https://api.github.com/repos/fastify/fastify/commits{/sha}","git_commits_url":"https://api.github.com/repos/fastify/fastify/git/commits{/sha}","comments_url":"https://api.github.com/repos/fastify/fastify/comments{/number}","issue_comment_url":"https://api.github.com/repos/fastify/fastify/issues/comments{/number}","contents_url":"https://api.github.com/repos/fastify/fastify/contents/{+path}","compare_url":"https://api.github.com/repos/fastify/fastify/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fastify/fastify/merges","archive_url":"https://api.github.com/repos/fastify/fastify/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fastify/fastify/downloads","issues_url":"https://api.github.com/repos/fastify/fastify/issues{/number}","pulls_url":"https://api.github.com/repos/fastify/fastify/pulls{/number}","milestones_url":"https://api.github.com/repos/fastify/fastify/milestones{/number}","notifications_url":"https://api.github.com/repos/fastify/fastify/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fastify/fastify/labels{/name}","releases_url":"https://api.github.com/repos/fastify/fastify/releases{/id}","deployments_url":"https://api.github.com/repos/fastify/fastify/deployments","created_at":"2016-09-28T19:10:14Z","updated_at":"2018-02-01T13:12:47Z","pushed_at":"2018-02-01T13:29:42Z","git_url":"git://github.com/fastify/fastify.git","ssh_url":"git@github.com:fastify/fastify.git","clone_url":"https://github.com/fastify/fastify.git","svn_url":"https://github.com/fastify/fastify","homepage":"https://www.fastify.io","size":1274,"stargazers_count":6199,"watchers_count":6199,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":315,"mirror_url":null,"archived":false,"open_issues_count":22,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":315,"open_issues":22,"watchers":6199,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fastify/fastify/pulls/735"},"html":{"href":"https://github.com/fastify/fastify/pull/735"},"issue":{"href":"https://api.github.com/repos/fastify/fastify/issues/735"},"comments":{"href":"https://api.github.com/repos/fastify/fastify/issues/735/comments"},"review_comments":{"href":"https://api.github.com/repos/fastify/fastify/pulls/735/comments"},"review_comment":{"href":"https://api.github.com/repos/fastify/fastify/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fastify/fastify/pulls/735/commits"},"statuses":{"href":"https://api.github.com/repos/fastify/fastify/statuses/367430bd0a09fa75e1f64aaffe6c1856fde2ebb1"}},"author_association":"OWNER"}}
{"actor":{"display_login":"jsumners"}}