Skip to content

Preserve model properties for composed array members - #8231

Open
Shubham Padkonde (Shubham-Padkonde) wants to merge 10 commits into
microsoft:mainfrom
Shubham-Padkonde:fix/composed-array-model-properties
Open

Shubham Padkonde (Shubham-Padkonde) wants to merge 10 commits into
microsoft:mainfrom
Shubham-Padkonde:fix/composed-array-model-properties

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown
Contributor

Fixes #8043.

When an anyOf/oneOf member is an array of a referenced model, the builder derives the model name from the array's items but passes the array wrapper to model creation. If that path is encountered first, an empty class is registered and subsequently reused by direct references.

Use the item schema for the member's model declaration and namespace lookup, while retaining the collection shape from the outer array. Primitive-member handling is unchanged.

Regression tests cover both anyOf and oneOf, both operation orders, and a namespaced component. They also verify that the composed member retains its collection type and references the same populated model. On the original code, both union-first cases failed while the two direct-first controls passed; all six final cases pass.

Validation on Linux / .NET SDK 10.0.401:

  • Full builder suite: 2,355 passed, 2 skipped.
  • CLI build passed for net8.0, net9.0, and net10.0. SourceLink warnings were emitted because a Windows-created worktree was built through WSL.
  • Generated C# from the issue example, after removing its repeated identical title and default keys (the current OpenAPI reader rejects those duplicate keys).
  • Compiled the generated models with Microsoft.Kiota.Bundle 2.1.2 and verified deserialization and serialization of all three Thing fields: UUID id, string name, and integer count. No service request was made.

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

The CLI suite also passed all 18 tests, and formatting verification passed for both changed C# files.

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

The fix and regression coverage are complete, with no unresolved blocking issues.

Review effort: Lite
Findings: None

What changed in this PR

Fixes model generation for composed array members by preserving collection shape while using the referenced item schema.

Changes:

  • Corrected model declaration and namespace resolution.
  • Added regression tests for anyOf, oneOf, traversal order, and namespaces.
  • Documented the fix in the changelog.
File Description
tests/​Kiota.Builder.Tests/​KiotaBuilderTests.ComposedArray.cs Adds composed-array regression tests.
src/​Kiota.Builder/​KiotaBuilder.cs Corrects composed array model generation.
CHANGELOG.md Documents the fix.

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

@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 review requested due to automatic review settings September 21, 2026 16:26

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.

anyOf-referenced model generated with no properties when the composed reference is traversed before a direct $ref

3 participants