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

empty enum array default #947

Closed chunkerchunker closed 8 months ago

chunkerchunker commented 9 months ago

Description and expected behavior

The following schema fails compilation for zenstack but compiles successfully for prisma:

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

generator client {
  provider = "prisma-client-js"
}

model Test {
  id    String @id
  props TestEnum[] @default([])
}

enum TestEnum {
  A
  B
}

Zenstack generate fails with:

Validation errors:
line: xxx: Value is not assignable to parameter [[]]

Environment

Additional context

ymc9 commented 9 months ago

Hi @chunkerchunker , thanks for filing this issue and making the PR!