tailcall
tailcall copied to clipboard
Feature Request: Support for Apollo Federation in Tailcall
Summary
Enable Tailcall to support Apollo Federation by adding a flag in the @server directive. When enabled, this flag will support the _entities query, allowing Tailcall to function as a subgraph in a federated architecture.
Detailed Description
To integrate Apollo Federation with Tailcall, we propose the following enhancements:
-
Flag Addition in
@server:- Introduce a new flag within the
@serverdirective to enable federation support. - When this flag is activated, Tailcall will automatically handle the
_entitiesquery, essential for Apollo Federation's distributed schema architecture.
- Introduce a new flag within the
-
Support for Resolver Directives on Types:
- Enable resolver directives like
@http,@grpc,@const, and others to be applied directly on Types. - This will allow Tailcall to infer the key fields required for federation based on the resolver configuration.
- Enable resolver directives like
-
Key Inference:
- Analyze the resolvers attached to Types and automatically infer the appropriate
@keydirective. - Example:
- For
@http(path: "/users/{{.value.id}}"), the inferred key would be@key(fields: "id"). - For the query:
The inferred key would be@http(path: "/users/", query: [ {key: "id", value: "{{.value.id}}"}, {key: "name", value: "{{.value.name}}"}, {key: "org_id", value: "{{.value.organisation.id}}"}, {key: "org_name", value: "{{.value.organisation.name}}"} ])@key(fields: "id name organisation {id, name}").
- For
- If multiple resolvers are attached to the same type, multiple keys will be inferred and handled accordingly.
- Analyze the resolvers attached to Types and automatically infer the appropriate
-
Support for
_entitiesQuery:- Implement the
_entitiesquery required by Apollo Federation. - Example of how the query to the subgraph would look:
type Query { _entities(representations: [_Any!]!): [_Entity]! }- Example query:
query ($representations: [_Any!]!) { _entities(representations: $representations) { ... on User { id username } } }- Corresponding variable:
{ "representations": [ { "__typename": "User", "id": "5" } ] }
- Corresponding variable:
- Example query:
- Implement the
References
-
For a reference implementation of Apollo Federation, see the async-graphQL implementation.
-
Subgraph Documentation
Technical Requirements
- Integration & Unit Tests are required.
- Update the documentation on website
/bounty 380$
💎 $380 bounty • Tailcall Inc.
Steps to solve:
- Start working: Comment
/attempt #2639with your implementation plan - Submit work: Create a pull request including
/claim #2639in the PR body to claim the bounty - Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts
🙏 Thank you for contributing to tailcallhq/tailcall! 🧐 Checkout our guidelines before you get started. 💵 More about our bounty program.
| Attempt | Started (GMT+0) | Solution |
|---|---|---|
| 🔴 @onyedikachi-david | Aug 10, 2024, 7:00:15 PM | WIP |
| 🟢 @meskill | #2693 |
/attempt #2639
| Algora profile | Completed bounties | Tech | Active attempts | Options |
|---|---|---|---|---|
| @onyedikachi-david | 3 tailcallhq bounties + 2 bounties from 1 project |
JavaScript, Shell |
Cancel attempt |
please provide some working config
@onyedikachi-david: Reminder that in 1 days the bounty will become up for grabs, so please submit a pull request before then 🙏
The bounty is up for grabs! Everyone is welcome to /attempt #2639 🙌
💡 @meskill submitted a pull request that claims the bounty. You can visit your bounty board to reward.
Action required: Issue inactive for 30 days. Status update or closure in 7 days.