{"action":"created","issue":{"url":"https://api.github.com/repos/lukeautry/tsoa/issues/205","repository_url":"https://api.github.com/repos/lukeautry/tsoa","labels_url":"https://api.github.com/repos/lukeautry/tsoa/issues/205/labels{/name}","comments_url":"https://api.github.com/repos/lukeautry/tsoa/issues/205/comments","events_url":"https://api.github.com/repos/lukeautry/tsoa/issues/205/events","html_url":"https://github.com/lukeautry/tsoa/issues/205","id":300361546,"number":205,"title":"Issue between TSOA and Sequelize - No matching model found","user":{"login":"Esya","id":937179,"avatar_url":"https://avatars0.githubusercontent.com/u/937179?v=4","gravatar_id":"","url":"https://api.github.com/users/Esya","html_url":"https://github.com/Esya","followers_url":"https://api.github.com/users/Esya/followers","following_url":"https://api.github.com/users/Esya/following{/other_user}","gists_url":"https://api.github.com/users/Esya/gists{/gist_id}","starred_url":"https://api.github.com/users/Esya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Esya/subscriptions","organizations_url":"https://api.github.com/users/Esya/orgs","repos_url":"https://api.github.com/users/Esya/repos","events_url":"https://api.github.com/users/Esya/events{/privacy}","received_events_url":"https://api.github.com/users/Esya/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-02-26T19:16:48Z","updated_at":"2018-02-28T03:17:34Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nWe're having some serious issues with our Sequelize models and the tsoa swagger/routes generation. The metadata generator fails when we do something as simple as this : \r\n\r\n```javascript\r\n    // Dummy controller\r\n    public userJson(@Request() request: express.Request): User {\r\n        return request.user.toJSON();\r\n    }\r\n```\r\n\r\nWhere User is a simple Sequelize model like so : \r\n\r\n```javascript\r\nimport { Model } from \"sequelize-typescript\";\r\nimport { Column } from \"sequelize-typescript/lib/annotations/Column\";\r\n\r\nexport default class User extends Model<User> {\r\n  /** email id of the user */\r\n  @Column emailId: string;\r\n  /** First name of the user */\r\n  @Column firstName: string;\r\n  /** Lastname of the user */\r\n  @Column lastName: string;\r\n}\r\n```\r\n\r\nWhen we try generating the routes we get : \r\n\r\n```\r\nThere was a problem resolving type of 'SequelizeOrigin'.\r\nThere was a problem resolving type of 'Sequelize'.\r\nThere was a problem resolving type of 'Model'.\r\nThere was a problem resolving type of 'User'.\r\nGenerate swagger error.\r\n Error: No matching model found for referenced type SequelizeOrigin.\r\n    at new GenerateMetadataError (/home/esya/Documents/Git/microservice-tsoa-working/node_modules/tsoa/dist/metadataGeneration/exceptions.js:17:28)\r\n    at getModelTypeDeclaration (/home/esya/Documents/Git/microservice-tsoa-working/node_modules/tsoa/dist/metadataGeneration/resolveType.js:419:15)\r\n    at getReferenceType (/home/esya/Documents/Git/microservice-tsoa-working/node_modules/tsoa/dist/metadataGeneration/resolveType.js:280:25)\r\n    at /home/esya/Documents/Git/microservice-tsoa-working/node_modules/tsoa/dist/metadataGeneration/resolveType.js:572:33\r\n    at Array.forEach (<anonymous>)\r\n    at /home/esya/Documents/Git/microservice-tsoa-working/node_modules/tsoa/dist/metadataGeneration/resolveType.js:570:22\r\n    at Array.forEach (<anonymous>)\r\n    at getModelInheritedProperties (/home/esya/Documents/Git/microservice-tsoa-working/node_modules/tsoa/dist/metadataGeneration/resolveType.js:566:21)\r\n    at getReferenceType (/home/esya/Documents/Git/microservice-tsoa-working/node_modules/tsoa/dist/metadataGeneration/resolveType.js:283:35)\r\n    at resolveType (/home/esya/Documents/Git/microservice-tsoa-working/node_modules/tsoa/dist/metadataGeneration/resolveType.js:95:25)\r\n```\r\n\r\nWe've found a very very nasty work-around which is to block the typedetection when it reaches \"Model\" or \"SequelizeOrigin\" but that means a fork of tsoa with a quick & dirty fix. \r\n\r\nWould you have a solution for this? Thanks!"},"comment":{"url":"https://api.github.com/repos/lukeautry/tsoa/issues/comments/369107961","html_url":"https://github.com/lukeautry/tsoa/issues/205#issuecomment-369107961","issue_url":"https://api.github.com/repos/lukeautry/tsoa/issues/205","id":369107961,"user":{"login":"lukeautry","id":8770560,"avatar_url":"https://avatars0.githubusercontent.com/u/8770560?v=4","gravatar_id":"","url":"https://api.github.com/users/lukeautry","html_url":"https://github.com/lukeautry","followers_url":"https://api.github.com/users/lukeautry/followers","following_url":"https://api.github.com/users/lukeautry/following{/other_user}","gists_url":"https://api.github.com/users/lukeautry/gists{/gist_id}","starred_url":"https://api.github.com/users/lukeautry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukeautry/subscriptions","organizations_url":"https://api.github.com/users/lukeautry/orgs","repos_url":"https://api.github.com/users/lukeautry/repos","events_url":"https://api.github.com/users/lukeautry/events{/privacy}","received_events_url":"https://api.github.com/users/lukeautry/received_events","type":"User","site_admin":false},"created_at":"2018-02-28T03:17:34Z","updated_at":"2018-02-28T03:17:34Z","author_association":"OWNER","body":"The problem here, I think, is that tsoa actually needs to know about Model in order to correctly form the definition for User.\r\n\r\nDepending on the structure of sequelize, you may be able to ignore everything except the file that Model is in, but I realize that's not a great solution. I think we're going to need to some way to mark a model as the \"real\" matching model."}}
{"actor":{"display_login":"lukeautry"}}