cerc-io / laconicd-deprecated

Read-only mirror of https://git.vdb.to/cerc-io/laconicd-deprecated
https://git.vdb.to/cerc-io/laconicd-deprecated
GNU Lesser General Public License v3.0
6 stars 8 forks source link

Determine why a Union type wasn't used in graphql schema #105

Closed dboreham closed 1 year ago

dboreham commented 1 year ago

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.

roysc commented 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)

telackey commented 1 year ago

https://git.vdb.to/cerc-io/laconicd/issues/105