tailcallhq / tailcall

High Performance GraphQL Runtime
https://tailcall.run
Apache License 2.0
1.28k stars 247 forks source link

refactor: clean up `apollo_federation::compile_service` #2904

Open tusharmath opened 1 week ago

tusharmath commented 1 week ago

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

tusharmath commented 1 week ago

/bounty $50

algora-pbc[bot] commented 1 week ago

💎 $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 #2906
ayusham001 commented 1 week ago

/attempt #2904

Algora profile Completed bounties Tech Active attempts Options
@ayusham001    1 tailcallhq bounty
+ 8 bounties from 3 projects
Cancel attempt
algora-pbc[bot] commented 1 week ago

💡 @ayusham001 submitted a pull request that claims the bounty. You can visit your bounty board to reward.