Skip to content

Resolve single allOf wrappers for enum query parameters - #8230

Open
Shubham Padkonde (Shubham-Padkonde) wants to merge 11 commits into
microsoft:mainfrom
Shubham-Padkonde:fix/allof-query-enum
Open

Shubham Padkonde (Shubham-Padkonde) wants to merge 11 commits into
microsoft:mainfrom
Shubham-Padkonde:fix/allof-query-enum

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown
Contributor

Fixes #8108.

A query parameter whose enum reference is wrapped in a single-member allOf currently falls back to string, even though a direct enum reference works. Resolve empty single-member allOf wrappers before choosing the query parameter type. Apply the same resolution to array items, preserving the enum reference/name and array shape. Schemas with their own meaningful definition, multiple members, or additional union branches are not flattened by this helper.

Added five builder cases: direct-reference control, described wrapper, nested wrappers, wrapped enum array items, and a wrapped array. The original implementation failed all four wrapped cases; the direct-reference control passed. All five pass with this change.

Validation on Linux / .NET SDK 10.0.401:

  • Full builder suite: 2,354 passed, 2 skipped.
  • CLI suite: 18 passed.
  • CLI build succeeded for its target frameworks (net8.0, net9.0, net10.0). SourceLink emitted warnings because the Windows-created worktree is built through WSL.
  • Generated Python from the issue's exact OpenAPI example: widget_type: Optional[WidgetType]; the direct enum-array parameter remains list[WidgetStatus].
  • Imported the generated Python and verified the runtime query URL contains widgetType=Advanced&statuses=Active, using the installed Kiota abstractions. No network request was sent.

Developed and tested with AI assistance. Other generated-language runtime tests and live service requests were not run.

Formatting verification passed for both changed C# files.

@baywet

Copy link
Copy Markdown
Member

Shubham Padkonde (@Shubham-Padkonde) your behaviour is disruptive, opening about 30 PRs on the repos in a couple of hours time, most likely code that was AI generated and not tested/reviewed, will only clog our review pipeline. Please stop opening additional pull requests and work on the comments added to existing ones. We have turned on pull requests limits on this repository, and will proceed to blocking you at the organization level if additional pull requests are opened on other repositories before the already opened ones are reviewed and closed/or merged.

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Nested array-item wrappers can still lose array shape and require recursive handling plus regression coverage.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Fixes query-parameter enum type resolution for eligible single-member allOf wrappers, including array scenarios.

Changes:

  • Resolves wrapped enum schemas during query parameter generation.
  • Adds regression coverage for direct, nested, described, and array cases.
  • Documents the fix in the changelog.
File Summary
tests/​Kiota.Builder.Tests/​KiotaBuilderTests.QueryEnum.cs Adds query enum regression tests.
src/​Kiota.Builder/​KiotaBuilder.cs Updates wrapped enum schema resolution.
CHANGELOG.md Documents the behavior change.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/Kiota.Builder/KiotaBuilder.cs Outdated
Copilot AI review requested due to automatic review settings September 21, 2026 13:24

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI 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.

Copilot review overview

🟢 Approval recommended

No unresolved blocking issues were identified.

Review effort: Lite
Findings: None

Resolved since last review (1)

Copilot AI review requested due to automatic review settings September 21, 2026 16:25

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 22, 2026 09:24

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 22, 2026 14:42

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@baywet

Copy link
Copy Markdown
Member

Shubham Padkonde (@Shubham-Padkonde) this PR is conflicting, would you mind handling the conflicts when you have a minute please?

Copilot AI review requested due to automatic review settings September 23, 2026 12:08

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 23, 2026 14:46

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.

Copilot AI review requested due to automatic review settings September 23, 2026 17:16

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will take a look shortly.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.

Copilot AI review requested due to automatic review settings September 24, 2026 01:02

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will take a look shortly.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.

Copilot AI review requested due to automatic review settings September 25, 2026 01:33

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will take a look shortly.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged.

Copilot AI review requested due to automatic review settings September 25, 2026 21:44

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

Conflicts have been resolved. A maintainer will take a look shortly.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Query parameter with allOf-wrapped single $ref to enum schema generates str instead of the enum type

3 participants