-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Federation support #462
Comments
Hi! Speaking of which, in the next few weeks I'm going to start some chatter in this repo on a draft I'm working on. |
I'm also interested in this and would be happy to contribute. I've done some experimentation and the the main issue I'm facing is the implicit ctx => Action.sequence[Ctx, Option[Any]](ctx.arg[Seq[JsValue]]("representations").map(getEntity)) and getEntity has this signature: def getEntity(data: JsValue)(implicit ctx: Context[Ctx, _]): LeafAction[Ctx, Option[Any]] This works as long as I don't have any |
Hi, Has there been any discussions or packages that have started to support this for sangria? |
It is possible to do, we have an internal implementation of it that we use for our services. The main issue that the marshallers need to be changed to support object scalars. |
@paulpdaniels we would also be interested in that. |
@yanns The spec itself is purely additive and can be put on top of the existing implementation. You need to add some new directives and probably some sugar to make them easy to add. But then the only change is that you need to basically wrap your existing schema with something like: def federate[Ctx, Val: ClassTag](_schema: Schema[Ctx, Val], resolvers: EntityResolver[Ctx]*): Schema[Ctx, Val] Where trait EntityResolver[Ctx] {
def typename: String
def resolve(obj: JsObject): LeafAction[Ctx, Option[Any]]
} I'll see if I can extract a gist of what we are doing. The incompatibility comes from the fact that the existing marshallers won't support the |
I've been using the same approach but I'm running into this #465 when the entity resolver doesn't return a deferred value but the entity has has nested deferred fields. Currently I'm resolving all entities to DeferredValues instead of LeafActions to work around this. Other than that this is working well for me. |
Interesting, haven't encountered that @ErikHedblom , though we still have a relatively small interplay of our federated services. Yeah the |
Should I create a new repo under the sangria organization for that? |
I think that would be great, we should be able to use @paulpdaniels gist for the first version. |
👋 Is there any progress in this area? |
You can find the first implementation here: https://github.com/sangria-graphql/sangria-federated/ |
Is there any plan to support Apollo Federation?
The text was updated successfully, but these errors were encountered: