Skip to content

fix(serialization-form): omit the root object assignment prefix - #731

Merged
Vincent Biret (baywet) merged 2 commits into
microsoft:mainfrom
rksharma-owg:codex/serialize-root-form
Sep 11, 2026
Merged

Vincent Biret (baywet) merged 2 commits into
microsoft:mainfrom
rksharma-owg:codex/serialize-root-form

Conversation

@rksharma-owg

@rksharma-owg RKS (rksharma-owg) commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Serializing a root form object with write_object_value(None, model) produces =body=example instead of body=example. The writer omits the absent key but still emits its assignment separator.

Only add the key and = when a key is supplied. Root objects now contribute their encoded fields directly. Empty roots leave existing output untouched; named empty objects still emit their key and assignment separator. Named-object serialization and field escaping retain their existing behavior.

Validation (Python 3.12):

  • Five regressions failed before the change: absent/empty root keys, an existing field, merged object values, and an empty root object.
  • Review regression: empty roots after an existing field failed for both absent and empty-string keys before the follow-up fix. Added a named-empty-object compatibility check.
  • Form package: pytest -q — 53 passed.
  • YAPF, isort, mypy, and git diff --check passed.
  • Pylint exited successfully with 10/10; it also reports the existing unrecognized suggestion-mode configuration option.

Closes #476.

Prepared with AI assistance; reproduction and validation ran locally.

@baywet Vincent Biret (baywet) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

This comment was marked as outdated.

@baywet Vincent Biret (baywet) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making the changes!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Validation confirms the fix and preserves existing named-object behavior.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@sonarqubecloud

Copy link
Copy Markdown

@baywet
Vincent Biret (baywet) merged commit be31baf into microsoft:main Sep 11, 2026
102 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress 🚧 to Done ✔️ in Kiota Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done ✔️

Development

Successfully merging this pull request may close these issues.

[Bug] Incorrect form serialization with an object

3 participants