{"action":"created","issue":{"url":"https://api.github.com/repos/Romakita/ts-express-decorators/issues/297","repository_url":"https://api.github.com/repos/Romakita/ts-express-decorators","labels_url":"https://api.github.com/repos/Romakita/ts-express-decorators/issues/297/labels{/name}","comments_url":"https://api.github.com/repos/Romakita/ts-express-decorators/issues/297/comments","events_url":"https://api.github.com/repos/Romakita/ts-express-decorators/issues/297/events","html_url":"https://github.com/Romakita/ts-express-decorators/issues/297","id":308244914,"number":297,"title":"How to manually inject parameters from decorators?","user":{"login":"milewski","id":2874967,"avatar_url":"https://avatars3.githubusercontent.com/u/2874967?v=4","gravatar_id":"","url":"https://api.github.com/users/milewski","html_url":"https://github.com/milewski","followers_url":"https://api.github.com/users/milewski/followers","following_url":"https://api.github.com/users/milewski/following{/other_user}","gists_url":"https://api.github.com/users/milewski/gists{/gist_id}","starred_url":"https://api.github.com/users/milewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/milewski/subscriptions","organizations_url":"https://api.github.com/users/milewski/orgs","repos_url":"https://api.github.com/users/milewski/repos","events_url":"https://api.github.com/users/milewski/events{/privacy}","received_events_url":"https://api.github.com/users/milewski/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-03-24T09:49:05Z","updated_at":"2018-03-25T07:31:52Z","closed_at":"2018-03-25T07:30:33Z","author_association":"NONE","body":"I have the following decorator: @Captcha()\r\n\r\n```ts\r\nimport { Required, Use } from '@tsed/common'\r\nimport { Store } from '@tsed/core'\r\nimport { INVALID_CAPTCHA } from '../errors/ApiErrors'\r\nimport { ValidateCaptcha } from '../middlewares/ValidateCaptcha'\r\n\r\n// Potentially i would like to give this model directly to the parameters instead of defining it manually\r\nexport class CaptchaModel {\r\n    @Required()\r\n    captcha: string\r\n}\r\n\r\nexport function Captcha() {\r\n\r\n    return Store.decorate((store: Store) => {\r\n\r\n        store.merge('responses', { [ INVALID_CAPTCHA.code ]: { description: INVALID_CAPTCHA.message } })\r\n        store.merge('parameters', { body: { name: 'captcha', description: 'captcha', required: true } }) // this doesnt work.. what am i doing wrong?\r\n\r\n        return Use(ValidateCaptcha)\r\n\r\n    })\r\n\r\n}\r\n\r\n```\r\n\r\nand this is the middleware code:\r\n\r\n```ts\r\nimport { BodyParams, Middleware, Next, Req } from '@tsed/common'\r\nimport { INVALID_CAPTCHA } from '../errors/ApiErrors'\r\nimport { ApiError } from '../exceptions/ApiError'\r\n\r\n@Middleware()\r\nexport class ValidateCaptcha {\r\n\r\n    async use(@Req() request: Express.Request, @BodyParams() data: { captcha?: string }, @Next() next: Express.NextFunction) {\r\n\r\n        if (request.session.captcha === undefined || data.captcha !== request.session.captcha) {\r\n            throw new ApiError(INVALID_CAPTCHA)\r\n        }\r\n\r\n        next(null, request.session.captcha = null)\r\n\r\n    }\r\n\r\n}\r\n```\r\n\r\nQuestion:\r\n\r\nHow do i merge the parameters so the swagger documentation + validation works when i include the @Captcha decorator to my methods."},"comment":{"url":"https://api.github.com/repos/Romakita/ts-express-decorators/issues/comments/375951270","html_url":"https://github.com/Romakita/ts-express-decorators/issues/297#issuecomment-375951270","issue_url":"https://api.github.com/repos/Romakita/ts-express-decorators/issues/297","id":375951270,"user":{"login":"Romakita","id":1763311,"avatar_url":"https://avatars3.githubusercontent.com/u/1763311?v=4","gravatar_id":"","url":"https://api.github.com/users/Romakita","html_url":"https://github.com/Romakita","followers_url":"https://api.github.com/users/Romakita/followers","following_url":"https://api.github.com/users/Romakita/following{/other_user}","gists_url":"https://api.github.com/users/Romakita/gists{/gist_id}","starred_url":"https://api.github.com/users/Romakita/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Romakita/subscriptions","organizations_url":"https://api.github.com/users/Romakita/orgs","repos_url":"https://api.github.com/users/Romakita/repos","events_url":"https://api.github.com/users/Romakita/events{/privacy}","received_events_url":"https://api.github.com/users/Romakita/received_events","type":"User","site_admin":false},"created_at":"2018-03-25T07:31:52Z","updated_at":"2018-03-25T07:31:52Z","author_association":"OWNER","body":"Not exported ? damned XD. I'll fixed that immediately ;) "}}
{"actor":{"display_login":"Romakita"}}