fix(config): Handle overlapping untagged enum schemas#25828
Conversation
359660c to
be88638
Compare
There was a problem hiding this comment.
💡 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".
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.
be88638 to
f90c8a7
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
When generating JSON schemas, the config system would generate
oneOfarrays containing the set of variants. However, this differs from howserdeactually parses variants:oneOfmeans that exactly one variant may match butserdevariants may have overlap. This change detects overlapping untagged variants and emitsanyOfwhen multiple variants accept the same value. It preservesoneOfoutput for disjoint variants and adds regression coverage.Vector configuration
N/A schema is produced by
vector generate-schemaHow did you test this PR?
Included unit tests, component docs show no changes, and visually inspected schema diff before and after.
Change Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
Notes
@vectordotdev/vectorto reach out to us regarding this PR.pre-pushhook, please see this template.make fmtmake check-clippy(if there are failures it's possible some of them can be fixed withmake clippy-fix)make testgit merge origin masterandgit push.Cargo.lock), pleaserun
make build-licensesto regenerate the license inventory and commit the changes (if any). More details on the dd-rust-license-tool.