Closed kevin-dp closed 8 months ago
zod-prisma-types fails on the following model:
model User { id Int @id foo Int /// @zod.number.gt(-5) }
The reason it fails is because the NUMBER_VALIDATOR_NUMBER_AND_MESSAGE_REGEX regex does not match the minus sign: https://github.com/chrishoermann/zod-prisma-types/blob/96c7dcb5c217baec88204922207f4e8899892f79/packages/generator/src/constants/regex.ts#L76
NUMBER_VALIDATOR_NUMBER_AND_MESSAGE_REGEX
The regex can be modified to match an optional minus sign:
/.(?<validator>gt|gte|lt|lte|multipleOf)(?<number>\(-?[\d]+([,][ ]?)?(?<message>[{][ ]?message:[ ]?['"][\w\W]+['"][ ]?[}])?\))/
@kevin-dp thanks for the hint. Should be working in 2.7.10 now
2.7.10
zod-prisma-types fails on the following model:
The reason it fails is because the
NUMBER_VALIDATOR_NUMBER_AND_MESSAGE_REGEX
regex does not match the minus sign: https://github.com/chrishoermann/zod-prisma-types/blob/96c7dcb5c217baec88204922207f4e8899892f79/packages/generator/src/constants/regex.ts#L76The regex can be modified to match an optional minus sign: