Skip to content

Correctly fail to parse list-of-oneOf with an invalid item#4078

Open
ddadamhooper wants to merge 1 commit into
masterfrom
adam.hooper/propagate-unparsed
Open

Correctly fail to parse list-of-oneOf with an invalid item#4078
ddadamhooper wants to merge 1 commit into
masterfrom
adam.hooper/propagate-unparsed

Conversation

@ddadamhooper

@ddadamhooper ddadamhooper commented Jul 13, 2026

Copy link
Copy Markdown

What does this PR do?

Correctly fails to parse a FormulaAndFunctionEventQueryDefinition when it contains an invalid group_by list entry.

The code generator was failing to propagate unparsed from a oneOf to its parent in this case.

(DataDog's APIs don't generally return invalid objects, so this shouldn't affect users. The value comes with an upcoming PR, where a oneOf item contains a list which contains another oneOf item. In that case, we need to detect invalid objects from the inner oneOf.)

Review checklist

Please check relevant items below:

  • This PR includes all newly recorded cassettes for any modified tests.
  • This PR does not rely on API client schema changes.
    • The CI should be fully passing.
  • Or, this PR relies on API schema changes and this is a Draft PR that includes tests.
    • Note: CI shouldn't be run on this Draft PR, as its expected to fail without the corresponding schema changes.

@ddadamhooper ddadamhooper added the changelog/Fixed Fixed features results into a bug fix version bump label Jul 13, 2026
@ddadamhooper ddadamhooper marked this pull request as ready for review July 13, 2026 18:00
@ddadamhooper ddadamhooper requested review from a team as code owners July 13, 2026 18:00
@ddadamhooper

Copy link
Copy Markdown
Author

@codex review

@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: 80fbe0bc2c

ℹ️ 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".

public void setGroupBy(FormulaAndFunctionEventQueryGroupByConfig groupBy) {
this.groupBy = groupBy;
if (groupBy != null) {
this.unparsed |= groupBy.unparsed;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Propagate unparsed through the oneOf group_by wrapper

In the event-query path, group_by is a FormulaAndFunctionEventQueryGroupByConfig oneOf wrapper; its deserializer stores the List<FormulaAndFunctionEventQueryGroupBy> variant and increments match without checking whether any list item has unparsed=true, so this added copy still sees groupBy.unparsed == false. A payload such as group_by: [{facet: "@x", sort: {aggregation: "NOT_A_VALID_AGGREGATION"}}] therefore leaves FormulaAndFunctionEventQueryDefinition parsed even though the child sort is invalid; the new test covers the UserJourney model's direct list, not this oneOf wrapper.

Useful? React with 👍 / 👎.

@jack-edmonds-dd jack-edmonds-dd left a comment

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.

approval for modelSimple.j2 (I'm assuming the rest of the changes are generated).

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

Labels

changelog/Fixed Fixed features results into a bug fix version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants