Skip to content
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

@Resolver+@ResolveProperty doesn't work for method #400

Closed
galkin opened this issue Sep 9, 2019 · 4 comments
Closed

@Resolver+@ResolveProperty doesn't work for method #400

galkin opened this issue Sep 9, 2019 · 4 comments

Comments

@galkin
Copy link

galkin commented Sep 9, 2019

@kamilmysliwiec, @MichalLytek I think this issue is similar to #368

I'm submitting a...


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

Decorators @resolver+@ResolveProperty don't work together on single method.

[Nest] 19238   - 09/09/2019, 6:45:53 PM   [NestFactory] Starting Nest application...
[Nest] 19238   - 09/09/2019, 6:45:53 PM   [InstanceLoader] ApplicationModule dependencies initialized +39ms
[Nest] 19238   - 09/09/2019, 6:45:53 PM   [InstanceLoader] RecipesModule dependencies initialized +1ms
[Nest] 19238   - 09/09/2019, 6:45:53 PM   [InstanceLoader] GraphQLModule dependencies initialized +1ms
(node:19238) UnhandledPromiseRejectionWarning: Error: Book.Book defined in resolvers, but not in schema
(node:19238) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:19238) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Expected behavior

I expect to application at the example will start.

Minimal reproduction of the problem with instructions

https://github.com/galkin/nest-graphql-bug-report/blob/master/src/recipes/recipes.resolver.ts#L49

What is the motivation / use case for changing the behavior?

Environment


Nest version: 6.6.7
 
For Tooling issues:
- Node version: v10.16.3  
- Platform:  Mac 
@MichalLytek
Copy link

Shouldn't @Resolver(of => Book) be placed above RecipesResolver class? 😕

@galkin
Copy link
Author

galkin commented Sep 9, 2019

@MichalLytek, I want to have several different types at one class. For example:

  @Resolver(of => Book)
  @ResolveProperty('recipes', () => [Recipe])
  async recipesAtBook(@Root() book: Book): Promise<Recipe[]> {
    return this.recipesService.findAll({ skip: 0, take: book.pageCount });
  }

 @Resolver(of => Post)
  @ResolveProperty('recipe', () => Recipe)
  async recipesAtBook(@Root() post: post): Promise<Recipe> {
    return this.recipesService.findAll({ skip: 0, take: post.recipeCount });
  }

If it is blocked on type-graphql, then I can remake example with bug report.

@MichalLytek
Copy link

MichalLytek commented Sep 9, 2019

I want to have several different types at one class

Tracked by: MichalLytek/type-graphql#193

Not possible by now 😞

@lock
Copy link

lock bot commented Apr 25, 2020

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.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants