{"action":"created","issue":{"url":"https://api.github.com/repos/paularmstrong/normalizr/issues/135","repository_url":"https://api.github.com/repos/paularmstrong/normalizr","labels_url":"https://api.github.com/repos/paularmstrong/normalizr/issues/135/labels{/name}","comments_url":"https://api.github.com/repos/paularmstrong/normalizr/issues/135/comments","events_url":"https://api.github.com/repos/paularmstrong/normalizr/issues/135/events","html_url":"https://github.com/paularmstrong/normalizr/pull/135","id":165986889,"number":135,"title":"It should be possible to use relations","user":{"login":"TryingToImprove","id":1690457,"avatar_url":"https://avatars.githubusercontent.com/u/1690457?v=3","gravatar_id":"","url":"https://api.github.com/users/TryingToImprove","html_url":"https://github.com/TryingToImprove","followers_url":"https://api.github.com/users/TryingToImprove/followers","following_url":"https://api.github.com/users/TryingToImprove/following{/other_user}","gists_url":"https://api.github.com/users/TryingToImprove/gists{/gist_id}","starred_url":"https://api.github.com/users/TryingToImprove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TryingToImprove/subscriptions","organizations_url":"https://api.github.com/users/TryingToImprove/orgs","repos_url":"https://api.github.com/users/TryingToImprove/repos","events_url":"https://api.github.com/users/TryingToImprove/events{/privacy}","received_events_url":"https://api.github.com/users/TryingToImprove/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-17T17:38:38Z","updated_at":"2016-07-17T17:50:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/paularmstrong/normalizr/pulls/135","html_url":"https://github.com/paularmstrong/normalizr/pull/135","diff_url":"https://github.com/paularmstrong/normalizr/pull/135.diff","patch_url":"https://github.com/paularmstrong/normalizr/pull/135.patch"},"body":"# Problem\r\n\r\nSome objects have arrays with objects, which does not have a identifier, and is\r\ntightly coupled to the parent object.\r\n\r\nI created a issue here: #134\r\n\r\n# Solution\r\n\r\nIt should possible to mark those objects as a relation to the parent object\r\nand use the parent object id as the identifier when normalizing\r\n\r\n# TODO\r\n- [x] Add & Update Tests\r\n\r\n### Use case\r\nSee updated test\r\n"},"comment":{"url":"https://api.github.com/repos/paularmstrong/normalizr/issues/comments/233194428","html_url":"https://github.com/paularmstrong/normalizr/pull/135#issuecomment-233194428","issue_url":"https://api.github.com/repos/paularmstrong/normalizr/issues/135","id":233194428,"user":{"login":"TryingToImprove","id":1690457,"avatar_url":"https://avatars.githubusercontent.com/u/1690457?v=3","gravatar_id":"","url":"https://api.github.com/users/TryingToImprove","html_url":"https://github.com/TryingToImprove","followers_url":"https://api.github.com/users/TryingToImprove/followers","following_url":"https://api.github.com/users/TryingToImprove/following{/other_user}","gists_url":"https://api.github.com/users/TryingToImprove/gists{/gist_id}","starred_url":"https://api.github.com/users/TryingToImprove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TryingToImprove/subscriptions","organizations_url":"https://api.github.com/users/TryingToImprove/orgs","repos_url":"https://api.github.com/users/TryingToImprove/repos","events_url":"https://api.github.com/users/TryingToImprove/events{/privacy}","received_events_url":"https://api.github.com/users/TryingToImprove/received_events","type":"User","site_admin":false},"created_at":"2016-07-17T17:50:49Z","updated_at":"2016-07-17T17:50:49Z","body":"I am not sure if this test should be able to pass:\r\n\r\n```js\r\n  it('can normalize relationship without defining other properties other than id', function () {\r\n    var userSchema = new Schema('users');\r\n    userSchema.define({\r\n      relations: relationOf('userRelations')\r\n    });\r\n\r\n    var input = {\r\n      id: 1,\r\n      relations: [\r\n        { name: 'Trying' },\r\n        { name: 'Normalizing' }\r\n      ]\r\n    };\r\n\r\n    Object.freeze(input);\r\n\r\n    normalize(input, userSchema).should.eql({\r\n      entities: {\r\n        userRelations: {\r\n          1: [{ name: 'Trying' }, { name: 'Normalizing' }]\r\n        }\r\n      },\r\n      result: 1\r\n    })\r\n  })\r\n```"}}
{"actor":{"display_login":"TryingToImprove"}}