Enum error validation
I am upgrading Prisma to version 7.1, but I'm encountering this error with enums that use the @map attribute on their values:
The error occurs when trying to create a user with the type field set to "admin":
enum TypeUser {
CUSTOMER @map("customer")
ADMIN @map("admin")
}enum TypeUser {
CUSTOMER @map("customer")
ADMIN @map("admin")
}import { prismaService } from './prisma.service.js';
import { TypeUser } from './generated/prisma/enums.js';
async function bootstrap() {
const user = await prismaService.user.create({
data: {
email: 'email@test.com',
type: TypeUser.ADMIN,
}
});
console.log(user);
}
bootstrap();import { prismaService } from './prisma.service.js';
import { TypeUser } from './generated/prisma/enums.js';
async function bootstrap() {
const user = await prismaService.user.create({
data: {
email: 'email@test.com',
type: TypeUser.ADMIN,
}
});
console.log(user);
}
bootstrap();The error occurs when trying to create a user with the type field set to "admin":
/nestjs-prisma/node_modules/@prisma/client/src/runtime/core/errorRendering/throwValidationException.ts:46
throw new PrismaClientValidationError(messageWithContext, { clientVersion })
^
PrismaClientValidationError:
→ 11 const user = await prismaService.user.create({
data: {
email: "email@test.com",
type: "admin"
~~~~~~~
}
})
Invalid value for argument `type`. Expected TypeUser.
at throwValidationException (/nestjs-prisma/node_modules/@prisma/client/src/runtime/core/errorRendering/throwValidationException.ts:46:9)/nestjs-prisma/node_modules/@prisma/client/src/runtime/core/errorRendering/throwValidationException.ts:46
throw new PrismaClientValidationError(messageWithContext, { clientVersion })
^
PrismaClientValidationError:
→ 11 const user = await prismaService.user.create({
data: {
email: "email@test.com",
type: "admin"
~~~~~~~
}
})
Invalid value for argument `type`. Expected TypeUser.
at throwValidationException (/nestjs-prisma/node_modules/@prisma/client/src/runtime/core/errorRendering/throwValidationException.ts:46:9)