Skip to content

Federation support #351

Description

@alejo-lapix

Do yo have any plans to support apollo federation?

Activity

  1. oojacoboo commented on Jun 15, 2021

    @oojacoboo
    Collaborator

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

  2. alejo-lapix commented on Jun 27, 2021

    @alejo-lapix
    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.

  3. oojacoboo commented on Jun 27, 2021

    @oojacoboo
    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.

  4. ycfreeman commented on Oct 28, 2021

    @ycfreeman

    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/

  5. gtavares commented on Mar 28, 2023

    @gtavares

    @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!

  6. oojacoboo commented on Mar 28, 2023

    @oojacoboo
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions