Closed dboreham closed 1 year ago
I suspect the answer relates to the fact that when defining a GraphQL union, all variants must be other objects, not scalars. So, we would have to wrap everything like IntVariant
for int, etc. and perhaps that amount of boilerplate was deemed not worth it - I think @ashwinphatak's team would have to confirm, though.
(And to be pedantic, a sum type would be a union, what we have now is a product type)
Our GraphQL endpoint returns registry records conforming to a property set schema with
Value
type defined here.This is a struct or "sum" type, where all of
string
,json
,reference
are present but by convention all except one is null. This is a way of implementing a variant, union, or "product" type.But GraphQL has union types. Curious to understand why we didn't use that capability.