Fork me on GitHub
#graphql
<
2018-06-06
>
eggsyntax17:06:28

Is there any way (in lacinia, or in GQL in general) to specify a type as an alternative / union? eg to say, "this field must be either an int or a string"? I'm dealing with some chart data, where certain fields can be any of a couple of types.

eggsyntax17:06:40

Oh, I see, I can do it with union types. Should have caught that one facepalm

hlship17:06:16

It's limited; union members must be objects (not scalars or interfaces).

eggsyntax17:06:15

Not ideal TBH, since in my case I really am just dealing with a single field that could be either of a couple of base types, but I can make it work. Thanks!

hlship17:06:02

I respect virtually all the decisions in the GraphQL spec ... but sometimes they aren't convienient, and sometimes they don't match up ideally with Clojure and EDN.

eggsyntax17:06:44

That seems like a solid decision 🙂