{"action":"created","issue":{"url":"https://api.github.com/repos/neumino/thinky/issues/202","labels_url":"https://api.github.com/repos/neumino/thinky/issues/202/labels{/name}","comments_url":"https://api.github.com/repos/neumino/thinky/issues/202/comments","events_url":"https://api.github.com/repos/neumino/thinky/issues/202/events","html_url":"https://github.com/neumino/thinky/pull/202","id":63298813,"number":202,"title":"Fix embeded chainables","user":{"login":"chrisfosterelli","id":2072672,"avatar_url":"https://avatars.githubusercontent.com/u/2072672?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisfosterelli","html_url":"https://github.com/chrisfosterelli","followers_url":"https://api.github.com/users/chrisfosterelli/followers","following_url":"https://api.github.com/users/chrisfosterelli/following{/other_user}","gists_url":"https://api.github.com/users/chrisfosterelli/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisfosterelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisfosterelli/subscriptions","organizations_url":"https://api.github.com/users/chrisfosterelli/orgs","repos_url":"https://api.github.com/users/chrisfosterelli/repos","events_url":"https://api.github.com/users/chrisfosterelli/events{/privacy}","received_events_url":"https://api.github.com/users/chrisfosterelli/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-20T20:11:37Z","updated_at":"2015-03-21T01:21:27Z","closed_at":"2015-03-21T01:07:31Z","pull_request":{"url":"https://api.github.com/repos/neumino/thinky/pulls/202","html_url":"https://github.com/neumino/thinky/pull/202","diff_url":"https://github.com/neumino/thinky/pull/202.diff","patch_url":"https://github.com/neumino/thinky/pull/202.patch"},"body":"A recent Thinky update broke chainable types inside of a nested object array.\r\nHere is an example of a schema that is currently broken:\r\n\r\n```javascript\r\nvar thinky = require('thinky')();\r\nvar Model = thinky.createModel('Model', {\r\n  id : String,\r\n  objectArray : [{\r\n    myAttribute : thinky.type.object()\r\n  }]\r\n});\r\n```\r\n\r\nThat throws:\r\n\r\n```\r\nTypeError: Cannot read property 'enforce_missing' of undefined\r\n    at parse (/.../thinky/lib/schema.js:218:123)\r\n    at /.../thinky/lib/schema.js:228:28\r\n    at Object.loopKeys (/.../thinky/lib/util.js:203:16)\r\n    at parse (/.../thinky/lib/schema.js:227:12)\r\n    at parse (/.../thinky/lib/schema.js:243:21)\r\n    at /.../thinky/lib/schema.js:228:28\r\n    at Object.loopKeys (/.../thinky/lib/util.js:203:16)\r\n    at Object.parse (/.../thinky/lib/schema.js:227:12)\r\n    at new Model (/.../thinky/lib/model.js:34:29)\r\n    at Function.Model.new (/.../thinky/lib/model.js:95:15)\r\n```\r\n\r\nThis was the result of a typo that accidentally passed `options` as `undefined` to the `parse` function. Later on, this would result in an exception when `options.enforce_missing` was accessed. I'm sure there are other schema structures that would trigger this exception, but this fix should correct all of them.\r\n\r\nI added a test, but not sure if it's in the right place or follows project guidelines. Let me know if it needs revision!"},"comment":{"url":"https://api.github.com/repos/neumino/thinky/issues/comments/84214999","html_url":"https://github.com/neumino/thinky/pull/202#issuecomment-84214999","issue_url":"https://api.github.com/repos/neumino/thinky/issues/202","id":84214999,"user":{"login":"chrisfosterelli","id":2072672,"avatar_url":"https://avatars.githubusercontent.com/u/2072672?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisfosterelli","html_url":"https://github.com/chrisfosterelli","followers_url":"https://api.github.com/users/chrisfosterelli/followers","following_url":"https://api.github.com/users/chrisfosterelli/following{/other_user}","gists_url":"https://api.github.com/users/chrisfosterelli/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisfosterelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisfosterelli/subscriptions","organizations_url":"https://api.github.com/users/chrisfosterelli/orgs","repos_url":"https://api.github.com/users/chrisfosterelli/repos","events_url":"https://api.github.com/users/chrisfosterelli/events{/privacy}","received_events_url":"https://api.github.com/users/chrisfosterelli/received_events","type":"User","site_admin":false},"created_at":"2015-03-21T01:21:27Z","updated_at":"2015-03-21T01:21:27Z","body":"Glad to help!"}}