New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support @Resolver without type name or class (code first) #158
Comments
Same issue with Using |
So actually this is a typing issue. |
Hmm.. I think it's a valid case though. If I understand it correctly, the type for a resolver is only needed for FieldResolvers (or PropertyResolver). |
Well, you're right. Thanks for reminding me :) |
It should be fixed in 6.0.1 :) Let me know if you face any issue |
@kamilmysliwiec Thanks a lot for the quick fix! But my test case is still failing... :(
I suspect that it's caused by this check, so that the queries defined in |
(unrelated to this issue) And I also noticed that running the test with
|
I found some other issues in There are multiple parameters accepts the custom defined property name, which is kinda confusing:
Again, here is the test case to reproduce the issue: https://github.com/zhenwenc/nest-graphql-issues/blob/master/test/duplicate-resolve-property-name.spec.ts Additionally, my test case is failing with another error:
I think the test case demonstrates a valid use case, you could switch to |
Experiencing the same issue in my project. Wish to return a description for my GraphQL API. So, have a resolver: import { Resolver, Query } from '@nestjs/graphql';
@Resolver()
export class InfoResolver {
@Query()
info(): string {
return ``;
}
} When building my project, I'm getting |
@zhenwenc I have happen to stumble upon the very same issue when using @ResolveProperty() decorator and what solved for me was to properly annotate the Resolver as per docs using Type not string name so for example in your case: ❌ So in your test simply change the annotation as specified above and all should work as expected. Hope it helps! |
@id-kemo I also found that |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I'm submitting a...
Current behavior
Application throw the following error when using
@Resolver()
without specifying any type name or type class:Caused by: https://github.com/nestjs/graphql/blob/master/lib/decorators/resolvers.decorators.ts#L250
Expected behavior
No error should be thrown.
Minimal reproduction of the problem with instructions
Sorry for my poor english, here is a test case to reproduce the issue: https://github.com/zhenwenc/nest-graphql-issues/blob/master/test/resolver-without-type-name.spec.ts
Environment
The text was updated successfully, but these errors were encountered: