Closed devklick closed 4 months ago
This is the expected behavior. All fields of model are optional fields. The main purpose is for me to adapt the select and include functions (for selecting only some fields or additional fields containing relationships)
@medz Thank you for clarifying.
Since this appears to be different behaviour to Prisma JS, it might be worth adding something in the model docs.
I'll close this issue as you've confirmed it's expected behaviour
@devklick
Since this appears to be different behaviour to Prisma JS
Yes, since Prisma JS/TS relies on TS's type calculation, types can be constructed dynamically. Other languages do not have support for this feature. If you want to implement select/include, you can only use nullable types.
In my
schema.prisma
I have a model defined with what I understand to be a required field, since it's not using the optional modifier:I've run the generator as per the docs, with:
But the generated Person class has both the
id
andname
properties as being optional:Is this the intended behaviour or have I missed something?
Using version 4.0.0-beta.3