Skip to content
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 #351

Open
alejo-lapix opened this issue Jun 14, 2021 · 6 comments
Open

Federation support #351

alejo-lapix opened this issue Jun 14, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@alejo-lapix
Copy link

Do yo have any plans to support apollo federation?

@oojacoboo
Copy link
Collaborator

I haven't used Apollo federation. Can you outline the specific requirements that'd be needed from this lib?

@oojacoboo oojacoboo added additional info needed Additional information is needed to proceed enhancement New feature or request labels Jun 15, 2021
@alejo-lapix
Copy link
Author

Apollo Federation allows you to implement a single data graph across multiple services. Libraries like pascaldevink/php-graphql-federation extends the current schema and enables federation, but it does not work well with graphqlite.

To make a GraphQL service federation capable, we need:

  • Implementation of the federation schema specification.
  • Support for fetching service capabilities.
  • Implementation of stub type generation for references.
  • Implementation of request resolving for entities.

Hope this helps. You need help implementing any of those features? Would be great to contribute to graphlite.

@oojacoboo
Copy link
Collaborator

Thanks for the outlining that. I'm familiar with federation, just wasn't sure exactly what would be needed.

I'm not aware of any current initiatives or motivation to get federation added, at the moment. However, assuming this could be easily configured and doesn't cause performance implications, I don't see why there would be any objections to a PR raised with federation support. So yea, if you'd like to take a go at it, that'd be great.

@oojacoboo oojacoboo removed the additional info needed Additional information is needed to proceed label Jun 27, 2021
@ycfreeman
Copy link

there's a new one https://github.com/Skillshare/apollo-federation-php
this one is added to the official list of "Subgraph-compatible server libraries"

https://www.apollographql.com/docs/federation/other-servers/

@gtavares
Copy link

@oojacoboo This discussion is a bit hold but do you have any plans to support the federation? 🙂 We would like to use graphqlite in combination with apollo-federation-php but it doesn't seem a simple task.

The framework needs to be adapted to support instantiating EntityObjectType or EntityRefObjectType (for example by creating a new attribute #[ExternalType] ). However, the MutableObjectType is extending the ObjectType and we have multiple places checking if the object is instance of MutableObjectType. Maybe we could have an interface (e.g ObjectTypeInterface) where MutableObjectType would extend from? And also provide a way to add custom types?

I believe that wrapping the schema into a federated schema is already supported by doing something like this:

$config = $this->factory->createSchema()->getConfig();
$schema = new FederatedSchema(
	[
		'query' => $config->getQuery(),
		'mutation' => $config->getMutation(),
		'types' => $types,
		'assumeValid' => true,
	]
);

But we still need to find a way to create the external types :)

Thank you!

@oojacoboo
Copy link
Collaborator

@gtavares I still haven't looked into federation too much. But, wouldn't the goal be for GraphQLite to deliver it's schema into a federation server that combines with the rest of the federated graph?

I came across this related lib and docs as well: https://github.com/pascaldevink/php-graphql-federation/blob/master/README.md.

Also, see this discussion here around SDL output and caching and #569. It's possible we could also make use of this output for feeding to a federation server.

As for the changes you've mentioned in GraphQLite, why are these needed? Why can't GraphQLite deliver something like an SDL to a federation server and that server proxy the requests back to GraphQLite? I don't understand why the mentioned changes are necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants