Closed
Description
Describe the bug
Args are not validated before being passed to subscribe
To Reproduce
@ArgsType()
class MyArgs {
@Field(() => String)
@MinLength(1)
public name!: string;
}
@Resolver()
export default class MySubscriptions {
@Subscription(() => String, {
subscribe: (root, { name }: MyArgs) => {
return { next: async () => ({ done: true }) };
},
})
public observe(@Args(() => MyArgs ) args: MyArgs): string {
return args.name;
}
}
-> Subscribe with name set to empty string
-> No error (error would occur on first resolver call, but we have empty observable, also it should not (re)validate on resolver call)
Expected behavior
Arguments being validated before being passed to subscribe
Enviorment (please complete the following information):
- OS: Windows
- Node: 12
- Package version: 0.17.6
- TypeScript version: 3.7