notiz-dev / nestjs-prisma-starter

Starter template for NestJS 😻 includes GraphQL with Prisma Client, Passport-JWT authentication, Swagger Api and Docker
MIT License
2.37k stars 337 forks source link

Missing arg fields in Schema #486

Open rastislavkopal opened 1 year ago

rastislavkopal commented 1 year ago

Hi,

I just used this repo first time and I found problems with arguments of queries not showing in grapqh playground

For example userPosts query has userId argument in resolver:

@ArgsType() export class UserIdArgs { @IsNotEmpty() userId: string; }

Generated queries in schema:

type Query { ... userPosts: [Post!]! }

So the playground would not execute the query. I am just learning GraphQL, so I was confused of the error. "message": "Unknown argument \"userId\" on field \"Query.userPosts\".",

After adding @Field() decorator, all works fine.

Solved: @ArgsType() export class UserIdArgs { @Field() @IsNotEmpty() userId: string; } Am I missing something? Thanks.

nhvu95 commented 8 months ago

Thank you a lot, It's save me