fix: make composeDirective argument non-nullable#3278
Merged
dariuszkuc merged 1 commit intomainfrom Jun 20, 2025
Merged
Conversation
Per our [docs](https://www.apollographql.com/docs/graphos/schema-design/federated-schemas/reference/directives#composedirective), `@composeDirective` requires non-nullable value to be passed as an argument. Our [validations](https://github.com/apollographql/federation/blob/main/composition-js/src/composeDirectiveManager.ts#L250-L255) were checking for valid values (it has to be a string that starts with `@`), but the generated schema was incorrectly specifying that the argument was nullable.
🦋 Changeset detectedLatest commit: cdab066 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
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 |
|
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. |
dariuszkuc
pushed a commit
that referenced
this pull request
Jun 24, 2025
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.11.1 ### Patch Changes - Adding new CompositionOption `maxValidationSubgraphPaths`. This value represents the maximum number of SubgraphPathInfo objects that may exist in a ValidationTraversal when checking for satisfiability. Setting this value can help composition error before running out of memory. Default is 1,000,000. ([#3254](#3254)) - Fix bug in composition where, when a field's type in a subgraph is a subtype of the field's type in the supergraph, the satisfiability validation spuriously succeeds/errors. ([#3277](#3277)) - Updated dependencies \[[`7799ad1717becf15fb0e82f89619f2ec8a24b4d4`](7799ad1), [`b26794c5724ef23d1f0fd45a40aee3d301557489`](b26794c), [`51bed5be49d8e87adae59f568315c9e3488a91e0`](51bed5b)]: - @apollo/federation-internals@2.11.1 - @apollo/query-graphs@2.11.1 ## @apollo/gateway@2.11.1 ### Patch Changes - Updated dependencies \[[`7799ad1717becf15fb0e82f89619f2ec8a24b4d4`](7799ad1), [`b26794c5724ef23d1f0fd45a40aee3d301557489`](b26794c), [`51bed5be49d8e87adae59f568315c9e3488a91e0`](51bed5b)]: - @apollo/federation-internals@2.11.1 - @apollo/composition@2.11.1 - @apollo/query-planner@2.11.1 ## @apollo/federation-internals@2.11.1 ### Patch Changes - fix: make composeDirective argument non-nullable. ([#3278](#3278)) Per our [docs](https://www.apollographql.com/docs/graphos/schema-design/federated-schemas/reference/directives#composedirective), `@composeDirective` requires non-nullable value to be passed as an argument. Our [validations](https://github.com/apollographql/federation/blob/main/composition-js/src/composeDirectiveManager.ts#L250-L255) were checking for valid values (it has to be a string that starts with `@`), but the generated schema was incorrectly specifying that the argument was nullable. - Adding new CompositionOption `maxValidationSubgraphPaths`. This value represents the maximum number of SubgraphPathInfo objects that may exist in a ValidationTraversal when checking for satisfiability. Setting this value can help composition error before running out of memory. Default is 1,000,000. ([#3254](#3254)) ## @apollo/query-graphs@2.11.1 ### Patch Changes - Fix bug in composition where, when a field's type in a subgraph is a subtype of the field's type in the supergraph, the satisfiability validation spuriously succeeds/errors. ([#3277](#3277)) - Updated dependencies \[[`7799ad1717becf15fb0e82f89619f2ec8a24b4d4`](7799ad1), [`b26794c5724ef23d1f0fd45a40aee3d301557489`](b26794c)]: - @apollo/federation-internals@2.11.1 ## @apollo/query-planner@2.11.1 ### Patch Changes - Updated dependencies \[[`7799ad1717becf15fb0e82f89619f2ec8a24b4d4`](7799ad1), [`b26794c5724ef23d1f0fd45a40aee3d301557489`](b26794c), [`51bed5be49d8e87adae59f568315c9e3488a91e0`](51bed5b)]: - @apollo/federation-internals@2.11.1 - @apollo/query-graphs@2.11.1 ## @apollo/subgraph@2.11.1 ### Patch Changes - Updated dependencies \[[`7799ad1717becf15fb0e82f89619f2ec8a24b4d4`](7799ad1), [`b26794c5724ef23d1f0fd45a40aee3d301557489`](b26794c)]: - @apollo/federation-internals@2.11.1 ## apollo-federation-integration-testsuite@2.11.1 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
dariuszkuc
added a commit
that referenced
this pull request
Jun 25, 2025
`subgraph-js` was incorrectly declaring `@composeDirective` argument as nullable whereas it should be non-null. This was fixed in #3278 but it will cause composition failures when trying to compose subgraphs that use older versions of subgraph-js that provide incorrect definitions.
dariuszkuc
added a commit
that referenced
this pull request
Jun 25, 2025
This reverts commit 7799ad1.
dariuszkuc
added a commit
that referenced
this pull request
Jun 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per our docs,
@composeDirectiverequires non-nullable value to be passed as an argument.Our validations were checking for valid values (it has to be a string that starts with
@), but the generated schema was incorrectly specifying that the argument was nullable.