Realm schema for different object types in array

We don’t currently support a union of scalar types in our default GraphQL service to stay as close to the spec as possible. That being said, there is a workaround to achieve something similar by setting the schema of the field like so:

{ "field": { "anyOf": [{ "type": "string" }, { "type": "null" }] } }

The generated schema will ignore this field, but it can still be accessed via the custom resolver, (likely by having to define two different types).

1 Like