-
Notifications
You must be signed in to change notification settings - Fork 398
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
ResolveProperty('__resolveType') not working with type-graphql #178
Comments
Please, provide a minimal repository which reproduces your issue. :) |
I made a repo with an example base on your Here is the request:
I would like that |
Why do you want to change |
We make request on our elasticsearch database with an index that share different types of document. We need to identify which kind of document we are dealing with in our graphql schema. For example you would have an elasticsearch database with car and truck. 19majkel94 explain it pretty well in his issue MichalLytek/type-graphql#181
|
@apiel You can only provide a custom It may read |
Hmm, I think I don't manage to explain myself. But I created another small repo making the wished behavior without type-graphql: https://github.com/apiel/nest-eg2
I get the wished response:
See the
And finally the resolver:
How can I do the same with nest using type-graphql? I also tried to copy Recipe in another instance of RecipeA without success https://github.com/apiel/nest-eg/tree/recipeA
|
You are not passing graphql/lib/decorators/resolvers.utils.ts Line 45 in 77c55fc
I don't know if this can help? |
@apiel so I took a look at your examples and they are different, hence, the behavior is different as well.
We don't have to - Nest is using |
How to achieve https://github.com/apiel/nest-eg2 with type-graphql? |
First of all, you would have to use interfaces (not types) as in https://github.com/apiel/nest-eg2 ( |
But how can I use interface with nest and type-graphql? Do you have any example? |
Hey super, this seem to be what I need ;-) Then I guess it might work with:
I will try tomorrow and then close the issue. Thx |
Still having issue:
It's not compiling because If I remove abstract on the class If I change resolver to |
Actually, we have to. According to TypeGraphQL docs:
So @apiel code will produce a There is a pending TypeGraphQL issue about that, as by default it uses |
@19majkel94 thanks for the clarification |
@kamilmysliwiec I am also having the same issue, can you confirm its an issue with the graphql nestjs implementation ? Being going around crazy for the last few hours :-) I just can't get a simple example to work. |
@kamilmysliwiec I'm also having the same problems as @apiel. No matter what I do, I can't get the @ResolveProperty to work. As soon as I use it, the server 'hangs'. When inspecting with debugger, I see the same error as @apiel : |
Please, create a separate issue + provide a repo that reproduces it @michelcve |
@kamilmysliwiec While creating a test project, I finally figured it out. In my tsconfig.json I had |
Why do we close this issue? Is it solved? |
Let's track this issue in a one place MichalLytek/type-graphql#181 |
But some weeks ago, when I tried to use interface https://typegraphql.ml/docs/interfaces.html, as you suggested, it didn't work. Nest didn't seem to support this feature from type-graphql. Did you fix this? If yes could you provide link of the commit/PR number? |
Ah super :D I will give a try tomorrow. |
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. |
The last few days I migrated our project to use type-graphql with nest. I managed to migrate everything, but I am still stuck on one thing. Providing a custom
__typename
doesn't seem to work.Here is my resolver:
But the
resolveType
doesn't seem to be called, wheretest
method is called if I query fortest
field.I also tried to use some interface like suggested 19majkel94 (from type-graphql) but still doesn't work: MichalLytek/type-graphql#181 (comment)
Is there any way to customize
__typename
with nest using type-graphql?The text was updated successfully, but these errors were encountered: