tailcallhq / tailcall

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

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

Open tusharmath opened 1 month ago

tusharmath commented 1 month 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 month ago

/bounty $50

algora-pbc[bot] commented 1 month 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 month ago

/attempt #2904

Algora profile Completed bounties Tech Active attempts Options
@ayusham001    1 tailcallhq bounty
+ 8 bounties from 3 projects
Cancel attempt
Abiji-2020 commented 1 month ago

@ayusham001 is this still on shall i work on it too?

ayusham001 commented 1 month ago

@ayusham001 is this still on shall i work on it too?

Yep, you can start working on it

github-actions[bot] commented 3 days ago

Action required: Issue inactive for 30 days. Status update or closure in 7 days.