Skip to content

Error on filter by JSON field with enum values #2755

Description

@nafkhanzam

Description and expected behavior
Error on filter by JSON field with enum values. Easy to understand by looking at the screenshots below.

Screenshots

...
enum BKPType {
  ...
  CAPSTONE
  ...
}
type BKPProposal {
  ...
  bkpType BKPType?
  ...
}
model BKP with Base {
  ...
  Proposal BKPProposal @json
  ...
}
function queryBkps() {
  return db.bKP.findMany({
    where: {
      Proposal: {
        bkpType: "CAPSTONE",
      },
    },
  });
}
Image Image

But this works (but requires type check bypassing in the zenstack dist code)

function queryBkps() {
  return db.bKP.findMany({
    where: {
      // @ts-expect-error
      Proposal: {
        bkpType: '"CAPSTONE"',
      },
    },
  });
}

Environment:

  • ZenStack version: 3.8.3
  • Database type: Postgresql
  • Node.js/Bun version: Node 26.4.0
  • Package manager: pnpm

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions