higherkindness / mu-haskell

Mu (μ) is a purely functional framework for building micro services.
http://higherkindness.io/mu-haskell/
Apache License 2.0
334 stars 19 forks source link

Union types support for GraphQL #251

Closed kubaracek closed 3 years ago

kubaracek commented 4 years ago

Just finished playing with this library and noticed that union types for Graphql are not supported. Is this something on a roadmap or no plans to support them in general?

serras commented 4 years ago

Thanks for bringing up this issue, @kubaracek.

The problem here is how to represent that in Mu's type-level schema language. Since it originated from Protobuf/Avro, the notion of union in Mu is mostly tied to a field, but GraphQL has a notion of union type. We haven't been able to solve this mismatch yet.

But maybe you can help us! Could you come up with a small GraphQL schema and how you could imagine the resolvers to work? Maybe you need to define a sum type upfront, and then return that?

kutyel commented 4 years ago

@kubaracek you might be pleased to know that @serras is working on this on #270 😉

kubaracek commented 3 years ago

Ua! Nice. Will give it a try. Thank you :)

kutyel commented 3 years ago

Awesome! @kubaracek bear in mind that since this is not yet released you'll have to rely on pinning your mu-haskell dep to the specific commit in which this was merged 😉

kutyel commented 3 years ago

@kubaracek now it's released on hackage! https://github.com/higherkindness/mu-haskell/releases/tag/v0.5.0.0