Nullable and scheme not matching definition. #366
Replies: 1 comment 3 replies
-
@frontenders-game Hi. I'm not all that familiar with Primsa code generation with TypeBox (would need to see more of the setup), It's possible other developers may be able to assist you so will leave the discussion open for others, or alternatively it may be best to submit an issue on the prisma generator repository (you will likely have better luck there) Just looking at your question though, just be mindful that TypeBox provides a lot of flexibility over more constrained schematics representations (such as those required to define database schematics), so there may be types expressible in TypeBox that simply can't be converted to Primsa schematics. Here's some notes if they're helpful.
// create type with it's own targetable `$id`
const omittedResponseProductSchema = Type.Omit(responseProductSchema, ['categoryId'], { $id: 'omittedResponseProductSchema' })
// define the `products` property as follows.
const T = Type.Object({
products: Type.Ref(omittedResponseProductSchema) // { $ref: 'omittedResponseProductSchema' }
})
// pseudo code for the generator
Primsa.Generate(T, [omittedResponseProductSchema]) // pass the reference target to the generator so it can find it Hope this helps |
Beta Was this translation helpful? Give feedback.
-
I got this error when i try to use Type.Null() to serialize prisma returns:
This is what i am getting with prisma:
This is typebox scheme:
I use it with Ref in category scheme:
Beta Was this translation helpful? Give feedback.
All reactions