Skip to content

fix: support opt-out of strict variable validation#8884

Merged
abernix merged 19 commits intodevfrom
caroline/router-1602
Feb 18, 2026
Merged

fix: support opt-out of strict variable validation#8884
abernix merged 19 commits intodevfrom
caroline/router-1602

Conversation

@carodewig
Copy link
Copy Markdown
Contributor

@carodewig carodewig commented Feb 11, 2026

#8821 fixed a gap in variable validation whereby the presence of unknown fields on an input object variable did not cause a request error as they should have. As a result, the stricter validation may cause breakages for customers.

To alleviate that potential pain point while customers update their variables to be compliant, this change introduces a router config option to retain the previous level of validation and issue a warning instead of an error.

Please Note: the stricter validation will be enabled by default. If you need to opt out, you must set the config option to measure instead.

Enabled:

supergraph:
  strict_variable_validation: enforce

Disabled:

supergraph:
  strict_variable_validation: measure

Docs have also been updated to reflect this change.


Additional notes

  • Test helper macros were converted to functions to reduce complexity and improve performance

Checklist

Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.

  • PR description explains the motivation for the change and relevant context for reviewing
  • PR description links appropriate GitHub/Jira tickets (creating when necessary)
  • Changeset is included for user-facing changes
  • Changes are compatible1
  • Documentation2 completed
  • Performance impact assessed and acceptable
  • Metrics and logs are added3 and documented
  • Tests added and passing4
    • Unit tests
    • Integration tests
    • Manual tests, as necessary

Footnotes

  1. It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this.

  2. Configuration is an important part of many changes. Where applicable please try to document configuration examples.

  3. A lot of (if not most) features benefit from built-in observability and debug-level logs. Please read this guidance on metrics best-practices.

  4. Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions.

@apollo-librarian
Copy link
Copy Markdown
Contributor

apollo-librarian bot commented Feb 11, 2026

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

0 new, 1 changed, 0 removed
* graphos/routing/(latest)/configuration/yaml.mdx

Build ID: 3c4be840d877a2330bec6ad8
Build Logs: View logs

URL: https://www.apollographql.com/docs/deploy-preview/3c4be840d877a2330bec6ad8

@github-actions

This comment has been minimized.

Comment thread apollo-router/src/spec/query/tests.rs Outdated
Copy link
Copy Markdown
Contributor

@conwuegb conwuegb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first pass comments, lgtm!

Comment thread apollo-router/src/spec/query.rs Outdated
Comment thread apollo-router/src/spec/field_type.rs Outdated
Comment thread apollo-router/src/services/supergraph/service.rs Outdated
Comment thread apollo-router/src/spec/query/tests.rs Outdated
.expect("could not parse query");
query.validate_variables(&request, &schema)
}};
fn run_validation_enforce_mode(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll let you decide whether it's best to merge this and the warn_mode function into one function. I'm okay with either option!

@conwuegb conwuegb changed the title fix: support opt-out of variable validation fix: support opt-out of strict variable validation Feb 12, 2026
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aaronArinder, in the team discussion on this opt-out feature you mentioned that the changeset should be super clear that an action is required by the customer. Is this what you had in mind or could it be clearer?

@carodewig carodewig marked this pull request as ready for review February 17, 2026 15:39
@carodewig carodewig requested review from a team as code owners February 17, 2026 15:39
@carodewig carodewig requested a review from conwuegb February 17, 2026 15:39
@aaronArinder
Copy link
Copy Markdown
Contributor

tagging @theJC for visibility

Comment on lines +1522 to +1524
fn default_strict_variable_validation() -> Mode {
Mode::Enforce
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

guessing an impl Default wouldn't have worked here?

Copy link
Copy Markdown
Contributor Author

@carodewig carodewig Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, since we want each use of mode to potentially have different defaults!

Comment on lines +2518 to +2520
#[allow(clippy::result_large_err)]
fn run_validation(
schema: String,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so much easier to read (and the other macros-to-functions below as well)

default is specified in the new fn
@@ -1,4 +1,4 @@
### Fix Router's validation of ObjectValue variables ([PR #8821](https://github.com/apollographql/router/pull/8821))
### Fix Router's validation of `ObjectValue` variables ([PR #8821](https://github.com/apollographql/router/pull/8821) and [PR #8884](https://github.com/apollographql/router/pull/8884))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to get caught up on the changes -- did the changeset I created for this pr (8884) get deleted in favor of updating the changeset for the previous pr (8821) with the opt-out information from this new pr?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! Since the two will go out in the same release, I think it will be easier for users to read about the changes in one place - they're really part of the same fix.

@carodewig carodewig enabled auto-merge (squash) February 17, 2026 22:59
@abernix abernix disabled auto-merge February 18, 2026 09:04
@abernix
Copy link
Copy Markdown
Member

abernix commented Feb 18, 2026

Force merging without @apollographql/docs approval.

@abernix abernix merged commit 2cc3dde into dev Feb 18, 2026
15 checks passed
@abernix abernix deleted the caroline/router-1602 branch February 18, 2026 09:04
@abernix abernix mentioned this pull request Feb 24, 2026
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.

4 participants