Repository navigation
Reject deprecated field if interface field is not - #349
Merged
Merged
Conversation
Contributor
n1ru4l
approved these changes
Nov 23, 2026
n1ru4l
left a comment
Contributor
There was a problem hiding this comment.
Seems cheaper to do things like this instead of running another graphql validation pass on the output...
kamilkisiela
added a commit
to graphql-hive/federation-composition-rs
that referenced
this pull request
Dec 3, 2026
Ports upstream [v0.27.3](https://github.com/graphql-hive/federation-composition/releases/tag/v0.27.3) and [v0.28.0](https://github.com/graphql-hive/federation-composition/releases/tag/v0.28.0), one commit each, and moves `UPSTREAM` to `v0.28.0`. ## v0.27.3 - `DeprecatedInterfaceFieldImplementationRule` (graphql-hive/federation-composition#349): a deprecated field whose interface field is not deprecated fails composition with `INVALID_GRAPHQL`, since graphql-js 17 rejects such a schema. - The new `INVALID-GRAPHQL` test and the updated `huge-schema` fixture are ported. ## v0.28.0 From graphql-hive/federation-composition#347: - `composeSchemaContract` gains a `skipSatisfiability` option (`ComposeSchemaContractOptions`; `compose_schema_contract` takes an `options` argument). - `composeServicesWithContracts` (new `contracts/supergraph_state_contract.rs`) composes the supergraph once and derives each contract from its state: the tag filter is applied to the state, only the six `@inaccessible` rules run (`validate_inaccessible_usage`), the supergraph is built again, and the state is restored for the next contract. When the subgraphs fail to compose, each contract is composed in full. - The three filter predicates (`isExcludedByFilter`, `isExcludedByExcludeFilter`, `isArgumentExcludedByFilter`) are shared by both filters in `tag_extraction.rs`. - The wasm bindings and the npm shim export `composeServicesWithContracts` and `SchemaContract`. The shim shares a contract's unchanged definitions with the supergraph's document, as upstream does. Where the Rust differs in mechanism, not in result: - **External fields' `@tag`s.** Upstream reads them from the subgraph states' types, which the Rust drops after merging each subgraph. A stripped subgraph state now keeps its tagged fields' tags (`SubgraphState::field_tags`); untagged fields cost nothing. - **Restoring the state.** Upstream mutates the state through undo closures. The Rust decides every change from the state read-only, applies them, and logs each previous value by its position, so `restore` puts it back. - **"a contract reuses the definitions it does not change"** checks JS object identity. It passes on wasm through the shim; the Rust test compares the printed definitions, since a Rust success is its SDL. ## Verification - `pnpm conformance` at v0.28.0: 7,401 passed, 25 skipped, 8 todo on wasm (same as upstream's own TypeScript); 3,714/3,714 compositions identical. - `cargo test --workspace`: the suite has 3,823 passed, 17 ignored; graphql-js differentials, doctests and unit tests pass. The random-tag tests on `dgs` and `stars-stuff` compare every derived contract with the full per-contract composition. - `pnpm test:npm`: 16/16. - clippy (native and wasm32) and `cargo doc`, with `-D warnings`.
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.
Background
Composition can succeed and return a supergraph and public schema that are not valid GraphQL: a field is
@deprecatedwhile the interface field it implements is not. The spec forbids this inIsValidImplementation("If field is deprecated then implementedField must also be deprecated"). graphql-js 17 enforces the rule invalidateSchemaand graphql-js 16 does not, so the output fails validation for anyone on graphql 17.It can happen inside one subgraph, and also across subgraphs that are each valid on their own:
Description
Adds a supergraph validation rule,
DeprecatedInterfaceFieldImplementationRule, covering object and interface fields. Composition now fails withINVALID_GRAPHQL, using the same message as graphql-js 17:Opt-out. The rule can be turned off with
disableValidationRules: ["DeprecatedInterfaceFieldImplementationRule"].Checklist