{"action":"opened","issue":{"url":"https://api.github.com/repos/raphael/goa/issues/175","labels_url":"https://api.github.com/repos/raphael/goa/issues/175/labels{/name}","comments_url":"https://api.github.com/repos/raphael/goa/issues/175/comments","events_url":"https://api.github.com/repos/raphael/goa/issues/175/events","html_url":"https://github.com/raphael/goa/issues/175","id":126430639,"number":175,"title":"Nested View marshal default instead of View(\"tiny\")","user":{"login":"MathieuDoyon","id":1854511,"avatar_url":"https://avatars.githubusercontent.com/u/1854511?v=3","gravatar_id":"","url":"https://api.github.com/users/MathieuDoyon","html_url":"https://github.com/MathieuDoyon","followers_url":"https://api.github.com/users/MathieuDoyon/followers","following_url":"https://api.github.com/users/MathieuDoyon/following{/other_user}","gists_url":"https://api.github.com/users/MathieuDoyon/gists{/gist_id}","starred_url":"https://api.github.com/users/MathieuDoyon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MathieuDoyon/subscriptions","organizations_url":"https://api.github.com/users/MathieuDoyon/orgs","repos_url":"https://api.github.com/users/MathieuDoyon/repos","events_url":"https://api.github.com/users/MathieuDoyon/events{/privacy}","received_events_url":"https://api.github.com/users/MathieuDoyon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-13T14:35:12Z","updated_at":"2016-01-13T14:35:12Z","closed_at":null,"body":"I want to embed a nested collection of X media type with tiny view instead of default. How can we do that.\r\n\r\nExample of what I need.\r\n```go\r\npackage design\r\n\r\nimport (\r\n\t. \"github.com/raphael/goa/design\"\r\n\t. \"github.com/raphael/goa/design/dsl\"\r\n)\r\n\r\nvar _ = API(\"test\", func() {\r\n\tTitle(\"Nested View test API\")\r\n\tHost(\"localhost:8080\")\r\n\tScheme(\"http\")\r\n})\r\n\r\nvar _ = Resource(\"event\", func() {\r\n\tBasePath(\"/events\")\r\n\tDefaultMedia(Event)\r\n\tAction(\"list\", func() {\r\n\t\tRouting(GET(\"\"))\r\n\t\tDescription(\"List all event with tiny embeded prices\")\r\n\t\tResponse(OK, func() {\r\n\t\t\tMedia(CollectionOf(Event, func() {\r\n\t\t\t\tView(\"default\")\r\n\t\t\t\tView(\"tiny\")\r\n\t\t\t}))\r\n\t\t})\r\n\t\tResponse(NotFound)\r\n\t})\r\n\tAction(\"show\", func() {\r\n\t\tDescription(\"Retrieve event with given id\")\r\n\t\tRouting(GET(\"/:eventID\"))\r\n\t\tParams(func() {\r\n\t\t\tParam(\"eventID\", String, \"Event ID\")\r\n\t\t})\r\n\t\tResponse(OK)\r\n\t\tResponse(NotFound)\r\n\t})\r\n})\r\n\r\n// Event media type\r\nvar Event = MediaType(\"application/vnd.event+json\", func() {\r\n\tDescription(\"A event information\")\r\n\tAttributes(func() {\r\n\t\tAttribute(\"id\", String, \"Unique event ID\")\r\n\t\tAttribute(\"href\", String, \"API href of event\")\r\n\t\tAttribute(\"title\", String, \"Title\")\r\n\t\tAttribute(\"prices\", ArrayOf(Price), \"Price collection for this event\")\r\n\r\n\t\tRequired(\"id\", \"title\")\r\n\t})\r\n\tView(\"default\", func() {\r\n\t\tAttribute(\"id\")\r\n\t\tAttribute(\"href\")\r\n\t\tAttribute(\"title\")\r\n\t\t// ... more attributes here\r\n\t\tAttribute(\"prices\", func() {\r\n\t\t\tView(\"default\")\r\n\t\t})\r\n\t})\r\n\tView(\"tiny\", func() {\r\n\t\tAttribute(\"id\")\r\n\t\tAttribute(\"title\")\r\n\t\tAttribute(\"href\")\r\n\t\tAttribute(\"prices\", func() {\r\n\t\t\tView(\"tiny\")\r\n\t\t})\r\n\t})\r\n\r\n})\r\n\r\nvar _ = Resource(\"price\", func() {\r\n\tParent(\"event\")\r\n\tBasePath(\"prices\")\r\n\tDefaultMedia(Price)\r\n\tAction(\"list\", func() {\r\n\t\tRouting(GET(\"\"))\r\n\t\tDescription(\"List all price price in event\")\r\n\t\tResponse(OK, func() {\r\n\t\t\tMedia(CollectionOf(Price, func() {\r\n\t\t\t\tView(\"default\")\r\n\t\t\t}))\r\n\t\t})\r\n\t\tResponse(NotFound)\r\n\t})\r\n\tAction(\"show\", func() {\r\n\t\tDescription(\"Retrieve price with given id\")\r\n\t\tRouting(GET(\"/:priceID\"))\r\n\t\tParams(func() {\r\n\t\t\tParam(\"priceID\", String, \"Price ID\")\r\n\t\t})\r\n\t\tResponse(OK)\r\n\t\tResponse(NotFound)\r\n\t})\r\n})\r\n\r\n// Price price media type\r\nvar Price = MediaType(\"application/vnd.price+json\", func() {\r\n\tDescription(\"Price\")\r\n\tAttributes(func() {\r\n\t\tAttribute(\"id\", String, \"Unique price ID\")\r\n\t\tAttribute(\"name\", String, \"general name to use for ticket\")\r\n\t\tAttribute(\"order\", Integer, \"ascending order of tickets as shown on event page\")\r\n\t\tAttribute(\"price\", Number, \"the value of the ticket, 0.00 when free\")\r\n\r\n\t\tRequired(\"id\", \"name\")\r\n\t})\r\n\r\n\tView(\"default\", func() {\r\n\t\tAttribute(\"id\")\r\n\t\tAttribute(\"name\")\r\n\t\tAttribute(\"order\")\r\n\t\tAttribute(\"price\")\r\n\t})\r\n\r\n\tView(\"tiny\", func() {\r\n\t\tAttribute(\"id\")\r\n\t\tAttribute(\"price\")\r\n\t})\r\n\r\n\tView(\"link\", func() {\r\n\t\tAttribute(\"id\")\r\n\t\tAttribute(\"price\")\r\n\t})\r\n})\r\n\r\n```\r\n\r\ngenerated code will look like\r\n```go\r\n// MarshalEventTiny validates and renders an instance of Event into a interface{}\r\n// using view \"tiny\".\r\nfunc MarshalEventTiny(source *Event, inErr error) (target map[string]interface{}, err error) {\r\n\t...\r\n\tif source.Prices != nil {\r\n\t\t...\r\n\t\t\ttmp6[tmp7], err = MarshalPrice(tmp8, err)\r\n\t\t...\r\n\t}\r\n\t...\r\n}\r\n```\r\n\r\nShould be `tmp6[tmp7], err = MarshalPriceTiny(tmp8, err)`"}}