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

Fixed query planner to pass the directives from original query to subgraph operations (#2961) #2967

Merged
merged 3 commits into from
Mar 25, 2024

Conversation

duckki
Copy link
Contributor

@duckki duckki commented Mar 23, 2024

Summary of changes:

  • added "directives" field to the class Operation.
  • updated DocumentNode <-> Operation conversion functions to pass directives.
  • added plumbing of directives through query planner logic.

#2961

@duckki duckki requested a review from a team as a code owner March 23, 2024 03:35
Copy link

netlify bot commented Mar 23, 2024

👷 Deploy request for apollo-federation-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit d3042ad

Copy link

changeset-bot bot commented Mar 23, 2024

🦋 Changeset detected

Latest commit: d3042ad

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@apollo/query-planner Patch
@apollo/federation-internals Patch
@apollo/gateway Patch
@apollo/composition Patch
@apollo/query-graphs Patch
@apollo/subgraph Patch
apollo-federation-integration-testsuite Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

codesandbox-ci bot commented Mar 23, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@duckki
Copy link
Contributor Author

duckki commented Mar 25, 2024

Thanks for approval. I'll go ahead and merge this PR.

@duckki duckki merged commit a494631 into apollographql:main Mar 25, 2024
12 of 13 checks passed
@duckki duckki deleted the duckki/fix-2961 branch March 25, 2024 23:02
o0Ignition0o pushed a commit that referenced this pull request Apr 16, 2024
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @apollo/composition@2.7.3

### Patch Changes

- Fix a query planning bug where invalid subgraph queries are generated
with `reuseQueryFragments` set true.
([#2952](#2952))
([#2963](#2963))

- Updated dependencies
\[[`ec04c50b4fb832bfd281ecf9c0c2dd7656431b96`](ec04c50),
[`a494631918156f0431ceace74281c076cf1d5d51`](a494631)]:
    -   @apollo/federation-internals@2.7.3
    -   @apollo/query-graphs@2.7.3

## @apollo/gateway@2.7.3

### Patch Changes

- Updated dependencies
\[[`ec04c50b4fb832bfd281ecf9c0c2dd7656431b96`](ec04c50),
[`3e2c845c74407a136b9e0066e44c1ad1467d3013`](3e2c845),
[`a494631918156f0431ceace74281c076cf1d5d51`](a494631)]:
    -   @apollo/query-planner@2.7.3
    -   @apollo/composition@2.7.3
    -   @apollo/federation-internals@2.7.3

## @apollo/federation-internals@2.7.3

### Patch Changes

- Fix a query planning bug where invalid subgraph queries are generated
with `reuseQueryFragments` set true.
([#2952](#2952))
([#2963](#2963))

- Fixed query planner to pass the directives from original query to
subgraph operations (#2961)
([#2967](#2967))

## @apollo/query-graphs@2.7.3

### Patch Changes

- Updated dependencies
\[[`ec04c50b4fb832bfd281ecf9c0c2dd7656431b96`](ec04c50),
[`a494631918156f0431ceace74281c076cf1d5d51`](a494631)]:
    -   @apollo/federation-internals@2.7.3

## @apollo/query-planner@2.7.3

### Patch Changes

- Fix a query planning bug where invalid subgraph queries are generated
with `reuseQueryFragments` set true.
([#2952](#2952))
([#2963](#2963))

- Type conditioned fetching
([#2949](#2949))

When querying a field that is in a path of 2 or more unions, the query
planner was not able to handle different selections and would
aggressively collapse selections in fetches yielding an incorrect plan.

This change introduces new syntax to express type conditions in (key and
flatten) paths. Type conditioned fetching can be enabled through a flag,
and execution is supported in the router only. (#2938)

- Fixed query planner to pass the directives from original query to
subgraph operations (#2961)
([#2967](#2967))

- Updated dependencies
\[[`ec04c50b4fb832bfd281ecf9c0c2dd7656431b96`](ec04c50),
[`a494631918156f0431ceace74281c076cf1d5d51`](a494631)]:
    -   @apollo/federation-internals@2.7.3
    -   @apollo/query-graphs@2.7.3

## @apollo/subgraph@2.7.3

### Patch Changes

- Updated dependencies
\[[`ec04c50b4fb832bfd281ecf9c0c2dd7656431b96`](ec04c50),
[`a494631918156f0431ceace74281c076cf1d5d51`](a494631)]:
    -   @apollo/federation-internals@2.7.3

## apollo-federation-integration-testsuite@2.7.3

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
duckki added a commit to duckki/federation that referenced this pull request Apr 17, 2024
- Previously, directives applied on operations weren't properly attached to their parent elements.
- Changed the `Operation` class to inherit from `DirectiveTargetElement` class, which attaches directives properly.

Related: apollographql#2961
duckki added a commit that referenced this pull request Apr 17, 2024
- Changed the `Operation` class to inherit from `DirectiveTargetElement`
class, which attaches directives properly.
- Previously, directives applied on operations weren't properly attached
to their parent elements.

Related: #2961
duckki added a commit to duckki/federation that referenced this pull request Apr 19, 2024
- Ensure query variables used in the directives applied at the operation level are retained in subgraph queries
dariuszkuc pushed a commit that referenced this pull request Apr 19, 2024
…n level are retained in subgraph queries (#2986)

This fixes another regression created by PR #2967.

Related: #2961
o0Ignition0o pushed a commit that referenced this pull request Apr 22, 2024
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @apollo/composition@2.7.4

### Patch Changes

- Updated dependencies
\[[`d80b7f0ca1456567a0866a32d2b2abf940598f77`](d80b7f0)]:
    -   @apollo/federation-internals@2.7.4
    -   @apollo/query-graphs@2.7.4

## @apollo/gateway@2.7.4

### Patch Changes

- Updated dependencies
\[[`d80b7f0ca1456567a0866a32d2b2abf940598f77`](d80b7f0),
[`c89d8287e88d12cfd34c1baf1f42db672731b8a7`](c89d828)]:
    -   @apollo/query-planner@2.7.4
    -   @apollo/federation-internals@2.7.4
    -   @apollo/composition@2.7.4

## @apollo/federation-internals@2.7.4

### Patch Changes

- Fixed a regression created by PR (#2967), where directives would not
be properly attached to their parent. (#2982)
([#2984](#2984))

## @apollo/query-graphs@2.7.4

### Patch Changes

- Updated dependencies
\[[`d80b7f0ca1456567a0866a32d2b2abf940598f77`](d80b7f0)]:
    -   @apollo/federation-internals@2.7.4

## @apollo/query-planner@2.7.4

### Patch Changes

- Fixed a regression created by PR (#2967), where directives would not
be properly attached to their parent. (#2982)
([#2984](#2984))

- Ensure query variables used in the directives applied at the operation
level are retained in subgraph queries (#2986)
([#2986](#2986))

- Updated dependencies
\[[`d80b7f0ca1456567a0866a32d2b2abf940598f77`](d80b7f0)]:
    -   @apollo/federation-internals@2.7.4
    -   @apollo/query-graphs@2.7.4

## @apollo/subgraph@2.7.4

### Patch Changes

- Updated dependencies
\[[`d80b7f0ca1456567a0866a32d2b2abf940598f77`](d80b7f0)]:
    -   @apollo/federation-internals@2.7.4

## apollo-federation-integration-testsuite@2.7.4

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

2 participants