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

field can't be named `model` #391

Closed he-la closed 1 year ago

he-la commented 1 year ago

Description and expected behavior Create a model with a field named model:

model MyModel {
  model  String
}

npx zenstack generate errors with

Validation errors:
line 548: Expecting: expecting at least one iteration which starts with one of these possible Token sequences::
  <[TRIPLE_SLASH_COMMENT] ,[ID] ,[in] ,[@@]>
but found: 'model' []
line 548: Expecting: one of these possible Token sequences:
  1. [ID]
  2. [in]
but found: 'String' []
line 548: Expecting token of type '{' but found `String`. []
line 548: Expecting token of type 'EOF' but found `String`. []

Environment (please complete the following information):

Additional context Yup, I actually have a legit usecase for a field named model. Don't ask...

ymc9 commented 1 year ago

I won't ask but I believe "model" is a good name for model haha. Prisma did a good job permitting it. We should fix it here.

ymc9 commented 1 year ago

Hi @he-la , this issue is resolved by the latest alpha.114 release.

ymc9 commented 1 year ago

Fixed by #400