PrismaP
Prisma3mo ago
5 replies
Tal.Elishoov

Problem with mapped enums in 7.0.0?

I have a mapped enum in my schema, something along the lines of:
enum SuggestionStatus {
  PENDING  @map("pending")
  ACCEPTED @map("accepted")
  REJECTED @map("rejected")

  @@map("SuggestionStatus")
}

And a create request for it in a test:
const enrichment = await prisma.suggestionModel.create({
      data: {
        ...
        status: SuggestionStatus.PENDING,
      },
});

I'm getting the following error:
PrismaClientValidationError: 
    Invalid `prisma.suggestionModel.create()` invocation in ...
    ...
      data: "pending"
    ...
    Invalid value for argument `status`. Expected SuggestionStatus

If you have any insight I would appreciate it.
Was this page helpful?