{"action":"created","issue":{"url":"https://api.github.com/repos/gilt/apidoc/issues/278","labels_url":"https://api.github.com/repos/gilt/apidoc/issues/278/labels{/name}","comments_url":"https://api.github.com/repos/gilt/apidoc/issues/278/comments","events_url":"https://api.github.com/repos/gilt/apidoc/issues/278/events","html_url":"https://github.com/gilt/apidoc/issues/278","id":56745212,"number":278,"title":"Uniform treatment of models of different types.","user":{"login":"andreyk0","id":393902,"avatar_url":"https://avatars.githubusercontent.com/u/393902?v=3","gravatar_id":"","url":"https://api.github.com/users/andreyk0","html_url":"https://github.com/andreyk0","followers_url":"https://api.github.com/users/andreyk0/followers","following_url":"https://api.github.com/users/andreyk0/following{/other_user}","gists_url":"https://api.github.com/users/andreyk0/gists{/gist_id}","starred_url":"https://api.github.com/users/andreyk0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreyk0/subscriptions","organizations_url":"https://api.github.com/users/andreyk0/orgs","repos_url":"https://api.github.com/users/andreyk0/repos","events_url":"https://api.github.com/users/andreyk0/events{/privacy}","received_events_url":"https://api.github.com/users/andreyk0/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-02-05T23:14:23Z","updated_at":"2015-02-06T00:07:09Z","closed_at":null,"body":"At the moment apidoc treats enums and unions specially, with the top-level JSON entries, outside of 'models' section.\r\n\r\nThe proposal is to treat them all as 'models', e.g.:\r\n\r\n    \"models\": {\r\n\r\n        \"registered_user\": {\r\n            \"fields\": [\r\n                { \"name\": \"guid\", \"type\": \"uuid\", \"description\": \"Internal unique identifier for this user.\" },\r\n                { \"name\": \"email\", \"type\": \"string\" }\r\n            ]\r\n        },\r\n\r\n        \"guest_user\": {\r\n            \"fields\": [\r\n                { \"name\": \"guid\", \"type\": \"uuid\", \"description\": \"Internal unique identifier for this user.\" },\r\n                { \"name\": \"email\", \"type\": \"string\" }\r\n            ]\r\n        }\r\n\r\n        \"user\": {\r\n            \"union\": [\r\n                { \"type\": \"registered_user\" },\r\n                { \"type\": \"guest_user\" }\r\n            ]\r\n        }\r\n    },\r\n"},"comment":{"url":"https://api.github.com/repos/gilt/apidoc/issues/comments/73157070","html_url":"https://github.com/gilt/apidoc/issues/278#issuecomment-73157070","issue_url":"https://api.github.com/repos/gilt/apidoc/issues/278","id":73157070,"user":{"login":"mbryzek","id":49875,"avatar_url":"https://avatars.githubusercontent.com/u/49875?v=3","gravatar_id":"","url":"https://api.github.com/users/mbryzek","html_url":"https://github.com/mbryzek","followers_url":"https://api.github.com/users/mbryzek/followers","following_url":"https://api.github.com/users/mbryzek/following{/other_user}","gists_url":"https://api.github.com/users/mbryzek/gists{/gist_id}","starred_url":"https://api.github.com/users/mbryzek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbryzek/subscriptions","organizations_url":"https://api.github.com/users/mbryzek/orgs","repos_url":"https://api.github.com/users/mbryzek/repos","events_url":"https://api.github.com/users/mbryzek/events{/privacy}","received_events_url":"https://api.github.com/users/mbryzek/received_events","type":"User","site_admin":false},"created_at":"2015-02-06T00:07:09Z","updated_at":"2015-02-06T00:07:09Z","body":"Also - thinking through the documentation that we show at\r\n\r\nhttp://www.apidoc.me/doc/apiJson#model\r\n\r\nI think it would look like:\r\n\r\n{\r\n      \"name\" => {\r\n        \"description\": string (optional),\r\n        \"plural\": string (optional),\r\n        \"fields\": JSON Array of Field (optional),\r\n        \"union\": JSON Array of UnionType (optional),\r\n        \"values\": JSON Array of EnumValue (optional)\r\n      }\r\n    }\r\n\r\nand then in the description we would say that you must specify fields OR union OR values and exactly 1 of these would be specified....\r\n\r\nI personally think that is MORE confusing than what we have now which is optional arrays on the top level json document:\r\n\r\n      \"enums\": JSON Object of Enum (optional),\r\n      \"models\": JSON Object of Model (optional),\r\n      \"unions\": JSON Object of Union (optional),\r\n"}}