MichalLytek / typegraphql-prisma

Prisma generator to emit TypeGraphQL types and CRUD resolvers from your Prisma schema
https://prisma.typegraphql.com
MIT License
887 stars 113 forks source link

Encountered a JSON parsing error due to an extraneous comma in a TypeGraphQL decorator. #433

Open ivatra opened 9 months ago

ivatra commented 9 months ago

Describe the Bug I met this error when tried to remigrate typegraphql-schema after a while. I have been searching for this error reason for several hours until i have found i set a comma with nothing after that in

@TypeGraphQL.omit(input: true,)

doc line. I suppose it won't be hard to add a additional check for comma and prevent other users from spending a lot of time for that minor mistake.

To Reproduce

model Key {
  id        Int       @id @default(autoincrement())
  /// @TypeGraphQL.omit(input: true,)
  key       String    @unique

  @@map(name: "keys")
}

Expected Behavior Should ignore comma or give understandable feedback about a comma with nothing after.

Logs

✔ Generated Prisma Client (v5.7.1) to .\node_modules\@prisma\client in 172ms
"undefined" is not valid JSON

Environment