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

Federation @join__field requires parameter handling improvement #5910

Open
4 tasks
aarne opened this issue Feb 17, 2024 · 0 comments
Open
4 tasks

Federation @join__field requires parameter handling improvement #5910

aarne opened this issue Feb 17, 2024 · 0 comments

Comments

@aarne
Copy link

aarne commented Feb 17, 2024

Issue workflow progress

Progress of the issue based on the
Contributor Workflow

  • 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox

    Make sure to fork this template and run yarn generate in the terminal.

    Please make sure the GraphQL Tools package versions under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug

Given this snipped from a working supergraph schema.

type Environment {
  id: ID!
}

type Whatever {
  id: ID!
  environment: Environment! @join__field(graph: ACCOUNTS)  @join__field(graph: LOCAL, external: true) 
  external1: String @join__field(graph: LOCAL, requires: "id environment {id}") 
  external2: String @join__field(graph: LOCAL, requires: "id environment{id}") 
}

The resolver for external1 will receive the required fields correctly. But external2 will get only the id field correctly filled. The difference is only the space.

Not sure what is the best way to fix this, but i assume this is driven from utils/getKeyFnForFederation. The function considers the first level keys (split by space) only.

I think we have 2 options:

  • keep current simple logic and split the key until first { - will still give you the whole subtree (might be more data than needed)
  • we could parse the whole selectionSet and recursively filter the root value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant