zenstackhq / zenstack

Fullstack TypeScript toolkit 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
1.83k stars 78 forks source link

VSCode extension: Formatting zmodel with the `Unsupported` type fails #1517

Open spicybackend opened 2 weeks ago

spicybackend commented 2 weeks ago

Description and expected behavior Upon trying to format the ZenStack schema file, the extension fails to format the file if it contains an Unsupported type.

In my setup, I have a model with two full-text search columns that Prisma doesn't support out of the box as below.

  name_caption_fts           Unsupported("tsvector")?
  fts                        Unsupported("tsvector")?

Removing these from the model stops the formatter from crashing, so I assume it's a matter of supporting Prisma's Unsupported type. Syntax highlighting is not an issue.

Until then, the issue can be worked around by using a pass-through.

  @@prisma.passthrough('name_caption_fts           Unsupported("tsvector")?')
  @@prisma.passthrough('fts                        Unsupported("tsvector")?')

Screenshots Screenshot from 2024-06-15 10-42-22

Environment (please complete the following information):

ymc9 commented 2 weeks ago

Hi @spicybackend, thanks for reporting the issue. I can reproduce it but not sure why it's broken yet. Will make a fix soon!