{"action":"created","issue":{"url":"https://api.github.com/repos/epoberezkin/ajv/issues/75","labels_url":"https://api.github.com/repos/epoberezkin/ajv/issues/75/labels{/name}","comments_url":"https://api.github.com/repos/epoberezkin/ajv/issues/75/comments","events_url":"https://api.github.com/repos/epoberezkin/ajv/issues/75/events","html_url":"https://github.com/epoberezkin/ajv/issues/75","id":118324083,"number":75,"title":"applyDefault option","user":{"login":"Duncan00","id":2004375,"avatar_url":"https://avatars.githubusercontent.com/u/2004375?v=3","gravatar_id":"","url":"https://api.github.com/users/Duncan00","html_url":"https://github.com/Duncan00","followers_url":"https://api.github.com/users/Duncan00/followers","following_url":"https://api.github.com/users/Duncan00/following{/other_user}","gists_url":"https://api.github.com/users/Duncan00/gists{/gist_id}","starred_url":"https://api.github.com/users/Duncan00/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Duncan00/subscriptions","organizations_url":"https://api.github.com/users/Duncan00/orgs","repos_url":"https://api.github.com/users/Duncan00/repos","events_url":"https://api.github.com/users/Duncan00/events{/privacy}","received_events_url":"https://api.github.com/users/Duncan00/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/epoberezkin/ajv/labels/duplicate","name":"duplicate","color":"cccccc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-23T05:55:01Z","updated_at":"2015-11-23T09:32:08Z","closed_at":null,"body":"Does ajv have an option to apply default value from schema to input json if the property is not exist?\r\nIt would be nice to have feature."},"comment":{"url":"https://api.github.com/repos/epoberezkin/ajv/issues/comments/158887043","html_url":"https://github.com/epoberezkin/ajv/issues/75#issuecomment-158887043","issue_url":"https://api.github.com/repos/epoberezkin/ajv/issues/75","id":158887043,"user":{"login":"Duncan00","id":2004375,"avatar_url":"https://avatars.githubusercontent.com/u/2004375?v=3","gravatar_id":"","url":"https://api.github.com/users/Duncan00","html_url":"https://github.com/Duncan00","followers_url":"https://api.github.com/users/Duncan00/followers","following_url":"https://api.github.com/users/Duncan00/following{/other_user}","gists_url":"https://api.github.com/users/Duncan00/gists{/gist_id}","starred_url":"https://api.github.com/users/Duncan00/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Duncan00/subscriptions","organizations_url":"https://api.github.com/users/Duncan00/orgs","repos_url":"https://api.github.com/users/Duncan00/repos","events_url":"https://api.github.com/users/Duncan00/events{/privacy}","received_events_url":"https://api.github.com/users/Duncan00/received_events","type":"User","site_admin":false},"created_at":"2015-11-23T09:32:08Z","updated_at":"2015-11-23T09:32:08Z","body":"Thanks~ i just use https://www.npmjs.com/package/json-schema-defaults before doing validation now.\r\n\r\nvar defaults = require('json-schema-defaults');\r\nvar default_json = defaults(validate.schema); // and then remove undefined objects\r\n_.defaultsDeep(payload, default_json);\r\n"}}