Fix TypeScript derived model serialization dispatch - #8241
Shubham Padkonde (Shubham-Padkonde) wants to merge 10 commits into
Conversation
|
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. |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The supplied review assessments indicate the changes are complete and approval-ready.
Review effort: Lite
Findings: None
What changed in this PR
Fixes TypeScript derived-model serialization by preserving inherited and derived properties without duplicate writes or recursive dispatch.
Changes:
- Dispatches mapped serializers before local property writes.
- Prevents self-mapping recursion.
- Updates regression tests and changelog documentation.
| File | Summary |
|---|---|
tests/Kiota.Builder.Tests/Writers/TypeScript/CodeFunctionWriterTests.cs |
Expands serializer regression coverage. |
src/Kiota.Builder/Writers/TypeScript/CodeFunctionWriter.cs |
Corrects discriminator and inheritance serialization flow. |
CHANGELOG.md |
Documents the TypeScript serialization 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) 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 #6777.
A base serializer dispatches to a derived serializer with
isSerializingDerivedType = true, but the derived serializer immediately returns when that flag is set. This drops the derived properties. Removing that guard alone can also cause duplicate property writes when invoking a derived serializer directly.Dispatch to a mapped serializer before writing properties and return its result. When serializing inherited properties, pass the flag to suppress further discriminator dispatch while still writing the parent fields. Ignore mappings back to the current type so a base-type discriminator value cannot recurse into itself.
Update the writer regressions for the null guard, parent call and discriminator dispatch; the discriminator test also covers a self-mapping and verifies dispatch precedes property writes. Existing literal-escaping checks remain passing.
Developed with Codex assistance.
Validation: