Replies: 1 comment
-
This package only connect existing types in your codebase into your prisma schema, as the readme says: You still need to validate it manually before inserting into your database. This is fine because previously you should have an |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I added this to my project, but I'm confused.
I can see that the JSON fields are now typed correctly in the generated code @prisma/client.
However, if I call the prisma method:
someModel.create(d)
whered
is not the expected JSON data but some other type (or some different JSON structure), the operation still succeeds! It creates the record in the DB using the wrong data.Probably I don't understand something. Isn't this supposed to prevent wrong data types from being used with prisma APIs?
Give these types:
And this schema:
Then this call works:
What am I doing wrong?
I know Typing info doesn't exist at runtime, types live in the TS world only. So is this only for generating types for Prisma?
Beta Was this translation helpful? Give feedback.
All reactions