0
I’m working on GraphQL using NestJS and I’ve not created models separately so, in short, I combine them but my GraphQL playground is not showing schemas and documentation of my queries and mutations.
GraphQL Config
{
driver: ApolloDriver,
autoSchemaFile: true,
path: SERVER_PREFIX_URL,
debug: true,
playground: true,
introspection: true,
plugins: [
ApolloServerPluginQueryComplexity({
estimators: [directiveEstimator(), simpleEstimator()],
maximumComplexity: config.GQL_QUERY_COMPLEXITY,
}),
],
context: ({ req, res }) => ({ req, res }),
}
user.entity.ts
@Entity('users')
@ObjectType('User')
export class User extends BaseEntity {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({ name: 'first_name' })
@Field(() => String)
firstName: string;
@Column({ name: 'last_name' })
@Field(() => String)
lastName: string;
@Column()
@Field(() => String)
mobile: string;
@OneToMany(() => Address, (address) => address.user, { cascade: true })
@Field(() => [Address])
addresses?: Promise<Address[]>;
}
user.resolver.ts
@Resolver((of) => User)
export class UserResolver {
constructor(private userService: UserService) {}
@Query((returns) => User)
user(@Args({ name: 'id' }) id: string) {
return this.userService.getUserById(id);
}
}
versions
{
"@nestjs/graphql": "^10.1.1",
"graphql": "^16.6.0",
"graphql-depth-limit": "^1.1.0",
"graphql-query-complexity": "^0.12.0",
"graphql-tools": "^8.3.6",
}
When I click on schema or documentation in Playground so it always shows the loading.