{"action":"created","issue":{"url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/92","labels_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/92/labels{/name}","comments_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/92/comments","events_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/92/events","html_url":"https://github.com/samselikoff/ember-cli-mirage/issues/92","id":67896640,"number":92,"title":"[Feature Request] Customize Nesting and Key Names in Response","user":{"login":"ballPointPenguin","id":35609,"avatar_url":"https://avatars.githubusercontent.com/u/35609?v=3","gravatar_id":"","url":"https://api.github.com/users/ballPointPenguin","html_url":"https://github.com/ballPointPenguin","followers_url":"https://api.github.com/users/ballPointPenguin/followers","following_url":"https://api.github.com/users/ballPointPenguin/following{/other_user}","gists_url":"https://api.github.com/users/ballPointPenguin/gists{/gist_id}","starred_url":"https://api.github.com/users/ballPointPenguin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ballPointPenguin/subscriptions","organizations_url":"https://api.github.com/users/ballPointPenguin/orgs","repos_url":"https://api.github.com/users/ballPointPenguin/repos","events_url":"https://api.github.com/users/ballPointPenguin/events{/privacy}","received_events_url":"https://api.github.com/users/ballPointPenguin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-04-12T10:06:35Z","updated_at":"2015-04-12T11:58:59Z","closed_at":null,"body":"As a user of some irregular endpoints, I would like to be able to fully customize how an object is nested and named in the response body of a mirage request that uses factories.\r\n\r\ninstead of:\r\n```\r\nthis.get('/users/current', 'users');\r\n```\r\n\r\nsomething like:\r\n```\r\nthis.get('/users/current', function() {\r\n  var user = factory.create('contact', {id: 1});\r\n  var friends = factory.createList('user', 3);\r\n\r\n  return {\r\n    \"current_user\": user,\r\n    \"friends\": friends,\r\n    \"meta\": { \"other\": \"stuff\" }\r\n  }\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/comments/92046933","html_url":"https://github.com/samselikoff/ember-cli-mirage/issues/92#issuecomment-92046933","issue_url":"https://api.github.com/repos/samselikoff/ember-cli-mirage/issues/92","id":92046933,"user":{"login":"ballPointPenguin","id":35609,"avatar_url":"https://avatars.githubusercontent.com/u/35609?v=3","gravatar_id":"","url":"https://api.github.com/users/ballPointPenguin","html_url":"https://github.com/ballPointPenguin","followers_url":"https://api.github.com/users/ballPointPenguin/followers","following_url":"https://api.github.com/users/ballPointPenguin/following{/other_user}","gists_url":"https://api.github.com/users/ballPointPenguin/gists{/gist_id}","starred_url":"https://api.github.com/users/ballPointPenguin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ballPointPenguin/subscriptions","organizations_url":"https://api.github.com/users/ballPointPenguin/orgs","repos_url":"https://api.github.com/users/ballPointPenguin/repos","events_url":"https://api.github.com/users/ballPointPenguin/events{/privacy}","received_events_url":"https://api.github.com/users/ballPointPenguin/received_events","type":"User","site_admin":false},"created_at":"2015-04-12T11:58:59Z","updated_at":"2015-04-12T11:58:59Z","body":"I was confounding two separate needs: populating the database and serializing the responses.\r\nWhen I started with fixtures, these two things were kind of happening together, in config.js.\r\nNow, using factories, I am realizing that populating the data should happen from the test (or a test helper), and serializing the response can happen in config. It is starting to make sense. :smiley: "}}