{"action":"opened","issue":{"url":"https://api.github.com/repos/Prefinem/nativemodels/issues/5","repository_url":"https://api.github.com/repos/Prefinem/nativemodels","labels_url":"https://api.github.com/repos/Prefinem/nativemodels/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/Prefinem/nativemodels/issues/5/comments","events_url":"https://api.github.com/repos/Prefinem/nativemodels/issues/5/events","html_url":"https://github.com/Prefinem/nativemodels/issues/5","id":355234699,"node_id":"MDU6SXNzdWUzNTUyMzQ2OTk=","number":5,"title":"Allow model to inherit model as type","user":{"login":"Prefinem","id":2748262,"node_id":"MDQ6VXNlcjI3NDgyNjI=","avatar_url":"https://avatars2.githubusercontent.com/u/2748262?v=4","gravatar_id":"","url":"https://api.github.com/users/Prefinem","html_url":"https://github.com/Prefinem","followers_url":"https://api.github.com/users/Prefinem/followers","following_url":"https://api.github.com/users/Prefinem/following{/other_user}","gists_url":"https://api.github.com/users/Prefinem/gists{/gist_id}","starred_url":"https://api.github.com/users/Prefinem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Prefinem/subscriptions","organizations_url":"https://api.github.com/users/Prefinem/orgs","repos_url":"https://api.github.com/users/Prefinem/repos","events_url":"https://api.github.com/users/Prefinem/events{/privacy}","received_events_url":"https://api.github.com/users/Prefinem/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-29T16:16:14Z","updated_at":"2018-08-29T16:16:14Z","closed_at":null,"author_association":"OWNER","body":"## Setup\r\n```javascript\r\nconst contactSchema = {\r\n\temail: string().required(),\r\n\tphone: string(),\r\n\tfax: string(),\r\n};\r\nconst contactModel = objectModel(contactSchema);\r\n\r\nconst userSchema = {\r\n\tfirstName: string().required(),\r\n\tlastName: string().required(),\r\n\tcontact: contactModel\r\n};\r\n\r\nconst userModel = objectModel(userSchema);\r\n```\r\n\r\n## Usage\r\n```javascript\r\nconst johnSmith = userModel({\r\n\tfirstName: 'John',\r\n\tlastName: 'Smith',\r\n\tcontact: {\r\n\t\temail: 'john.smith@example.com'\r\n\t}\r\n});\r\n// => { firstName: 'John', lastName: 'Smith', contact: { email: 'john.smith@example.com' } }\r\n```\r\nOR\r\n```javascript\r\nconst johnSmithContact = contactModel({\r\n\temail: 'john.smith@example.com'\r\n});\r\nconst johnSmith = userModel({\r\n\tfirstName: 'John',\r\n\tlastName: 'Smith',\r\n\tcontact: johnSmithContact\r\n});\r\n// => { firstName: 'John', lastName: 'Smith', contact: { email: 'john.smith@example.com' } }\r\n```\r\n\r\n## Errors\r\n```javascript\r\nconst johnSmith = userModel({\r\n\tfirstName: 'John',\r\n\tlastName: 'Smith',\r\n\tcontact: {\r\n\t\tphone: '+15551234567'\r\n\t}\r\n});\r\n// => Fails\r\n```"}}
{"actor":{"display_login":"Prefinem"}}