{"action":"opened","issue":{"url":"https://api.github.com/repos/pleerock/routing-controllers/issues/185","repository_url":"https://api.github.com/repos/pleerock/routing-controllers","labels_url":"https://api.github.com/repos/pleerock/routing-controllers/issues/185/labels{/name}","comments_url":"https://api.github.com/repos/pleerock/routing-controllers/issues/185/comments","events_url":"https://api.github.com/repos/pleerock/routing-controllers/issues/185/events","html_url":"https://github.com/pleerock/routing-controllers/issues/185","id":235932369,"number":185,"title":"Should @BodyParam default to required?","user":{"login":"subvertallchris","id":4097271,"avatar_url":"https://avatars1.githubusercontent.com/u/4097271?v=3","gravatar_id":"","url":"https://api.github.com/users/subvertallchris","html_url":"https://github.com/subvertallchris","followers_url":"https://api.github.com/users/subvertallchris/followers","following_url":"https://api.github.com/users/subvertallchris/following{/other_user}","gists_url":"https://api.github.com/users/subvertallchris/gists{/gist_id}","starred_url":"https://api.github.com/users/subvertallchris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/subvertallchris/subscriptions","organizations_url":"https://api.github.com/users/subvertallchris/orgs","repos_url":"https://api.github.com/users/subvertallchris/repos","events_url":"https://api.github.com/users/subvertallchris/events{/privacy}","received_events_url":"https://api.github.com/users/subvertallchris/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-14T16:09:38Z","updated_at":"2017-06-14T16:09:38Z","closed_at":null,"body":"Taking a stab at rebuilding a Ruby/Grape API with Koa2 and this library, extremely happy that it exists. Thank you for your work!\r\n\r\nSomething I noticed is that that Params specified in a request function are not required by default. Reading this signature, I'd expect it to raise an error if any fields are missing in my POST:\r\n\r\n```typescript\r\n@Post('/buzz')\r\ncreateSession(@BodyParam('foo') foo: string, @BodyParam('bar') bar: string, @BodyParam('baz') baz: string) { \r\n  // do something\r\n}\r\n```\r\n\r\nI see I can add the `{ required: true }` option, but I feel like the less surprising default would be a closer to match to what the TS function signature describes, which is \"everything is required.\" As it stands, the default forces us to treat each param as optional, so the TS signature does not accurately describe the input. Changing the default would make things safer and more trustworthy by default, which is a better user experience, IMO."}}
{"actor":{"display_login":"subvertallchris"}}