zenstackhq / zenstack

Fullstack TypeScript toolkit that enhances Prisma ORM with flexible Authorization layer for RBAC/ABAC/PBAC/ReBAC, offering auto-generated type-safe APIs and frontend hooks.
https://zenstack.dev
MIT License
2.07k stars 88 forks source link

Validation errors when using true or false in the column name #522

Closed abdullahahmeda closed 1 year ago

abdullahahmeda commented 1 year ago

Description and expected behavior I have the following schema for true & false questions:

model Question {
  id           Int            @id @default(autoincrement())
  text         String         @db.Text()
  trueText     String?        @db.Text()
  falseText    String?        @db.Text()
  answer       String         @db.Text()
}

When I run npx zenstack generate I get the following error:

Validation errors:
line 79: Expecting token of type '}' but found `true`. [true]
line 80: Expecting token of type '}' but found `false`. [false]

Also the zenstack vs code extension is linting the error: image

Environment:

jiashengguo commented 1 year ago

@abdullahahmeda It's a bug for sure, thanks for reporting it! We will make sure it is fixed in the next release.

abdullahahmeda commented 1 year ago

Thank you. For now I fixed this error by renaming falseText to textForFalse and trueText to textForTrue.

ymc9 commented 1 year ago

Fixed by #530