{"action":"created","issue":{"url":"https://api.github.com/repos/glennjones/hapi-swagger/issues/331","repository_url":"https://api.github.com/repos/glennjones/hapi-swagger","labels_url":"https://api.github.com/repos/glennjones/hapi-swagger/issues/331/labels{/name}","comments_url":"https://api.github.com/repos/glennjones/hapi-swagger/issues/331/comments","events_url":"https://api.github.com/repos/glennjones/hapi-swagger/issues/331/events","html_url":"https://github.com/glennjones/hapi-swagger/issues/331","id":174142010,"number":331,"title":"Arrays in schemas show up as a separate model","user":{"login":"irothschild","id":6143611,"avatar_url":"https://avatars.githubusercontent.com/u/6143611?v=3","gravatar_id":"","url":"https://api.github.com/users/irothschild","html_url":"https://github.com/irothschild","followers_url":"https://api.github.com/users/irothschild/followers","following_url":"https://api.github.com/users/irothschild/following{/other_user}","gists_url":"https://api.github.com/users/irothschild/gists{/gist_id}","starred_url":"https://api.github.com/users/irothschild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/irothschild/subscriptions","organizations_url":"https://api.github.com/users/irothschild/orgs","repos_url":"https://api.github.com/users/irothschild/repos","events_url":"https://api.github.com/users/irothschild/events{/privacy}","received_events_url":"https://api.github.com/users/irothschild/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-30T22:30:45Z","updated_at":"2016-09-07T07:26:39Z","closed_at":null,"body":"v7.1.0\r\n\r\nIf I have:\r\n\r\n```\r\n\"topten\": Joi.array().items(\r\n    Joi.object({\r\n        name: Joi.string().required().label('name').description('user name'),\r\n        score: Joi.number().required().min(0).label('score')\r\n    }).label('TopTen')\r\n```\r\n\r\nI get something like:\r\n\r\n```\r\n{\r\n  topten (topten, optional)\r\n}\r\n\r\ntopten [\r\n    TopTen\r\n]\r\n\r\nTopTen {\r\n    name (string): user name ,\r\n    score (number),\r\n}\r\n```\r\n\r\nI would like to get something like:\r\n\r\n```\r\n{\r\n  topten (Array of TopTen, optional)\r\n}\r\n\r\nTopTen {\r\n    name (string): user name ,\r\n    score (number),\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/glennjones/hapi-swagger/issues/comments/245197808","html_url":"https://github.com/glennjones/hapi-swagger/issues/331#issuecomment-245197808","issue_url":"https://api.github.com/repos/glennjones/hapi-swagger/issues/331","id":245197808,"user":{"login":"glennjones","id":175288,"avatar_url":"https://avatars.githubusercontent.com/u/175288?v=3","gravatar_id":"","url":"https://api.github.com/users/glennjones","html_url":"https://github.com/glennjones","followers_url":"https://api.github.com/users/glennjones/followers","following_url":"https://api.github.com/users/glennjones/following{/other_user}","gists_url":"https://api.github.com/users/glennjones/gists{/gist_id}","starred_url":"https://api.github.com/users/glennjones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glennjones/subscriptions","organizations_url":"https://api.github.com/users/glennjones/orgs","repos_url":"https://api.github.com/users/glennjones/repos","events_url":"https://api.github.com/users/glennjones/events{/privacy}","received_events_url":"https://api.github.com/users/glennjones/received_events","type":"User","site_admin":false},"created_at":"2016-09-07T07:26:38Z","updated_at":"2016-09-07T07:26:38Z","body":"HI this was a hard problem as because of all the different combination people use when constructing validation objects. The issue #337 also made the Model output I first suggested above not possible.  \r\n\r\nBut hopefully v7.2.0 has a workable solutions. The main change is adding a label to the `Joi.array()` object.\r\n\r\nIf you use\r\n```\r\nvalidate: {\r\n    payload: Joi.array().items(Joi.object({\r\n        name: Joi.string().required().label('name').description('username'),\r\n        score: Joi.number().required().min(0).label('score')\r\n    }).label('TopTen')).label('TopTenList')\r\n}\r\n```\r\n\r\nWhich now gives the models\r\n\r\n```\r\nTopTenList [\r\n   TopTen\r\n]\r\n\r\nTopTen {\r\n   name (string): username ,\r\n   score (number)\r\n}\r\n```\r\n\r\nHope this is OK the ouput is now as closer to your request as I think I can get. Can you download v7.2.0 and tell me if the above fixes your issue\r\n\r\n"}}
{"actor":{"display_login":"glennjones"}}