Skip to content

fix(config): Handle overlapping untagged enum schemas#25828

Open
bruceg wants to merge 3 commits into
masterfrom
bruceg/fix-config-schema-untagged-enum
Open

fix(config): Handle overlapping untagged enum schemas#25828
bruceg wants to merge 3 commits into
masterfrom
bruceg/fix-config-schema-untagged-enum

Conversation

@bruceg

@bruceg bruceg commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

When generating JSON schemas, the config system would generate oneOf arrays containing the set of variants. However, this differs from how serde actually parses variants: oneOf means that exactly one variant may match but serde variants may have overlap. This change detects overlapping untagged variants and emits anyOf when multiple variants accept the same value. It preserves oneOf output for disjoint variants and adds regression coverage.

Vector configuration

N/A schema is produced by vector generate-schema

How did you test this PR?

Included unit tests, component docs show no changes, and visually inspected schema diff before and after.

Change Type

  • Bug fix
  • New feature
  • Dependencies
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

Notes

  • Please read our Vector contributor resources.
  • Do not hesitate to use @vectordotdev/vector to reach out to us regarding this PR.
  • Some CI checks run only after we manually approve them.
    • We recommend adding a pre-push hook, please see this template.
    • Alternatively, we recommend running the following locally before pushing to the remote branch:
      • make fmt
      • make check-clippy (if there are failures it's possible some of them can be fixed with make clippy-fix)
      • make test
  • After a review is requested, please avoid force pushes to help us review incrementally.
    • Feel free to push as many commits as you want. They will be squashed into one before merging.
    • For example, you can run git merge origin master and git push.
  • If this PR introduces changes Vector dependencies (modifies Cargo.lock), please
    run make build-licenses to regenerate the license inventory and commit the changes (if any). More details on the dd-rust-license-tool.

@bruceg bruceg added the domain: config Anything related to configuring Vector label Jul 13, 2026
@bruceg
bruceg requested a review from a team as a code owner July 13, 2026 20:55
@bruceg bruceg added domain: schemas Anything related to internal Vector event schemas type: bug A bug fix labels Jul 13, 2026
@datadog-vectordotdev

datadog-vectordotdev Bot commented Jul 13, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: f7655bb | Docs | Give us feedback!

@bruceg
bruceg force-pushed the bruceg/fix-config-schema-untagged-enum branch from 359660c to be88638 Compare July 13, 2026 20:58

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 359660cc9e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/vector-config/src/schema/helpers.rs Outdated
When generating JSON schemas, the config system would generate `oneOf` arrays
containing the set of variants. However, this differs from how `serde` actually
parses variants: `oneOf` means that exactly one variant may match but `serde`
variants may have overlap. This change detects overlapping untagged variants and
emits `anyOf` when multiple variants accept the same value. It preserves `oneOf`
output for disjoint variants and adds regression coverage.
@bruceg
bruceg force-pushed the bruceg/fix-config-schema-untagged-enum branch from be88638 to f90c8a7 Compare July 13, 2026 21:26
@bruceg

bruceg commented Jul 13, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: f90c8a76d4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: config Anything related to configuring Vector domain: schemas Anything related to internal Vector event schemas type: bug A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants