Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: clean up apollo_federation::compile_service #2904

Open
tusharmath opened this issue Sep 25, 2024 · 5 comments
Open

refactor: clean up apollo_federation::compile_service #2904

tusharmath opened this issue Sep 25, 2024 · 5 comments

Comments

@tusharmath
Copy link
Contributor

tusharmath commented Sep 25, 2024

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_service before making the change.
  • Ensure there is only one writeln! statement and one call to document::print.
  • Create one ServiceDocument and 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_federation to federation
@tusharmath tusharmath changed the title refactor: clean up federation::compile_service refactor: clean up apollo_federation::compile_service Sep 25, 2024
@tusharmath
Copy link
Contributor Author

/bounty $50

Copy link

algora-pbc bot commented Sep 25, 2024

💎 $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
Copy link

ayusham001 commented Sep 25, 2024

/attempt #2904

Algora profile Completed bounties Tech Active attempts Options
@ayusham001    1 tailcallhq bounty
+ 8 bounties from 3 projects
Cancel attempt

ayusham001 added a commit to ayusham001/tailcall that referenced this issue Sep 25, 2024
ayusham001 added a commit to ayusham001/tailcall that referenced this issue Sep 25, 2024
ayusham001 added a commit to ayusham001/tailcall that referenced this issue Sep 25, 2024
@Abiji-2020
Copy link

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

@ayusham001
Copy link

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

Yep, you can start working on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants