Whats the best way define a property in a model which can be null or object/array?

I have some properties in my model:

  1. key foo which is null value or an object with a particular structure
  2. key bar which is a null value an array of objects with a particular structure

It’s not clear from the docs where I can set default null values to replace types which are arrays or objects. I’m familiar with the ‘mixed’ type, but it’s not clear how I can use it here.

Thank you!

Hey @amalhussein,
In the case of a model reference, null is an implicitly permitted value and should not need any special logic to enable you to remove the existing reference by specifying null.
In the case of specific model types, the null value is not directly supported. In these kinds of cases you would need to use the Mixed type to indicate that you are accepting more than the one specific type (note that null is considered its own type).
Cheers, Brett

1 Like