Skip to content

feat(router): add allow_string_literals_for_enums engine option - #3103

Merged
devsergiy merged 1 commit into
mainfrom
sergiy/router-585-graphql-string-to-enum-type-mismatch-after-upgrade
Jul 22, 2026
Merged

feat(router): add allow_string_literals_for_enums engine option#3103
devsergiy merged 1 commit into
mainfrom
sergiy/router-585-graphql-string-to-enum-type-mismatch-after-upgrade

Conversation

@devsergiy

@devsergiy devsergiy commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Added an opt-in router setting to accept matching string literals for enum arguments and input fields.
    • Non-matching strings and invalid scalar values continue to be rejected.
    • Existing GraphQL enum literal behavior remains unchanged.
  • Documentation

    • Added configuration guidance, examples, defaults, and environment-variable documentation for the new setting.
    • Added the new page to the Router documentation navigation.

Checklist

Open Source AI Manifesto

This project follows the principles of the Open Source AI Manifesto. Please ensure your contribution aligns with its principles.

@mintlify

mintlify Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
wundergraphinc 🟢 Ready View Preview Jul 21, 2026, 9:11 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

Router-nonroot image scan passed

✅ No security vulnerabilities found in image:

ghcr.io/wundergraph/cosmo/router:sha-5a9e8d2f2f366106baebab4d9b174fbc3eb11362-nonroot

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d46dfce6-2516-49b6-a419-1248a308eb88

📥 Commits

Reviewing files that changed from the base of the PR and between 3fb8819 and e06eac2.

📒 Files selected for processing (10)
  • docs-website/docs.json
  • docs-website/router/configuration.mdx
  • docs-website/router/string-literals-for-enums.mdx
  • router-tests/operations/inline_literal_validation_test.go
  • router/core/graph_server.go
  • router/core/operation_processor.go
  • router/pkg/config/config.go
  • router/pkg/config/config.schema.json
  • router/pkg/config/testdata/config_defaults.json
  • router/pkg/config/testdata/config_full.json
🚧 Files skipped from review as they are similar to previous changes (10)
  • router/pkg/config/testdata/config_defaults.json
  • docs-website/router/string-literals-for-enums.mdx
  • docs-website/docs.json
  • router/pkg/config/testdata/config_full.json
  • router/pkg/config/config.go
  • router/pkg/config/config.schema.json
  • router/core/graph_server.go
  • docs-website/router/configuration.mdx
  • router/core/operation_processor.go
  • router-tests/operations/inline_literal_validation_test.go

Walkthrough

Adds an opt-in router configuration that allows matching string literals for GraphQL enum values, propagates it through validation, tests enabled and disabled behavior, and documents the option.

Changes

Enum string literal support

Layer / File(s) Summary
Configuration contract and documentation
router/pkg/config/config.go, router/pkg/config/config.schema.json, router/pkg/config/testdata/*, docs-website/router/configuration.mdx, docs-website/docs.json, docs-website/router/string-literals-for-enums.mdx
Adds the allow_string_literals_for_enums configuration field, defaults, schema metadata, navigation entry, and usage documentation.
Validation option propagation
router/core/graph_server.go, router/core/operation_processor.go
Passes the configuration through operation processor construction and conditionally enables enum string-literal validation.
Enum literal behavior coverage
router-tests/operations/inline_literal_validation_test.go
Tests default rejection, enabled acceptance of matching enum strings, rejection of non-matching strings, and unchanged scalar and enum literal validation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding the allow_string_literals_for_enums router engine option.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.06%. Comparing base (cfee827) to head (e06eac2).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3103      +/-   ##
==========================================
+ Coverage   61.83%   62.06%   +0.23%     
==========================================
  Files         262      262              
  Lines       30810    30814       +4     
==========================================
+ Hits        19050    19124      +74     
+ Misses      10233    10178      -55     
+ Partials     1527     1512      -15     
Files with missing lines Coverage Δ
router/core/graph_server.go 85.53% <100.00%> (+0.41%) ⬆️
router/core/operation_processor.go 86.74% <100.00%> (+0.04%) ⬆️
router/pkg/config/config.go 83.00% <ø> (ø)

... and 14 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread docs-website/docs.json
Comment thread docs-website/router/configuration.mdx
@devsergiy
devsergiy force-pushed the sergiy/router-585-graphql-string-to-enum-type-mismatch-after-upgrade branch from 3fb8819 to e06eac2 Compare July 22, 2026 11:01
@devsergiy
devsergiy merged commit c9838ae into main Jul 22, 2026
40 of 47 checks passed
@devsergiy
devsergiy deleted the sergiy/router-585-graphql-string-to-enum-type-mismatch-after-upgrade branch July 22, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants