Prisma.validator is gone but docs still have it and not sure the alternative
Docs: https://www.prisma.io/docs/orm/prisma-client/type-safety/prisma-validator
PR that removes it: https://github.com/prisma/prisma/pull/28059
What am I supposed to do now? Is there an alternative, this seems to be a breaking change I cannot find discussed in the release notes: https://github.com/prisma/prisma/releases
I upgraded from 6.14.0 to 6.16.0
Prisma validator | Prisma Documentation
The Prisma validator is a utility function that takes a generated type and returns a type-safe object which adheres to the generated types model fields.
GitHub
feat(client-generator-ts): removed "Prisma.Validator" from "prisma-...
This PR:
closes ORM-1376
GitHub
Releases · prisma/prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB - prisma/prisma
13 Replies
You chose to debug with a human. They'll tinker with your query soon. If you get curious meanwhile, hop into
#ask-ai
for a quick spin!Already asked the bot: https://discord.com/channels/937751382725886062/1415360613290344498/1415360615400214549
Thanks for raising this conversation.
We should definitely have an alternative for Prisma Validator in docs. We are discussing this internally. Please allow me to get back to you with more information.
Thank you Nurul.
We use validator extensively so I will need to migrate a lot of places.
I totally understand. We will definitely update docs to provide alternatives.
I'll update you as soon as I have more information.
Thanks! Enjoy your day
i use this a lot in my code too 😔
Would you be able to use TypeScript's native
satisfies
keyword as a replacement for it?
https://www.prisma.io/blog/satisfies-operator-ur8ys8ccq7zb#infer-prisma-output-types-without-prismavalidatorPrisma
How TypeScript 4.9
satisfies
Your Prisma WorkflowsLearn how TypeScript 4.9''s new
satisfies
operator can help you write type-safe code with Prismaoh seems like that will do, thanks!
Will need to take a look, will see if I can put together an example.
ok that does seem to work, I will just need to figure out when we have time to migrate all of our code. We have 258 usages of validator right now.
189 usages over here in 84 files. I wish there was a stop gap I could do to switch to the new ESM generator and not have to refactor the entire application.
ya... kind of annoying a breaking change was pushed in a minor.
Same problem here! Very confused on why things broke here, specially when the docs still reference this feature. My solution was to downgrade.
I hope a solution is provided in the docs soon