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

Validation error when using @db.TinyInt for Int #821

Closed elsantoalcielo closed 11 months ago

elsantoalcielo commented 11 months ago

Hi, this is my first approach to ZenStack, and I intend to use it in our new application, which I am just beginning to prototype. I have got an introspected SQL Server Prisma schema that correctly mapped some tinyint fields to Int, but ZenStack doesn't validate them and throws an error, as shown below.

I'm using ZenStack 1.2.1, Prisma 5.5.2, and SQL Server.

Very nice project, thanks!

image

image

ymc9 commented 11 months ago

Hi @elsantoalcielo , thanks for filing this. It seems "@db.TinyInt" is incorrectly declared to only support Boolean field... For the time being, you can use:

month Int @prisma.passthrough('@db.TinyInt')

as a workaround. The passthrough attribute sends the text inside directly to the generated Prisma schema.

I'm marking the issue as planned for 1.3 release. Please let me know if you're interested in making a PR and I'll happy to facilitate.

Glad you found ZenStack helpful!

elsantoalcielo commented 11 months ago

Thanks, @ymc9 , I've indeed made the PR, nice to contribute!

Thanks again, and keep the good work.

ymc9 commented 11 months ago

Thanks, @ymc9 , I've indeed made the PR, nice to contribute!

Thanks again, and keep the good work.

Thank you for making the PR @elsantoalcielo ! I'm merging it and it'll be included in next week's v1.3 release.