fix(config): accept omitted flattened optional internally-tagged enums - #26248
fix(config): accept omitted flattened optional internally-tagged enums#26248bruceg wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b0f8e1f75b
ℹ️ 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".
b0f8e1f to
0b007d8
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0b007d86cf
ℹ️ 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".
Generated JSON Schema treated `#[serde(flatten)] Option<InternallyTaggedEnum>`
as required. `generate_optional_schema` encodes optionality as `oneOf: [null, T]`,
which is correct for a nullable property, but flatten merges that subschema into
the parent object via `allOf`. The value under validation is never JSON `null`,
so the null branch was dead and the present branch was the only reachable one.
Rewrite that branch after single-use `$ref` inlining, scoped to `allOf` members
only: replace `null` with `not: { required: [<tag field>] }` so omission matches
serde. Shared optional `$ref`s are cloned into the flatten site so a plain
`Option<T>` property still accepts JSON `null`.
0b007d8 to
7b65721
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Summary
Generated JSON Schema treated
#[serde(flatten)] Option<InternallyTaggedEnum>as required.generate_optional_schemaencodes optionality asoneOf: [null, T], which is correct for a nullable property, but flatten merges that subschema into the parent object viaallOf. The value under validation is never JSONnull, so the null branch was dead and the present branch was the only reachable one.Rewrite that branch after single-use
$refinlining, scoped toallOfmembers only: replacenullwithnot: { required: [<tag field>] }so omission matches serde. Shared optional$refs are cloned into the flatten site so a plainOption<T>property still accepts JSONnull.References
Vector configuration
N/A
How did you test this PR?
PR includes a set of snapshots showing correct schema outputs.
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.Contributor Guidelines
@vectordotdev/vectorto reach out to us regarding this PR.pre-pushhook (template) or run the following locally before pushing:make fmtmake check-clippy(auto-fix 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.