-
-
Notifications
You must be signed in to change notification settings - Fork 439
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
Support for Apollo Federation #911
Comments
Are you willing to work on this? |
I'm also searching for a way to implement it. Anyone else working on it? |
I could try but I don't think that I have a good enough understanding of the code to make that big implementations yet. |
I'm trying to implement this too. Does anybody found some clear information about this specification, or examples from other implementations? |
@RPSimon here's a Ruby implementation of it https://github.com/Gusto/apollo-federation-ruby |
We're happy to fund development of this if anyone is interested! |
Hey, |
@renepardon go for it! Make sure to check out https://github.com/nuwave/lighthouse/blob/master/CONTRIBUTING.md to get going. We put a big emphasis on tests! |
I came across the following idea: key Directive: https://gist.github.com/renepardon/6751168cc12bc9b32f32c7897169d112 And last but not least an additional method within the SchemaPrinter class: /**
* @param Schema $schema
* @param array $options
*
* @return string
*/
public static function printFederatedSchema(Schema $schema, array $options = []): string
{
$fields = $directives = [];
$originalQueryType = $schema->getQueryType();
$federationFields = ['_service', '_entities'];
$federationDirectives = ['external', 'requires', 'provides', 'key', 'extends'];
foreach ($originalQueryType->getFields() as $key => $field) {
if (in_array($key, $federationFields)) {
continue;
}
$fields[] = $field;
}
foreach ($schema->getDirectives() as $directive) {
if (in_array($directive->name, $federationDirectives)) {
continue;
}
$directives[] = $directive;
}
$queryType = new ObjectType([
'name' => 'Query',
'fields' => $fields,
'interfaces' => $originalQueryType->getInterfaces(),
]);
$newSchema = new Schema([
'query' => $queryType,
'mutation' => $schema->getMutationType(),
'subscription' => $schema->getSubscriptionType(),
'directives' => $directives,
]);
return self::printFilteredSchema(
$newSchema,
static function (Directive $type) {
return !Directive::isSpecifiedDirective($type);
},
static function ($type) {
return !Type::isBuiltInType($type);
},
$options
);
} What's missing so far? Within the printFilteredSchema I have the option |
@renepardon - My team would be happy to help you work on a solution to this. What is the best way to get involved? |
@jerredhurst Right now I no longer work on it. I switched to NestJS |
@renepardon could you put up your WIP as a PR? |
…the federation support into lighthouse
Is anyone working on it? |
@RodriigoGS Feel free to continue #1051 |
@renepardon @RodriigoGS i pulled the changes of #1051 to a branch. Whoever wants to work on it can fork and branch from there. Thanks |
Is anyone actively looking at this? I have a team that's interested in developing GraphQL servers using Lighthouse, but we're using Apollo Federation and would need that support to really make it work. |
webonyx/graphql-php#552 is still open. Problem is also that most of the methods used within the graphql-php library are private which makes it pretty hard to extend/adjust the library as required for federation to work. You need to copy a lot of things just to make small adjustments within the schema printer. And I don't think it's a good idea to do so. This way you would just manage your own version of GraphQL library. |
Let's see if we can make the I would be fine with maintaining a modified version of the |
Would php-graphql-federation help? It’s built to extend |
Feel free to fork, branch from https://github.com/nuwave/lighthouse/tree/federation and give it a try. |
@matthewhall-ca has funded $200.00 to this issue.
|
Looking to fund to get this developed - feel free to email my address on my profile if you want to discuss specifics or need a larger bounty for this feature |
If nobody else is interested, I can see it in my spare time. |
Hey everyone, I've setup a simple package that provides Federation support for Lighthouse (service only). A few things to note:
I hope someone who's willing to implement this as a core feature can find a good starting point in the repo. Also thanks to everyone who tried implementing this - definitely helped a lot! You can find the repo here: https://github.com/awardis/federation If you have trouble getting this package to work I'm willing to provide an example project. @matthewhall-ca Bounty goes to the one implementing this into core :-) |
I have been talking to @matthewhall-ca and will look into supporting this. |
Removing the funds from Issue Hunt as @spawnia and I have discussed direct compensation over email |
@matthewhall-ca has cancelled funding for this issue.(Cancelled amount: $200.00) See it on IssueHunt |
Hi, is this still something that is being worked on? |
#1728 has a working version. There is a little bit of work to be done, mostly documentation. I plan to release it as an experimental feature soon. |
Released as an experimental feature as of https://github.com/nuwave/lighthouse/releases/tag/v5.6.0. Thanks to everyone involved and in particular @matthewhall-ca for getting this funded. |
Hi, I'm looking for which graphql federation gateway to use, there's not much in the lighthouse docs. And in there says that the lighthouse itself cannot be used as a gateway. What are you guys using as a gateway for the lighthouse federation? Any info would be greatly appreciated. Sorry for posting in here, but i don't know where else I could post it. Thanks! |
@KaduMoura You just use the main Federation server thats from Apollo (written in Javascript). https://www.apollographql.com/docs/federation/ You put it in front of your various Laravel Lighthouse servers using Federation. If you have any other questions feel free to email me at the email on my profile |
Thanks!!! You are awesome!! |
A while ago Apollo introduced a new strategy for merging GraphQL schemas together in a more sensible way than schema stitching. It would be great to see this supported in Lighthouse too.
https://www.apollographql.com/docs/apollo-server/federation/introduction/
https://www.apollographql.com/docs/apollo-server/federation/federation-spec/
IssueHunt Summary
Backers (Total: $0.00)
Become a backer now!
Or submit a pull request to get the deposits!
Tips
The text was updated successfully, but these errors were encountered: