{"action":"created","issue":{"url":"https://api.github.com/repos/geeklearningio/gulp-swagger-generator/issues/38","repository_url":"https://api.github.com/repos/geeklearningio/gulp-swagger-generator","labels_url":"https://api.github.com/repos/geeklearningio/gulp-swagger-generator/issues/38/labels{/name}","comments_url":"https://api.github.com/repos/geeklearningio/gulp-swagger-generator/issues/38/comments","events_url":"https://api.github.com/repos/geeklearningio/gulp-swagger-generator/issues/38/events","html_url":"https://github.com/geeklearningio/gulp-swagger-generator/issues/38","id":195322557,"number":38,"title":"Recursive Arrays","user":{"login":"YStrauch","id":8913246,"avatar_url":"https://avatars.githubusercontent.com/u/8913246?v=3","gravatar_id":"","url":"https://api.github.com/users/YStrauch","html_url":"https://github.com/YStrauch","followers_url":"https://api.github.com/users/YStrauch/followers","following_url":"https://api.github.com/users/YStrauch/following{/other_user}","gists_url":"https://api.github.com/users/YStrauch/gists{/gist_id}","starred_url":"https://api.github.com/users/YStrauch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YStrauch/subscriptions","organizations_url":"https://api.github.com/users/YStrauch/orgs","repos_url":"https://api.github.com/users/YStrauch/repos","events_url":"https://api.github.com/users/YStrauch/events{/privacy}","received_events_url":"https://api.github.com/users/YStrauch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-13T17:51:43Z","updated_at":"2016-12-14T10:16:14Z","closed_at":null,"body":"Hello,\r\n\r\nif you specify a an array within an array as followed:\r\n\r\n```yaml\r\nrecursive_array:\r\n        type: array\r\n        items:\r\n          type: array\r\n          items:\r\n            type: string\r\n```\r\n\r\nthen the library will crash. I found the issue in the typescriptTypeMapper (and a quick fix):\r\n```js\r\n          else if (type === 'array') {\r\n                /* The error occures because asArray() is not set for recursive arrays */\r\n                return this.getType(property.items).asArray();\r\n\r\n                /* Fix: A simple check if asArray is defined */\r\n                if (!this.getType(property.items).asArray) {\r\n                    return this.getType(property.items);\r\n                }\r\n                return this.getType(property.items).asArray();\r\n            }\r\n```\r\n\r\nHope I didn't miss something ;)"},"comment":{"url":"https://api.github.com/repos/geeklearningio/gulp-swagger-generator/issues/comments/266996476","html_url":"https://github.com/geeklearningio/gulp-swagger-generator/issues/38#issuecomment-266996476","issue_url":"https://api.github.com/repos/geeklearningio/gulp-swagger-generator/issues/38","id":266996476,"user":{"login":"sandorfr","id":2660262,"avatar_url":"https://avatars.githubusercontent.com/u/2660262?v=3","gravatar_id":"","url":"https://api.github.com/users/sandorfr","html_url":"https://github.com/sandorfr","followers_url":"https://api.github.com/users/sandorfr/followers","following_url":"https://api.github.com/users/sandorfr/following{/other_user}","gists_url":"https://api.github.com/users/sandorfr/gists{/gist_id}","starred_url":"https://api.github.com/users/sandorfr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sandorfr/subscriptions","organizations_url":"https://api.github.com/users/sandorfr/orgs","repos_url":"https://api.github.com/users/sandorfr/repos","events_url":"https://api.github.com/users/sandorfr/events{/privacy}","received_events_url":"https://api.github.com/users/sandorfr/received_events","type":"User","site_admin":false},"created_at":"2016-12-14T10:16:14Z","updated_at":"2016-12-14T10:16:14Z","body":"Hi @YStrauch, thanks for reporting that issue. I'm afraid there is more to the story. Type system in the legacy version of the generator has a pretty bad design :( (sorry about that). I think your patch proposal will just hide the error but won't fix the core issue.\r\n\r\n[Current templates](https://github.com/geeklearningio/gulp-swagger-generator/blob/legacy/lib/templates/typescript/angular/Type.hbs#L6) won't generate the appropriate type anyway as it's just appending a `[]` and won't trigger a recursive call to the type template.\r\n\r\nThis has been addressed in the `vnext` by updating the [Abstracted type model](https://github.com/geeklearningio/gl-swagger-generator/blob/develop/src/node-swagger-generator/lib/typing.ts#L118-L126) and [Language type model](https://github.com/geeklearningio/gl-swagger-generator/blob/develop/src/node-swagger-generator/lib/languages/typescript.ts#L222-L228) and the [Templates](https://github.com/geeklearningio/gl-swagger-generator/blob/develop/src/node-swagger-generator/templates/csharp/netstandard/1.3/_typeCore.hbs#L6)\r\n\r\nMy priority is actually to get this vnext documented, tested and released, so I won't have time to backport this to legacy branch. "}}
{"actor":{"display_login":"sandorfr"}}