Commit 41d1397
fix(json): Fix composed type (oneOf) serialization returning empty object
When serializing composed types (oneOf wrappers/union types) using
write_object_value(None, value), the method was incorrectly using
temp_writer.writer (which is empty for composed types) instead of
temp_writer.value (which contains the serialized content).
The fix checks if temp_writer.value is available (for composed types)
and falls back to temp_writer.writer (for regular objects with properties).
This bug caused oneOf discriminated unions to serialize as {} instead of
the actual object content, breaking API requests that use composed types.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent f04ef89 commit 41d1397
2 files changed
Lines changed: 27 additions & 2 deletions
File tree
- packages/serialization/json
- kiota_serialization_json
- tests/unit
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
321 | 324 | | |
322 | | - | |
| 325 | + | |
323 | 326 | | |
324 | | - | |
| 327 | + | |
325 | 328 | | |
326 | 329 | | |
327 | 330 | | |
| |||
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
0 commit comments