[ ] 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.
If you rename an ObjectType via the decorator the resolver (@Resolver) of nestjs can't resolve the correct schema. The generated gql schema is fine though.
The @Resolver from @nestjs/graphql resolves custom names like the @Resolver from type-graphql
https://github.com/xXKeyleXx/graphql-minimal-resolver-object-type
import { ResolveProperty, Resolver, Root } from '@nestjs/graphql';
@Resolver(of => QuestionSchema)
export class QuestionResolver {
constructor(
private questionService: QuestionService,
) {
}
@ResolveProperty()
async property(@Root() root: any): Promise<QuestionPropertySchema> {
...
}
}
import { Field, ID, ObjectType } from 'type-graphql';
@ObjectType('Question')
export class QuestionSchema {
@Field(type => ID)
id: string;
}
type Question {
id: ID!
}
I would like to have different names in the schema and the actual class because I want the classname to correspond to the file(name) structure we chose.
+
@nestjs/common: 6.2.3,
@nestjs/core: 6.2.3,
@nestjs/graphql: 6.2.1,
apollo-server-express: 2.5.0
type-graphql: 0.17.4
graphql: 14.3.0
For Tooling issues:
- Node version: v10.15.3
- Platform: Linux (Docker)
Please, provide a minimal repository which reproduces your issue :)
If you change import of Resolver from @nest/graphql to type-graphql its normally working.
This is bug of nest wrapper.
Apparently nest have a bug in initialization?
OR if you allow resolvers not in schema - its working too
resolverValidationOptions: {
allowResolversNotInSchema: true,
},
I don't remember exactly what it was, but when you switch Resolver from @nest/graphql to type-graphql something else stopped working (I think it was the params of the property resolvers didn't get injected correctly)
I don't remember exactly what it was, but when you switch
Resolverfrom@nest/graphqltotype-graphqlsomething else stopped working (I think it was the params of the property resolvers didn't get injected correctly)
Try to set allowResolversNotInSchema: true, in graphql module configuration
Using @Resolver() directly from type-graphql will cause side-effects. This issue is about something else that we have to fix on our side
Using
@Resolver()directly fromtype-graphqlwill cause side-effects. This issue is about something else that we have to fix on our side
Im not saying that is resolve issue - this is for vector of searching error
But with allowResolversNotInSchema: true we have one problem, @ResolveProperty() in field resolver context === undefined
Fixed in 6.2.4
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.
Most helpful comment
Using
@Resolver()directly fromtype-graphqlwill cause side-effects. This issue is about something else that we have to fix on our side