refactor: clean up `apollo_federation::compile_service`
Minor clean ups required:
Current Implementation
pub fn compile_service(config: &ConfigModule) -> Valid<IR, String> {
let mut sdl =
crate::core::document::print(filter_conflicting_directives(config.config().into()));
writeln!(sdl).ok();
// Add tailcall specific definitions to the sdl output
writeln!(
sdl,
"{}",
crate::core::document::print(filter_conflicting_directives(Config::graphql_schema()))
)
.ok();
writeln!(sdl).ok();
// Mark subgraph as Apollo federation v2 compatible according to [docs](https://www.apollographql.com/docs/apollo-server/using-federation/apollo-subgraph-setup/#2-opt-in-to-federation-2)
// (borrowed from async_graphql)
writeln!(sdl, "extend schema @link(").ok();
writeln!(sdl, "\turl: \"https://specs.apollo.dev/federation/v2.3\",").ok();
writeln!(sdl, "\timport: [\"@key\", \"@tag\", \"@shareable\", \"@inaccessible\", \"@override\", \"@external\", \"@provides\", \"@requires\", \"@composeDirective\", \"@interfaceObject\"]").ok();
writeln!(sdl, ")").ok();
Valid::succeed(IR::Service(sdl))
}
Technical Requirements
- Add new snapshot tests for
compile_servicebefore making the change. - Ensure there is only one
writeln!statement and one call todocument::print. - Create one
ServiceDocumentand modify it with definititions that are required or need to be dropped. - Ensure the new tests pass with the new change.
- NOTE: rename file
apollo_federationtofederation
/bounty $50
~~## 💎 $50 bounty • Tailcall Inc.~~
~~### Steps to solve:~~
~~1. Start working: Comment /attempt #2904 with your implementation plan~~
~~2. Submit work: Create a pull request including /claim #2904 in the PR body to claim the bounty~~
~~3. 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 |
|---|---|---|
| 🟢 @ayusham001 | Sep 25, 2024, 3:47:10 AM | WIP |
/attempt #2904
| Algora profile | Completed bounties | Tech | Active attempts | Options |
|---|---|---|---|---|
| @ayusham001 | 1 tailcallhq bounty + 8 bounties from 3 projects |
Cancel attempt |
@ayusham001 is this still on shall i work on it too?
@ayusham001 is this still on shall i work on it too?
Yep, you can start working on it
Action required: Issue inactive for 30 days. Status update or closure in 7 days.
Issue closed after 7 days of inactivity.