Preserve model properties for composed array members - #8231
Shubham Padkonde (Shubham-Padkonde) wants to merge 10 commits into
Conversation
There was a problem hiding this comment.
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.
|
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. |
|
Shubham Padkonde (@Shubham-Padkonde) this PR is conflicting, would you mind handling the conflicts when you have a minute please? |
|
This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged. |
|
Conflicts have been resolved. A maintainer will take a look shortly. |
|
This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged. |
|
Conflicts have been resolved. A maintainer will take a look shortly. |
|
This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged. |
|
Conflicts have been resolved. A maintainer will take a look shortly. |
|
This pull request has conflicting changes, the author must resolve the conflicts before this pull request can be merged. |
|
Conflicts have been resolved. A maintainer will take a look shortly. |
Fixes #8043.
When an
anyOf/oneOfmember 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
anyOfandoneOf, 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:
titleanddefaultkeys (the current OpenAPI reader rejects those duplicate keys).Thingfields: UUIDid, stringname, and integercount. 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.