Replies: 4 comments 6 replies
|
I achieved this in GraphQL by setting the admin condition as true, like this: {
name: 'title',
type: 'text',
required: true,
admin: {
condition: () => true, // Triggers GraphQL nullability automatically
},
},And then, just fill the title in the |
|
I have tackled this in a few personal projects actually! Another approach would be to not use
@MurzNN suggestion of using |
|
Also, as I see, the |
|
Seems the root cause is even deeper, so I (and AI 😏) made some investigations and reported an issue here #17203 |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Example: a
cartscollection withitemsandsubtotalfields. I'd like thesubtotalfield to berequiredin the model (so that I can be sure that all the savedcartshave this property) but not required on create/update as it should be computed onbeforeChangehook.The result should be
subtotal: numberas the field type when I fetch it, butsubtotal: number | null | undefinedon create/update.I was thinking about a
virtualfield - but that would add unnecessary computing on each read, so it would be better to compute this at save time.Any ideas what could i do in this situation?
All reactions